Skip to content

Instantly share code, notes, and snippets.

@pgoodman
Created October 23, 2019 16:35
Show Gist options
  • Save pgoodman/2e5147cbb281e0c373022f796d82f9e0 to your computer and use it in GitHub Desktop.
Save pgoodman/2e5147cbb281e0c373022f796d82f9e0 to your computer and use it in GitHub Desktop.
anvill-decompile-7.0 --spec /tmp/slice.json --ir_out /dev/stdout
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu-elf"
%struct.Memory = type opaque
%struct.State = type { %struct.ArchState, [32 x %union.VectorReg], %struct.ArithFlags, %union.anon, %struct.Segments, %struct.AddressSpace, %struct.GPR, %struct.X87Stack, %struct.MMX, %struct.FPUStatusFlags, %union.anon, %union.FPU, %struct.SegmentCaches }
%struct.ArchState = type { i32, i32, %union.anon }
%union.VectorReg = type { %union.vec512_t }
%union.vec512_t = type { %struct.uint64v8_t }
%struct.uint64v8_t = type { [8 x i64] }
%struct.ArithFlags = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }
%struct.Segments = type { i16, %union.SegmentSelector, i16, %union.SegmentSelector, i16, %union.SegmentSelector, i16, %union.SegmentSelector, i16, %union.SegmentSelector, i16, %union.SegmentSelector }
%union.SegmentSelector = type { i16 }
%struct.AddressSpace = type { i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg }
%struct.Reg = type { %union.anon }
%struct.GPR = type { i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg, i64, %struct.Reg }
%struct.X87Stack = type { [8 x %struct.anon.3] }
%struct.anon.3 = type { i64, double }
%struct.MMX = type { [8 x %struct.anon.4] }
%struct.anon.4 = type { i64, %union.vec64_t }
%union.vec64_t = type { %struct.uint64v1_t }
%struct.uint64v1_t = type { [1 x i64] }
%struct.FPUStatusFlags = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, [4 x i8] }
%union.anon = type { i64 }
%union.FPU = type { %struct.anon.13 }
%struct.anon.13 = type { %struct.FpuFXSAVE, [96 x i8] }
%struct.FpuFXSAVE = type { %union.SegmentSelector, %union.SegmentSelector, %union.FPUAbridgedTagWord, i8, i16, i32, %union.SegmentSelector, i16, i32, %union.SegmentSelector, i16, %union.FPUControlStatus, %union.FPUControlStatus, [8 x %struct.FPUStackElem], [16 x %union.vec128_t] }
%union.FPUAbridgedTagWord = type { i8 }
%union.FPUControlStatus = type { i32 }
%struct.FPUStackElem = type { %union.anon.11, [6 x i8] }
%union.anon.11 = type { %struct.float80_t }
%struct.float80_t = type { [10 x i8] }
%union.vec128_t = type { %struct.uint128v1_t }
%struct.uint128v1_t = type { [1 x i128] }
%struct.SegmentCaches = type { %struct.SegmentShadow, %struct.SegmentShadow, %struct.SegmentShadow, %struct.SegmentShadow, %struct.SegmentShadow, %struct.SegmentShadow }
%struct.SegmentShadow = type { %union.anon, i32, i32 }
; Function Attrs: noinline nounwind ssp
define i64 @slice(i32 %edi) local_unnamed_addr #0 {
%1 = tail call i8* @llvm.returnaddress(i32 0)
%2 = ptrtoint i8* %1 to i64
%3 = trunc i32 %edi to i8
%4 = and i8 %3, 31
%5 = icmp eq i8 %4, 0
br i1 %5, label %sub_0.anvill.lifted.exit, label %6
; <label>:6: ; preds = %0
%7 = zext i8 %4 to i64
%8 = shl i64 2, %7
%9 = sub nsw i64 32, %7
%10 = lshr i64 2, %9
%11 = or i64 %10, %8
%12 = and i64 %11, 4294967295
br label %sub_0.anvill.lifted.exit
sub_0.anvill.lifted.exit: ; preds = %6, %0
%.sroa.304.0 = phi i64 [ 2, %0 ], [ %12, %6 ]
%13 = tail call %struct.Memory* @__remill_function_return(%struct.State* nonnull undef, i64 %2, %struct.Memory* null) #3
ret i64 %.sroa.304.0
}
; Function Attrs: nounwind readnone
declare i8* @llvm.returnaddress(i32) #1
; Function Attrs: noduplicate noinline nounwind optnone
declare %struct.Memory* @__remill_function_return(%struct.State* dereferenceable(3376), i64, %struct.Memory*) local_unnamed_addr #2
attributes #0 = { noinline nounwind ssp }
attributes #1 = { nounwind readnone }
attributes #2 = { noduplicate noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
attributes #3 = { nounwind }
{
"arch": "amd64",
"os": "linux",
"functions": [
{
"address": 0,
"name": "slice",
"parameters": [
{
"name": "edi",
"type": "I",
"register": "EDI"
}
],
"return_address": {
"memory": {
"register": "RSP"
},
"type": "I"
},
"return_values": [
{
"register": "RAX",
"type": "L"
}
],
"return_stack_pointer": {
"register": "RSP",
"offset": 8
}
}
],
"stack": {
"address": 140732920754176,
"size": 24576,
"start_offset": 4096
},
"memory": [
{
"address": 0,
"data": "4889f9b802000000d3c0c3",
"is_readable": true,
"is_executable": true
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment