xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int unlz77wii_raw00(unsigned char *in, int insz, unsigned char *out,
                    int outsz) {
  if (insz > outsz)
    return (-1);
  memcpy(out, in, outsz);
  return (outsz);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x24(%rbp),%eax
jle    113e <unlz77wii_raw00+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1154 <unlz77wii_raw00+0x44>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rbx
mov    %ecx,%ebx
mov    $0xffffffff,%eax
cmp    %ecx,%esi
jg     112e <unlz77wii_raw00+0x1e>
mov    %rdi,%rcx
mov    %rdx,%rdi
mov    %rcx,%rsi
mov    %ebx,%edx
call   1030 <memcpy@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @unlz77wii_raw00(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%10 = load i32, i32* %7
%11 = load i32, i32* %9
%12 = icmp sgt i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %4
store i32 -1, i32* %5
br label %20
14: ; preds = %4
%15 = load i8*, i8** %8
%16 = load i8*, i8** %6
%17 = load i32, i32* %9
%18 = call i32 @memcpy(i8* %15, i8* %16, i32 %17)
%19 = load i32, i32* %9
store i32 %19, i32* %5
br label %20
20: ; preds = %14, %13
%21 = load i32, i32* %5
ret i32 %21
}

LLVM IR (-O2):
define i32 @unlz77wii_raw00(i8* %0, i32 %1, i8* %2, i32 %3) {
%5 = icmp sgt i32 %1, %3
br i1 %5, label %8, label %6
6: ; preds = %4
%7 = tail call i32 @memcpy(i8* %2, i8* %0, i32 %3)
br label %8
8: ; preds = %4, %6
%9 = phi i32 [ %3, %6 ], [ -1, %4 ]
ret i32 %9
}
char *strchr(const char *s, int c) {
  while (*s++ != c)
    ;
  return (char *)s;
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
cmp    -0xc(%rbp),%eax
je     112b <strchr+0x2b>
jmp    110b <strchr+0xb>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl (%rax),%ecx
add    $0x1,%rax
cmp    %esi,%ecx
jne    1110 <strchr+0x10>
ret

LLVM IR (-O0):
define i8* @strchr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %12, %2
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %3
%8 = load i8, i8* %6
%9 = sext i8 %8 to i32
%10 = load i32, i32* %4
%11 = icmp ne i32 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %5
br label %5
13: ; preds = %5
%14 = load i8*, i8** %3
ret i8* %14
}

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %5, %3 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, %1
br i1 %8, label %9, label %3
9: ; preds = %3
ret i8* %5
}
void glClientActiveTexture(void) { return; }


x86 assembly (clang, -O0):
<glClientActiveTexture>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<glClientActiveTexture>:
ret

LLVM IR (-O0):
define void @glClientActiveTexture() {
ret void
}

LLVM IR (-O2):
define void @glClientActiveTexture() {
ret void
}
int MapToDiscrete(double Value, double InMax, double OutMax) {
  int Result;
  if (InMax == 0) {
    InMax = 1;
  }
  Result = (int)((Value / InMax) * OutMax);
  return (Result);
}


x86 assembly (clang, -O0):
<MapToDiscrete>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1138 <MapToDiscrete+0x38>
jp     1138 <MapToDiscrete+0x38>
movsd  0xecd(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MapToDiscrete>:
xorpd  %xmm3,%xmm3
cmpeqsd %xmm1,%xmm3
movsd  0xeef(%rip),%xmm4
andpd  %xmm3,%xmm4
andnpd %xmm1,%xmm3
orpd   %xmm4,%xmm3
divsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @MapToDiscrete(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %5
%9 = fcmp oeq double %8, 0.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %3
store double 1.000000e+00, double* %5
br label %11
11: ; preds = %10, %3
%12 = load double, double* %4
%13 = load double, double* %5
%14 = fdiv double %12, %13
%15 = load double, double* %6
%16 = fmul double %14, %15
%17 = fptosi double %16 to i32
store i32 %17, i32* %7
%18 = load i32, i32* %7
ret i32 %18
}

LLVM IR (-O2):
define i32 @MapToDiscrete(double %0, double %1, double %2) {
%4 = fcmp oeq double %1, 0.000000e+00
%5 = select i1 %4, double 1.000000e+00, double %1
%6 = fdiv double %0, %5
%7 = fmul double %6, %2
%8 = fptosi double %7 to i32
ret i32 %8
}
/* Type definitions */
struct memorycontainer {
  int dummy;
};

/* Variables and functions */
struct memorycontainer *
createUnaryGeneralMathsExpression(struct memorycontainer *, int);
struct memorycontainer *
createCosHExpression(struct memorycontainer *expression) {
  return createUnaryGeneralMathsExpression(expression, 0x0008);
}


x86 assembly (clang, -O0):
<createCosHExpression>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x8,%esi
call   1030 <createUnaryGeneralMathsExpression@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createCosHExpression>:
mov    $0x8,%esi
jmp    1030 <createUnaryGeneralMathsExpression@plt>

LLVM IR (-O0):
%struct.memorycontainer = type { i32 }
define %struct.memorycontainer* @createCosHExpression(%struct.memorycontainer* %0) {
%2 = alloca %struct.memorycontainer*
store %struct.memorycontainer* %0, %struct.memorycontainer** %2
%3 = load %struct.memorycontainer*, %struct.memorycontainer** %2
%4 = call %struct.memorycontainer* @createUnaryGeneralMathsExpression(%struct.memorycontainer* %3, i32 8)
ret %struct.memorycontainer* %4
}

LLVM IR (-O2):
%struct.memorycontainer = type { i32 }
define %struct.memorycontainer* @createCosHExpression(%struct.memorycontainer* %0) {
%2 = tail call %struct.memorycontainer* @createUnaryGeneralMathsExpression(%struct.memorycontainer* %0, i32 8)
ret %struct.memorycontainer* %2
}
void i32_to_float(int i32, float *p) {
  *p = (float)((((double)i32)) * (1.0 / (2147483648.0)));
}


x86 assembly (clang, -O0):
<i32_to_float>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xee8(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<i32_to_float>:
cvtsi2sd %edi,%xmm0
mulsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rsi)
ret

LLVM IR (-O0):
define void @i32_to_float(i32 %0, float* %1) {
%3 = alloca i32
%4 = alloca float*
store i32 %0, i32* %3
store float* %1, float** %4
%5 = load i32, i32* %3
%6 = sitofp i32 %5 to double
%7 = fmul double %6, 0x3E00000000000000
%8 = fptrunc double %7 to float
%9 = load float*, float** %4
store float %8, float* %9
ret void
}

LLVM IR (-O2):
define void @i32_to_float(i32 %0, float* nocapture writeonly %1) {
%3 = sitofp i32 %0 to double
%4 = fmul double %3, 0x3E00000000000000
%5 = fptrunc double %4 to float
store float %5, float* %1
ret void
}
int mkstemp(template) char *template;
{ return gen_tempname(template, 1); }


x86 assembly (clang, -O0):
<mkstemp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1030 <gen_tempname@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkstemp>:
mov    $0x1,%esi
xor    %eax,%eax
jmp    1030 <gen_tempname@plt>

LLVM IR (-O0):
define i32 @mkstemp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @gen_tempname to i32 (i8*, i32, ...)*)(i8* %3, i32 1)
ret i32 %4
}

LLVM IR (-O2):
define i32 @mkstemp(i8* %0) {
%2 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @gen_tempname to i32 (i8*, i32, ...)*)(i8* %0, i32 1)
ret i32 %2
}
main(argc, argv) int argc;
char *argv[];
{
  initialize(argc, argv);
  readClassFile();
  inputContentsVector();
  outputRiddleFragment();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <initialize@plt>
mov    $0x0,%al
call   1060 <readClassFile@plt>
mov    $0x0,%al
call   1040 <inputContentsVector@plt>
mov    $0x0,%al
call   1050 <outputRiddleFragment@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <initialize@plt>
xor    %eax,%eax
call   1060 <readClassFile@plt>
xor    %eax,%eax
call   1040 <inputContentsVector@plt>
xor    %eax,%eax
call   1050 <outputRiddleFragment@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = load i8**, i8*** %4
%7 = call i32 (i32, i8**, ...) bitcast (i32 (...)* @initialize to i32 (i32, i8**, ...)*)(i32 %5, i8** %6)
%8 = call i32 (...) @readClassFile()
%9 = call i32 (...) @inputContentsVector()
%10 = call i32 (...) @outputRiddleFragment()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (i32, i8**, ...) bitcast (i32 (...)* @initialize to i32 (i32, i8**, ...)*)(i32 %0, i8** %1)
%4 = tail call i32 (...) @readClassFile()
%5 = tail call i32 (...) @inputContentsVector()
%6 = tail call i32 (...) @outputRiddleFragment()
ret i32 0
}
/* Variables and functions */
void *cm(size_t);
void *c2(size_t n) { return cm(n); }


x86 assembly (clang, -O0):
<c2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <cm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c2>:
jmp    1030 <cm@plt>

LLVM IR (-O0):
define i8* @c2(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i8* @cm(i64 %3)
ret i8* %4
}

LLVM IR (-O2):
define i8* @c2(i64 %0) {
%2 = tail call i8* @cm(i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ move(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ setClaw(int, int /*<<< orphan*/);
int /*<<< orphan*/ setLift(int, int /*<<< orphan*/);
void allStop() {
  move(1000, 0, 0);
  setLift(1000, 0);
  setClaw(1000, 0);
}


x86 assembly (clang, -O0):
<allStop>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3e8,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1050 <move@plt>
mov    $0x3e8,%edi
xor    %esi,%esi
call   1040 <setLift@plt>
mov    $0x3e8,%edi
xor    %esi,%esi
call   1030 <setClaw@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<allStop>:
push   %rax
mov    $0x3e8,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <move@plt>
mov    $0x3e8,%edi
xor    %esi,%esi
call   1040 <setLift@plt>
mov    $0x3e8,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <setClaw@plt>

LLVM IR (-O0):
define void @allStop() {
%1 = call i32 @move(i32 1000, i32 0, i32 0)
%2 = call i32 @setLift(i32 1000, i32 0)
%3 = call i32 @setClaw(i32 1000, i32 0)
ret void
}

LLVM IR (-O2):
define void @allStop() {
%1 = tail call i32 @move(i32 1000, i32 0, i32 0)
%2 = tail call i32 @setLift(i32 1000, i32 0)
%3 = tail call i32 @setClaw(i32 1000, i32 0)
ret void
}
unsigned xrop3_135_0_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = D & S;
  stk1 = T ^ stk2;
  stk1 = ~stk1;
  return stk1;
}


x86 assembly (clang, -O0):
<xrop3_135_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_135_0_0>:
mov    %esi,%eax
shl    $0x8,%eax
or     %esi,%eax
xor    %edi,%eax
not    %eax
ret

LLVM IR (-O0):
define i32 @xrop3_135_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %5
%23 = load i32, i32* %6
%24 = and i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %7
%26 = load i32, i32* %9
%27 = xor i32 %25, %26
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = xor i32 %28, -1
store i32 %29, i32* %8
%30 = load i32, i32* %8
ret i32 %30
}

LLVM IR (-O2):
define i32 @xrop3_135_0_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = zext i8 %1 to i32
%5 = mul nuw nsw i32 %4, 257
%6 = xor i32 %5, %3
%7 = xor i32 %6, -1
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ seed48(unsigned short *);
void srand48(long x) {
  unsigned short seed[3];
  seed[0] = (unsigned short)(x & 0xffff);
  seed[1] = (unsigned short)((x & 0xffff0000) >> 16);
  seed[2] = (unsigned short)(0xf0b4);
  seed48(seed);
}


x86 assembly (clang, -O0):
<srand48>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xffff,%rax
mov    %ax,-0xe(%rbp)
movabs $0xffff0000,%rax
and    -0x8(%rbp),%rax
sar    $0x10,%rax
mov    %ax,-0xc(%rbp)
movw   $0xf0b4,-0xa(%rbp)
lea    -0xe(%rbp),%rdi
call   1030 <seed48@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<srand48>:
push   %rax
mov    %di,0x2(%rsp)
shr    $0x10,%rdi
mov    %di,0x4(%rsp)
movw   $0xf0b4,0x6(%rsp)
lea    0x2(%rsp),%rdi
call   1030 <seed48@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @srand48(i64 %0) {
%2 = alloca i64
%3 = alloca [3 x i16]
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = and i64 %4, 65535
%6 = trunc i64 %5 to i16
%7 = getelementptr inbounds [3 x i16], [3 x i16]* %3, i64 0, i64 0
store i16 %6, i16* %7
%8 = load i64, i64* %2
%9 = and i64 %8, 4294901760
%10 = ashr i64 %9, 16
%11 = trunc i64 %10 to i16
%12 = getelementptr inbounds [3 x i16], [3 x i16]* %3, i64 0, i64 1
store i16 %11, i16* %12
%13 = getelementptr inbounds [3 x i16], [3 x i16]* %3, i64 0, i64 2
store i16 -3916, i16* %13
%14 = getelementptr inbounds [3 x i16], [3 x i16]* %3, i64 0, i64 0
%15 = call i32 @seed48(i16* %14)
ret void
}

LLVM IR (-O2):
define void @srand48(i64 %0) {
%2 = alloca [3 x i16]
%3 = bitcast [3 x i16]* %2 to i8*
%4 = trunc i64 %0 to i16
%5 = getelementptr inbounds [3 x i16], [3 x i16]* %2, i64 0, i64 0
store i16 %4, i16* %5
%6 = lshr i64 %0, 16
%7 = trunc i64 %6 to i16
%8 = getelementptr inbounds [3 x i16], [3 x i16]* %2, i64 0, i64 1
store i16 %7, i16* %8
%9 = getelementptr inbounds [3 x i16], [3 x i16]* %2, i64 0, i64 2
store i16 -3916, i16* %9
%10 = call i32 @seed48(i16* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ do_something(int);
int foo(int invariant) {
  do_something(0);
  do_something(1);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
xor    %edi,%edi
call   1030 <do_something@plt>
mov    $0x1,%edi
call   1030 <do_something@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
xor    %edi,%edi
call   1030 <do_something@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <do_something@plt>

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 @do_something(i32 0)
%5 = call i32 @do_something(i32 1)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = tail call i32 @do_something(i32 0)
%3 = tail call i32 @do_something(i32 1)
ret i32 undef
}
int fork() { return 0; }


x86 assembly (clang, -O0):
<fork>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fork>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @fork() {
ret i32 0
}

LLVM IR (-O2):
define i32 @fork() {
ret i32 0
}
/* Variables and functions */
double k_to_c(double);
double k_to_f(double kelvin) { return (k_to_c(kelvin) * 9.0 / 5.0) + 32; }


x86 assembly (clang, -O0):
<k_to_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <k_to_c@plt>
movsd  0xee1(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xecd(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xeb9(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<k_to_f>:
push   %rax
call   1030 <k_to_c@plt>
mulsd  0xee2(%rip),%xmm0
divsd  0xee2(%rip),%xmm0
addsd  0xee2(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @k_to_f(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @k_to_c(double %3)
%5 = fmul double %4, 9.000000e+00
%6 = fdiv double %5, 5.000000e+00
%7 = fadd double %6, 3.200000e+01
ret double %7
}

LLVM IR (-O2):
define double @k_to_f(double %0) {
%2 = tail call double @k_to_c(double %0)
%3 = fmul double %2, 9.000000e+00
%4 = fdiv double %3, 5.000000e+00
%5 = fadd double %4, 3.200000e+01
ret double %5
}
int stringlength(char *string) {
  int count = 0;
  char tmpChar;
  tmpChar = string[0];
  while (tmpChar != 0) {
    count++;
    tmpChar = string[count];
  }
  return count;
}


x86 assembly (clang, -O0):
<stringlength>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0x0,%eax
je     1141 <stringlength+0x41>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xd(%rbp)
jmp    1118 <stringlength+0x18>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stringlength>:
cmpb   $0x0,(%rdi)
je     111c <stringlength+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <stringlength+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @stringlength(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
store i8 %7, i8* %4
br label %8
8: ; preds = %12, %1
%9 = load i8, i8* %4
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %8
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
%15 = load i8*, i8** %2
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
store i8 %19, i8* %4
br label %8
20: ; preds = %8
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @stringlength(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %6, %4 ], [ 0, %1 ]
%6 = add nuw nsw i64 %5, 1
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %10, label %4
10: ; preds = %4
%11 = trunc i64 %6 to i32
br label %12
12: ; preds = %10, %1
%13 = phi i32 [ 0, %1 ], [ %11, %10 ]
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ size(int *);
int main() {
  int arr[10];
  size(arr);
  printf("%d\n", sizeof(arr));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <size@plt>
lea    0xec1(%rip),%rdi
mov    $0x28,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    %rsp,%rdi
call   1030 <size@plt>
lea    0xecd(%rip),%rdi
mov    $0x28,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
store i32 0, i32* %1
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%4 = call i32 @size(i32* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 40)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @size(i32* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 40)
ret i32 0
}
int f_le_mr1(float *a1, float a2) { return (((*a1) <= (a2))); }


x86 assembly (clang, -O0):
<f_le_mr1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_le_mr1>:
xor    %eax,%eax
ucomiss (%rdi),%xmm0
setae  %al
ret

LLVM IR (-O0):
define i32 @f_le_mr1(float* %0, float %1) {
%3 = alloca float*
%4 = alloca float
store float* %0, float** %3
store float %1, float* %4
%5 = load float*, float** %3
%6 = load float, float* %5
%7 = load float, float* %4
%8 = fcmp ole float %6, %7
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @f_le_mr1(float* nocapture %0, float %1) {
%3 = load float, float* %0
%4 = fcmp ole float %3, %1
%5 = zext i1 %4 to i32
ret i32 %5
}
int something() { int x; }


x86 assembly (clang, -O0):
<something>:
push   %rbp
mov    %rsp,%rbp
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<something>:
ret

LLVM IR (-O0):
define i32 @something() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @something() {
ret i32 undef
}
void del_v_i(int *v, int i, int *size) {
  int j;
  for (j = i; j < (*size) - 1; j++) {
    v[j] = v[j + 1];
  }
  (*size)--;
}


x86 assembly (clang, -O0):
<del_v_i>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1152 <del_v_i+0x52>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <del_v_i+0x15>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0xffffffff,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<del_v_i>:
mov    (%rdx),%eax
add    $0xffffffff,%eax
cmp    %esi,%eax
jle    112a <del_v_i+0x2a>
movslq %esi,%rcx
nopl   0x0(%rax)
mov    0x4(%rdi,%rcx,4),%eax
mov    %eax,(%rdi,%rcx,4)
lea    0x1(%rcx),%rsi
movslq (%rdx),%rax
add    $0xffffffffffffffff,%rax
mov    %rsi,%rcx
cmp    %rax,%rsi
jl     1110 <del_v_i+0x10>
mov    %eax,(%rdx)
ret

LLVM IR (-O0):
define void @del_v_i(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = load i32, i32* %5
store i32 %8, i32* %7
br label %9
9: ; preds = %26, %3
%10 = load i32, i32* %7
%11 = load i32*, i32** %6
%12 = load i32, i32* %11
%13 = sub nsw i32 %12, 1
%14 = icmp slt i32 %10, %13
br i1 %14, label %15, label %29
15: ; preds = %9
%16 = load i32*, i32** %4
%17 = load i32, i32* %7
%18 = add nsw i32 %17, 1
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %16, i64 %19
%21 = load i32, i32* %20
%22 = load i32*, i32** %4
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
store i32 %21, i32* %25
br label %26
26: ; preds = %15
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %9
29: ; preds = %9
%30 = load i32*, i32** %6
%31 = load i32, i32* %30
%32 = add nsw i32 %31, -1
store i32 %32, i32* %30
ret void
}

LLVM IR (-O2):
define void @del_v_i(i32* nocapture %0, i32 %1, i32* nocapture %2) {
%4 = load i32, i32* %2
%5 = add nsw i32 %4, -1
%6 = icmp sgt i32 %5, %1
br i1 %6, label %7, label %19
7: ; preds = %3
%8 = sext i32 %1 to i64
br label %9
9: ; preds = %7, %9
%10 = phi i64 [ %8, %7 ], [ %11, %9 ]
%11 = add nsw i64 %10, 1
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
%14 = getelementptr inbounds i32, i32* %0, i64 %10
store i32 %13, i32* %14
%15 = load i32, i32* %2
%16 = add nsw i32 %15, -1
%17 = sext i32 %16 to i64
%18 = icmp slt i64 %11, %17
br i1 %18, label %9, label %19
19: ; preds = %9, %3
%20 = phi i32 [ %5, %3 ], [ %16, %9 ]
store i32 %20, i32* %2
ret void
}
int NameEqual(const char *a, const char *b, int l) {
  while (l--)
    if (*a++ != *b++)
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<NameEqual>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     1160 <NameEqual+0x60>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     115b <NameEqual+0x5b>
movl   $0x0,-0x4(%rbp)
jmp    1167 <NameEqual+0x67>
jmp    110f <NameEqual+0xf>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<NameEqual>:
mov    %edx,%r8d
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %ecx,%r8d
je     1128 <NameEqual+0x28>
movzbl (%rdi,%rcx,1),%edx
lea    0x1(%rcx),%rax
cmp    (%rsi,%rcx,1),%dl
mov    %rax,%rcx
je     1110 <NameEqual+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @NameEqual(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
br label %8
8: ; preds = %23, %3
%9 = load i32, i32* %7
%10 = add nsw i32 %9, -1
store i32 %10, i32* %7
%11 = icmp ne i32 %9, 0
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = load i8*, i8** %5
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %5
%15 = load i8, i8* %13
%16 = sext i8 %15 to i32
%17 = load i8*, i8** %6
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %6
%19 = load i8, i8* %17
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %16, %20
br i1 %21, label %22, label %23
22: ; preds = %12
store i32 0, i32* %4
br label %25
23: ; preds = %12
br label %8
24: ; preds = %8
store i32 1, i32* %4
br label %25
25: ; preds = %24, %22
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
define i32 @NameEqual(i8* nocapture %0, i8* nocapture %1, i32 %2) {
br label %4
4: ; preds = %9, %3
%5 = phi i8* [ %0, %3 ], [ %11, %9 ]
%6 = phi i8* [ %1, %3 ], [ %13, %9 ]
%7 = phi i32 [ %2, %3 ], [ %10, %9 ]
%8 = icmp eq i32 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %4
%10 = add nsw i32 %7, -1
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = load i8, i8* %5
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %6
%15 = icmp eq i8 %12, %14
br i1 %15, label %4, label %16
16: ; preds = %4, %9
%17 = phi i32 [ 0, %9 ], [ 1, %4 ]
ret i32 %17
}
void rop3_28_1_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = *D & T;
  stk2 = S | stk3;
  stk1 = T ^ stk2;
  *D = (stk1 & (~S)) | (*D & S);
}


x86 assembly (clang, -O0):
<rop3_28_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xa(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xd(%rbp)
movzbl -0x9(%rbp),%eax
movzbl -0xd(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xc(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0xc(%rbp),%ecx
xor    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
movzbl -0x9(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl (%rcx),%ecx
movzbl -0x9(%rbp),%edx
and    %edx,%ecx
or     %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_28_1_0>:
mov    (%rdi),%al
mov    %eax,%ecx
and    %dl,%cl
or     %sil,%cl
xor    %dl,%cl
xor    %cl,%al
and    %sil,%al
xor    %cl,%al
mov    %al,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_28_1_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = load i8, i8* %6
%14 = zext i8 %13 to i32
%15 = and i32 %12, %14
%16 = trunc i32 %15 to i8
store i8 %16, i8* %9
%17 = load i8, i8* %5
%18 = zext i8 %17 to i32
%19 = load i8, i8* %9
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %8
%23 = load i8, i8* %6
%24 = zext i8 %23 to i32
%25 = load i8, i8* %8
%26 = zext i8 %25 to i32
%27 = xor i32 %24, %26
%28 = trunc i32 %27 to i8
store i8 %28, i8* %7
%29 = load i8, i8* %7
%30 = zext i8 %29 to i32
%31 = load i8, i8* %5
%32 = zext i8 %31 to i32
%33 = xor i32 %32, -1
%34 = and i32 %30, %33
%35 = load i8*, i8** %4
%36 = load i8, i8* %35
%37 = zext i8 %36 to i32
%38 = load i8, i8* %5
%39 = zext i8 %38 to i32
%40 = and i32 %37, %39
%41 = or i32 %34, %40
%42 = trunc i32 %41 to i8
%43 = load i8*, i8** %4
store i8 %42, i8* %43
ret void
}

LLVM IR (-O2):
define void @rop3_28_1_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = load i8, i8* %0
%5 = and i8 %4, %2
%6 = or i8 %5, %1
%7 = xor i8 %6, %2
%8 = xor i8 %1, -1
%9 = and i8 %7, %8
%10 = and i8 %4, %1
%11 = or i8 %9, %10
store i8 %11, i8* %0
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t am_util_math_bcd_to_dec(uint8_t ui8BCDByte) {
  return (((ui8BCDByte & 0xF0) >> 4) * 10) + (ui8BCDByte & 0x0F);
}


x86 assembly (clang, -O0):
<am_util_math_bcd_to_dec>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf0,%eax
sar    $0x4,%eax
imul   $0xa,%eax,%eax
mov    -0x4(%rbp),%ecx
and    $0xf,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<am_util_math_bcd_to_dec>:
mov    %edi,%eax
shr    $0x4,%eax
and    $0xf,%eax
lea    (%rax,%rax,4),%eax
and    $0xf,%edi
lea    (%rdi,%rax,2),%eax
ret

LLVM IR (-O0):
define i32 @am_util_math_bcd_to_dec(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 240
%5 = ashr i32 %4, 4
%6 = mul nsw i32 %5, 10
%7 = load i32, i32* %2
%8 = and i32 %7, 15
%9 = add nsw i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @am_util_math_bcd_to_dec(i32 %0) {
%2 = lshr i32 %0, 4
%3 = and i32 %2, 15
%4 = mul nuw nsw i32 %3, 10
%5 = and i32 %0, 15
%6 = add nuw nsw i32 %4, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ driv();
void main(void) { driv(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <driv@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
jmp    1030 <driv@plt>

LLVM IR (-O0):
define void @main() {
%1 = call i32 (...) @driv()
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @driv()
ret void
}
/* Variables and functions */
unsigned long long rdmsr(int);
int /*<<< orphan*/ wrmsr(int, unsigned long long);
void apic_disable(void) { wrmsr(0x1b, rdmsr(0x1b) & ~(1ULL << 11)); }


x86 assembly (clang, -O0):
<apic_disable>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1b,%edi
call   1030 <rdmsr@plt>
mov    %rax,%rsi
and    $0xfffffffffffff7ff,%rsi
mov    $0x1b,%edi
call   1040 <wrmsr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<apic_disable>:
push   %rax
mov    $0x1b,%edi
call   1030 <rdmsr@plt>
and    $0xfffffffffffff7ff,%rax
mov    $0x1b,%edi
mov    %rax,%rsi
pop    %rax
jmp    1040 <wrmsr@plt>

LLVM IR (-O0):
define void @apic_disable() {
%1 = call i64 @rdmsr(i32 27)
%2 = and i64 %1, -2049
%3 = call i32 @wrmsr(i32 27, i64 %2)
ret void
}

LLVM IR (-O2):
define void @apic_disable() {
%1 = tail call i64 @rdmsr(i32 27)
%2 = and i64 %1, -2049
%3 = tail call i32 @wrmsr(i32 27, i64 %2)
ret void
}
void rop3_175_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  stk2 = ~T;
  stk1 = *D | stk2;
  *D = stk1;
}


x86 assembly (clang, -O0):
<rop3_175_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
movzbl -0xc(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_175_0_0>:
not    %dl
or     %dl,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_175_0_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%9 = load i8, i8* %6
%10 = zext i8 %9 to i32
%11 = xor i32 %10, -1
%12 = trunc i32 %11 to i8
store i8 %12, i8* %8
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = load i8, i8* %8
%17 = zext i8 %16 to i32
%18 = or i32 %15, %17
%19 = trunc i32 %18 to i8
store i8 %19, i8* %7
%20 = load i8, i8* %7
%21 = load i8*, i8** %4
store i8 %20, i8* %21
ret void
}

LLVM IR (-O2):
define void @rop3_175_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %2, -1
%5 = load i8, i8* %0
%6 = or i8 %5, %4
store i8 %6, i8* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __u8;
typedef int __u16;

/* Variables and functions */
void put_unaligned_le16(__u16 val, void *_ptr) {
  __u8 *ptr = _ptr;
  *ptr++ = val;
  *ptr++ = val >> 8;
}


x86 assembly (clang, -O0):
<put_unaligned_le16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x18(%rbp)
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x18(%rbp)
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_unaligned_le16>:
mov    %edi,(%rsi)
sar    $0x8,%edi
mov    %edi,0x4(%rsi)
ret

LLVM IR (-O0):
define void @put_unaligned_le16(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32*
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32, i32* %3
%9 = load i32*, i32** %5
%10 = getelementptr inbounds i32, i32* %9, i32 1
store i32* %10, i32** %5
store i32 %8, i32* %9
%11 = load i32, i32* %3
%12 = ashr i32 %11, 8
%13 = load i32*, i32** %5
%14 = getelementptr inbounds i32, i32* %13, i32 1
store i32* %14, i32** %5
store i32 %12, i32* %13
ret void
}

LLVM IR (-O2):
define void @put_unaligned_le16(i32 %0, i8* nocapture writeonly %1) {
%3 = bitcast i8* %1 to i32*
%4 = getelementptr inbounds i8, i8* %1, i64 4
%5 = bitcast i8* %4 to i32*
store i32 %0, i32* %3
%6 = ashr i32 %0, 8
store i32 %6, i32* %5
ret void
}
/* Variables and functions */
unsigned int f(unsigned int);
unsigned int f2(unsigned int x) { return f(x - 1); }


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
add    $0xffffffff,%edi
jmp    1030 <f@plt>

LLVM IR (-O0):
define i32 @f2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub i32 %3, 1
%5 = call i32 @f(i32 %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @f2(i32 %0) {
%2 = add i32 %0, -1
%3 = tail call i32 @f(i32 %2)
ret i32 %3
}
void symbol_CheckIndexInRange(int Index) {}


x86 assembly (clang, -O0):
<symbol_CheckIndexInRange>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<symbol_CheckIndexInRange>:
ret

LLVM IR (-O0):
define void @symbol_CheckIndexInRange(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @symbol_CheckIndexInRange(i32 %0) {
ret void
}
/* Type definitions */
struct rlimit {
  int /*<<< orphan*/ rlim_max;
  int /*<<< orphan*/ rlim_cur;
};

/* Variables and functions */
int /*<<< orphan*/ RLIMIT_AS;
int /*<<< orphan*/ getrlimit(int /*<<< orphan*/, struct rlimit *);
int /*<<< orphan*/ setrlimit(int /*<<< orphan*/, struct rlimit *);
void liftrlimit() {
  struct rlimit r;
  getrlimit(RLIMIT_AS, &r);
  r.rlim_cur = r.rlim_max;
  setrlimit(RLIMIT_AS, &r);
}


x86 assembly (clang, -O0):
<liftrlimit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1040 <getrlimit@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <setrlimit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<liftrlimit>:
push   %r14
push   %rbx
push   %rax
mov    0x2eb5(%rip),%r14
mov    (%r14),%edi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <getrlimit@plt>
mov    (%rsp),%eax
mov    %eax,0x4(%rsp)
mov    (%r14),%edi
mov    %rbx,%rsi
call   1030 <setrlimit@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.rlimit = type { i32, i32 }
@RLIMIT_AS = global i32 0
define void @liftrlimit() {
%1 = alloca %struct.rlimit
%2 = load i32, i32* @RLIMIT_AS
%3 = call i32 @getrlimit(i32 %2, %struct.rlimit* %1)
%4 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i32 0, i32 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i32 0, i32 1
store i32 %5, i32* %6
%7 = load i32, i32* @RLIMIT_AS
%8 = call i32 @setrlimit(i32 %7, %struct.rlimit* %1)
ret void
}

LLVM IR (-O2):
%struct.rlimit = type { i32, i32 }
@RLIMIT_AS = global i32 0
define void @liftrlimit() {
%1 = alloca %struct.rlimit
%2 = bitcast %struct.rlimit* %1 to i8*
%3 = load i32, i32* @RLIMIT_AS
%4 = call i32 @getrlimit(i32 %3, %struct.rlimit* %1)
%5 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 1
store i32 %6, i32* %7
%8 = load i32, i32* @RLIMIT_AS
%9 = call i32 @setrlimit(i32 %8, %struct.rlimit* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int parse_iaid1(int /*<<< orphan*/ *, char const *, int, int /*<<< orphan*/);
int parse_uint32(uint32_t *i, const char *arg) {
  return parse_iaid1((uint8_t *)i, arg, sizeof(uint32_t), 0);
}


x86 assembly (clang, -O0):
<parse_uint32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
call   1030 <parse_iaid1@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_uint32>:
mov    $0x4,%edx
xor    %ecx,%ecx
jmp    1030 <parse_iaid1@plt>

LLVM IR (-O0):
define i32 @parse_uint32(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
store i32* %0, i32** %3
store i8* %1, i8** %4
%5 = load i32*, i32** %3
%6 = load i8*, i8** %4
%7 = call i32 @parse_iaid1(i32* %5, i8* %6, i32 4, i32 0)
ret i32 %7
}

LLVM IR (-O2):
define i32 @parse_uint32(i32* %0, i8* %1) {
%3 = tail call i32 @parse_iaid1(i32* %0, i8* %1, i32 4, i32 0)
ret i32 %3
}
int lpp(int lines_per_page, int set) {
  static int result;
  if (set)
    result = lines_per_page;
  return (result);
}


x86 assembly (clang, -O0):
<lpp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     111d <lpp+0x1d>
mov    -0x4(%rbp),%eax
mov    %eax,0x2f07(%rip)
mov    0x2f01(%rip),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lpp>:
test   %esi,%esi
je     110d <lpp+0xd>
mov    %edi,%eax
mov    %edi,0x2f18(%rip)
ret
mov    0x2f11(%rip),%eax
ret

LLVM IR (-O0):
@lpp.result = internal global i32 0
define i32 @lpp(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i32, i32* %3
store i32 %8, i32* @lpp.result
br label %9
9: ; preds = %7, %2
%10 = load i32, i32* @lpp.result
ret i32 %10
}

LLVM IR (-O2):
@lpp.result = internal unnamed_addr global i32 0
define i32 @lpp(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = load i32, i32* @lpp.result
br label %7
6: ; preds = %2
store i32 %0, i32* @lpp.result
br label %7
7: ; preds = %4, %6
%8 = phi i32 [ %5, %4 ], [ %0, %6 ]
ret i32 %8
}
/* Variables and functions */
int ap_cmd_get_int(int, int, int *);
int ap_get_length(int session, int *length) {
  return (ap_cmd_get_int(session, 0xcc16, length));
}


x86 assembly (clang, -O0):
<ap_get_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    $0xcc16,%esi
call   1030 <ap_cmd_get_int@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ap_get_length>:
mov    %rsi,%rdx
mov    $0xcc16,%esi
jmp    1030 <ap_cmd_get_int@plt>

LLVM IR (-O0):
define i32 @ap_get_length(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
store i32 %0, i32* %3
store i32* %1, i32** %4
%5 = load i32, i32* %3
%6 = load i32*, i32** %4
%7 = call i32 @ap_cmd_get_int(i32 %5, i32 52246, i32* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @ap_get_length(i32 %0, i32* %1) {
%3 = tail call i32 @ap_cmd_get_int(i32 %0, i32 52246, i32* %1)
ret i32 %3
}
__attribute__((always_)) void SCB_DisableICache(void) {}


x86 assembly (clang, -O0):
<SCB_DisableICache>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SCB_DisableICache>:
ret

LLVM IR (-O0):
define void @SCB_DisableICache() {
ret void
}

LLVM IR (-O2):
define void @SCB_DisableICache() {
ret void
}
/* Variables and functions */
void *malloc(int);
void *aligned_malloc(size_t size) {
  void *mem = malloc(size + 64 + sizeof(void *));
  void **ptr = NULL;
  if (mem != NULL) {
    ptr = (void **)((uintptr_t)(mem + 64 + sizeof(void *)) &
                    ~(uintptr_t)(64 - 1));
    ptr[-1] = mem;
  }
  return ptr;
}


x86 assembly (clang, -O0):
<aligned_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rax
add    $0x8,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1166 <aligned_malloc+0x56>
mov    -0x10(%rbp),%rax
add    $0x40,%rax
add    $0x8,%rax
and    $0xffffffffffffffc0,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,-0x8(%rax)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aligned_malloc>:
push   %rax
add    $0x48,%edi
call   1030 <malloc@plt>
test   %rax,%rax
je     112f <aligned_malloc+0x1f>
mov    %rax,%rcx
add    $0x48,%rax
and    $0xffffffffffffffc0,%rax
mov    %rcx,-0x8(%rax)
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @aligned_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i8**
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = add i64 %5, 64
%7 = add i64 %6, 8
%8 = trunc i64 %7 to i32
%9 = call i8* @malloc(i32 %8)
store i8* %9, i8** %3
store i8** null, i8*** %4
%10 = load i8*, i8** %3
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %22
12: ; preds = %1
%13 = load i8*, i8** %3
%14 = getelementptr i8, i8* %13, i64 64
%15 = getelementptr i8, i8* %14, i64 8
%16 = ptrtoint i8* %15 to i64
%17 = and i64 %16, -64
%18 = inttoptr i64 %17 to i8**
store i8** %18, i8*** %4
%19 = load i8*, i8** %3
%20 = load i8**, i8*** %4
%21 = getelementptr inbounds i8*, i8** %20, i64 -1
store i8* %19, i8** %21
br label %22
22: ; preds = %12, %1
%23 = load i8**, i8*** %4
%24 = bitcast i8** %23 to i8*
ret i8* %24
}

LLVM IR (-O2):
define i8* @aligned_malloc(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = add i32 %2, 72
%4 = tail call i8* @malloc(i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %13, label %6
6: ; preds = %1
%7 = getelementptr i8, i8* %4, i64 72
%8 = ptrtoint i8* %7 to i64
%9 = and i64 %8, -64
%10 = inttoptr i64 %9 to i8**
%11 = getelementptr inbounds i8*, i8** %10, i64 -1
store i8* %4, i8** %11
%12 = inttoptr i64 %9 to i8*
br label %13
13: ; preds = %6, %1
%14 = phi i8* [ %12, %6 ], [ null, %1 ]
ret i8* %14
}
/* Variables and functions */
int /*<<< orphan*/ gs_get_clock(long *);
long get_time() {
  long date_time[2];
  gs_get_clock(date_time);
  return date_time[0] * 86400000L + date_time[1];
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
call   1030 <gs_get_clock@plt>
imul   $0x5265c00,-0x10(%rbp),%rax
05
add    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
sub    $0x18,%rsp
mov    %rsp,%rdi
call   1030 <gs_get_clock@plt>
imul   $0x5265c00,(%rsp),%rax
05
add    0x8(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i64 @get_time() {
%1 = alloca [2 x i64]
%2 = getelementptr inbounds [2 x i64], [2 x i64]* %1, i64 0, i64 0
%3 = call i32 @gs_get_clock(i64* %2)
%4 = getelementptr inbounds [2 x i64], [2 x i64]* %1, i64 0, i64 0
%5 = load i64, i64* %4
%6 = mul nsw i64 %5, 86400000
%7 = getelementptr inbounds [2 x i64], [2 x i64]* %1, i64 0, i64 1
%8 = load i64, i64* %7
%9 = add nsw i64 %6, %8
ret i64 %9
}

LLVM IR (-O2):
define i64 @get_time() {
%1 = alloca [2 x i64]
%2 = bitcast [2 x i64]* %1 to i8*
%3 = getelementptr inbounds [2 x i64], [2 x i64]* %1, i64 0, i64 0
%4 = call i32 @gs_get_clock(i64* %3)
%5 = load i64, i64* %3
%6 = mul nsw i64 %5, 86400000
%7 = getelementptr inbounds [2 x i64], [2 x i64]* %1, i64 0, i64 1
%8 = load i64, i64* %7
%9 = add nsw i64 %6, %8
ret i64 %9
}