xunge/DecIR huggingface dataset:
unsigned int _check_times(unsigned x, unsigned y) {
  unsigned long long whole_ans =
      ((unsigned long long)x) * ((unsigned long long)y);
  unsigned word_ans = (unsigned)whole_ans;
  if (word_ans < whole_ans || word_ans > (1 << 28))
    (_throw_badalloc_fn("/scratch/repos/new/home/jordi_armengol_estape/"
                        "c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/"
                        "cyclone/refs/heads/master/bin/genfiles/bansheeif.c",
                        284));
  return word_ans;
}


x86 assembly (clang, -O0):
<_check_times>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
imul   %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%rax
jb     114d <_check_times+0x3d>
cmpl   $0x10000000,-0x14(%rbp)
jbe    1160 <_check_times+0x50>
lea    0xeac(%rip),%rdi
mov    $0x11c,%esi
mov    $0x0,%al
call   1030 <_throw_badalloc_fn@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_check_times>:
push   %rbx
mov    %edi,%eax
mul    %esi
mov    %eax,%ebx
jo     1121 <_check_times+0x11>
cmp    $0x10000001,%ebx
jb     1134 <_check_times+0x24>
lea    0xed8(%rip),%rdi
mov    $0x11c,%esi
xor    %eax,%eax
call   1030 <_throw_badalloc_fn@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [150 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/bin/genfiles/bansheeif.c\00"
define i32 @_check_times(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = load i32, i32* %4
%10 = zext i32 %9 to i64
%11 = mul i64 %8, %10
store i64 %11, i64* %5
%12 = load i64, i64* %5
%13 = trunc i64 %12 to i32
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = zext i32 %14 to i64
%16 = load i64, i64* %5
%17 = icmp ult i64 %15, %16
br i1 %17, label %21, label %18
18: ; preds = %2
%19 = load i32, i32* %6
%20 = icmp ugt i32 %19, 268435456
br i1 %20, label %21, label %23
21: ; preds = %18, %2
%22 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @_throw_badalloc_fn to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str, i64 0, i64 0), i32 284)
br label %23
23: ; preds = %21, %18
%24 = load i32, i32* %6
ret i32 %24
}

LLVM IR (-O2):
@.str = [150 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/FauxFaux/cyclone/refs/heads/master/bin/genfiles/bansheeif.c\00"
define i32 @_check_times(i32 %0, i32 %1) {
%3 = tail call { i32, i1 } @llvm.umul.with.overflow.i32(i32 %0, i32 %1)
%4 = extractvalue { i32, i1 } %3, 0
%5 = extractvalue { i32, i1 } %3, 1
%6 = icmp ugt i32 %4, 268435456
%7 = or i1 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @_throw_badalloc_fn to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([150 x i8], [150 x i8]* @.str, i64 0, i64 0), i32 284)
br label %10
10: ; preds = %2, %8
ret i32 %4
}
/* Variables and functions */
unsigned long long reverse(unsigned long long);
int is_palindrome(unsigned long long number) {
  return number == reverse(number);
}


x86 assembly (clang, -O0):
<is_palindrome>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <reverse@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_palindrome>:
push   %rbx
mov    %rdi,%rbx
call   1030 <reverse@plt>
xor    %ecx,%ecx
cmp    %rbx,%rax
sete   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_palindrome(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i64, i64* %2
%5 = call i64 @reverse(i64 %4)
%6 = icmp eq i64 %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @is_palindrome(i64 %0) {
%2 = tail call i64 @reverse(i64 %0)
%3 = icmp eq i64 %2, %0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *strdup(__const char *__restrict __src) {
  char *__dest;
  __dest = (char *)malloc(strlen(__src) + 1);
  if (__dest == NULL)
    return NULL;
  strcpy(__dest, __src);
  return __dest;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    116d <strdup+0x3d>
movq   $0x0,-0x8(%rbp)
jmp    1182 <strdup+0x52>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     115a <strdup+0x2a>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
jmp    115c <strdup+0x2c>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @strdup(i8* noalias %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @strlen(i8* %5)
%7 = add nsw i64 %6, 1
%8 = call i64 @malloc(i64 %7)
%9 = inttoptr i64 %8 to i8*
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %13
12: ; preds = %1
store i8* null, i8** %2
br label %18
13: ; preds = %1
%14 = load i8*, i8** %4
%15 = load i8*, i8** %3
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = load i8*, i8** %4
store i8* %17, i8** %2
br label %18
18: ; preds = %13, %12
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
define i8* @strdup(i8* noalias %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = tail call i32 @strcpy(i8* %5, i8* %0)
br label %9
9: ; preds = %1, %7
%10 = phi i8* [ %5, %7 ], [ null, %1 ]
ret i8* %10
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, char ***);
void m_malloc(char **s) {
  printf("s-%p\n", &s);
  *s = (char *)malloc(1000);
}


x86 assembly (clang, -O0):
<m_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <printf@plt>
mov    $0x3e8,%edi
call   1040 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_malloc>:
push   %rax
mov    %rdi,(%rsp)
lea    0xed4(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
mov    $0x3e8,%edi
call   1040 <malloc@plt>
mov    (%rsp),%rcx
mov    %rax,(%rcx)
pop    %rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"s-%p\0A\00"
define void @m_malloc(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8*** %2)
%4 = call i64 @malloc(i32 1000)
%5 = inttoptr i64 %4 to i8*
%6 = load i8**, i8*** %2
store i8* %5, i8** %6
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"s-%p\0A\00"
define void @m_malloc(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8*** %2)
%4 = call i64 @malloc(i32 1000)
%5 = inttoptr i64 %4 to i8*
%6 = load i8**, i8*** %2
store i8* %5, i8** %6
ret void
}
/* Variables and functions */
int getch();
int getCommand() {
  if (getch() == 32) {
    return 32;
  }
  return 0;
}


x86 assembly (clang, -O0):
<getCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getch@plt>
cmp    $0x20,%eax
jne    1134 <getCommand+0x24>
movl   $0x20,-0x4(%rbp)
jmp    113b <getCommand+0x2b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCommand>:
push   %rax
xor    %eax,%eax
call   1030 <getch@plt>
xor    %ecx,%ecx
cmp    $0x20,%eax
sete   %cl
shl    $0x5,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @getCommand() {
%1 = alloca i32
%2 = call i32 (...) @getch()
%3 = icmp eq i32 %2, 32
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 32, i32* %1
br label %6
5: ; preds = %0
store i32 0, i32* %1
br label %6
6: ; preds = %5, %4
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
define i32 @getCommand() {
%1 = tail call i32 (...) @getch()
%2 = icmp eq i32 %1, 32
%3 = select i1 %2, i32 32, i32 0
ret i32 %3
}
double d(double x) { return x - ((x * x * x * x * x - 7) / 12); }


x86 assembly (clang, -O0):
<d>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xed5(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  0xec1(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<d>:
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0xee4(%rip),%xmm1
divsd  0xee4(%rip),%xmm1
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @d(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = load double, double* %2
%6 = fmul double %4, %5
%7 = load double, double* %2
%8 = fmul double %6, %7
%9 = load double, double* %2
%10 = fmul double %8, %9
%11 = load double, double* %2
%12 = call double @llvm.fmuladd.f64(double %10, double %11, double -7.000000e+00)
%13 = fdiv double %12, 1.200000e+01
%14 = fsub double %3, %13
ret double %14
}

LLVM IR (-O2):
define double @d(double %0) {
%2 = fmul double %0, %0
%3 = fmul double %2, %0
%4 = fmul double %3, %0
%5 = tail call double @llvm.fmuladd.f64(double %4, double %0, double -7.000000e+00)
%6 = fdiv double %5, 1.200000e+01
%7 = fsub double %0, %6
ret double %7
}
int tas(long *x) {
  int v;
  __asm__("movl   $1, %%eax\n\t"
          "xchgl  %%eax,(%%rcx)"
          : "=a"(v)
          : "c"(x));
  switch (v) {
  case 0:
  case 1:
    return v;
  default:
    print("canlock: corrupted 0x%lux\n", v);
    return 1;
  }
}


x86 assembly (clang, -O0):
<tas>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    $0x1,%eax
xchg   %eax,(%rcx)
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
ja     1146 <tas+0x36>
jmp    113b <tas+0x2b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115e <tas+0x4e>
mov    -0x14(%rbp),%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <print@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tas>:
mov    %rdi,%rcx
mov    $0x1,%eax
xchg   %eax,(%rcx)
cmp    $0x2,%eax
jb     1139 <tas+0x29>
push   %rax
lea    0xed9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <print@plt>
mov    $0x1,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"canlock: corrupted 0x%lux\0A\00"
define i32 @tas(i64* %0) {
%2 = alloca i32
%3 = alloca i64*
%4 = alloca i32
store i64* %0, i64** %3
%5 = load i64*, i64** %3
%6 = call i32 asm "movl $$1, %eax\0A\09xchgl %eax,(%rcx)", "={ax},{cx},~{dirflag},~{fpsr},~{flags}"(i64* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
switch i32 %7, label %10 [
i32 0, label %8
i32 1, label %8
]
8: ; preds = %1, %1
%9 = load i32, i32* %4
store i32 %9, i32* %2
br label %13
10: ; preds = %1
%11 = load i32, i32* %4
%12 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @print to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 1, i32* %2
br label %13
13: ; preds = %10, %8
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [27 x i8] c"canlock: corrupted 0x%lux\0A\00"
define i32 @tas(i64* %0) {
%2 = tail call i32 asm "movl $$1, %eax\0A\09xchgl %eax,(%rcx)", "={ax},{cx},~{dirflag},~{fpsr},~{flags}"(i64* %0)
%3 = icmp ult i32 %2, 2
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @print to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ %2, %1 ]
ret i32 %7
}
int numlen(int nbr) {
  int i = 0;
  while (nbr != 0) {
    nbr = nbr / 10;
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<numlen>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1134 <numlen+0x34>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <numlen+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<numlen>:
xor    %eax,%eax
test   %edi,%edi
je     1132 <numlen+0x32>
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
add    $0x1,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <numlen+0x10>
ret

LLVM IR (-O0):
define i32 @numlen(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sdiv i32 %8, 10
store i32 %9, i32* %2
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %4
12: ; preds = %4
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @numlen(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = sdiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = add i32 %5, 9
%9 = icmp ult i32 %8, 19
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
int cmp_int(void *a, void *b) { return (*(int *)a) - (*(int *)b); }


x86 assembly (clang, -O0):
<cmp_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_int>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @cmp_int(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @cmp_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ cd(char const *);
void cd_command(const char *path) { cd(path); }


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

x86 assembly (clang, -O2):
<cd_command>:
jmp    1030 <cd@plt>

LLVM IR (-O0):
define void @cd_command(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @cd(i8* %3)
ret void
}

LLVM IR (-O2):
define void @cd_command(i8* %0) {
%2 = tail call i32 @cd(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int main() {
  char *s = "hello world";
  printf("length of %s is %zu\n", s, strlen(s));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0xed5(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"hello world\00"
@.str.1 = [21 x i8] c"length of %s is %zu\0A\00"
define i32 @main() {
%1 = alloca i8*
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @strlen(i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"hello world\00"
@.str.1 = [21 x i8] c"length of %s is %zu\0A\00"
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ op_write1(int);
void op_enc_ret_nc(void) { op_write1(0xd0); }


x86 assembly (clang, -O0):
<op_enc_ret_nc>:
push   %rbp
mov    %rsp,%rbp
mov    $0xd0,%edi
call   1030 <op_write1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_enc_ret_nc>:
mov    $0xd0,%edi
jmp    1030 <op_write1@plt>

LLVM IR (-O0):
define void @op_enc_ret_nc() {
%1 = call i32 @op_write1(i32 208)
ret void
}

LLVM IR (-O2):
define void @op_enc_ret_nc() {
%1 = tail call i32 @op_write1(i32 208)
ret void
}
int main() {
  int a, b;
  if (a > 32 || a < 16) {
    b = 1;
  } else {
    b = 2;
  }
  return b;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x20,-0x8(%rbp)
jg     111f <main+0x1f>
cmpl   $0x10,-0x8(%rbp)
jge    112b <main+0x2b>
movl   $0x1,-0xc(%rbp)
jmp    1132 <main+0x32>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 32
br i1 %5, label %9, label %6
6: ; preds = %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 16
br i1 %8, label %9, label %10
9: ; preds = %6, %0
store i32 1, i32* %3
br label %11
10: ; preds = %6
store i32 2, i32* %3
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @main() {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ yylex();
int main(void) {
  yylex();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <yylex@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <yylex@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @yylex()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @yylex()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void tdbfree(void *ptr) { free((char *)ptr); }


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

x86 assembly (clang, -O2):
<tdbfree>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @tdbfree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @free(i8* %3)
ret void
}

LLVM IR (-O2):
define void @tdbfree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Type definitions */
struct blob_attr {
  int dummy;
};

/* Variables and functions */
int blob_raw_len(struct blob_attr const *);
unsigned int blob_pad_len(const struct blob_attr *attr) {
  int len = blob_raw_len(attr);
  len = (len + 4 - 1) & ~(4 - 1);
  return len;
}


x86 assembly (clang, -O0):
<blob_pad_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <blob_raw_len@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x4,%eax
sub    $0x1,%eax
and    $0xfffffffc,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<blob_pad_len>:
push   %rax
call   1030 <blob_raw_len@plt>
add    $0x3,%eax
and    $0xfffffffc,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.blob_attr = type { i32 }
define i32 @blob_pad_len(%struct.blob_attr* %0) {
%2 = alloca %struct.blob_attr*
%3 = alloca i32
store %struct.blob_attr* %0, %struct.blob_attr** %2
%4 = load %struct.blob_attr*, %struct.blob_attr** %2
%5 = call i32 @blob_raw_len(%struct.blob_attr* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 4
%8 = sub nsw i32 %7, 1
%9 = and i32 %8, -4
store i32 %9, i32* %3
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
%struct.blob_attr = type { i32 }
define i32 @blob_pad_len(%struct.blob_attr* %0) {
%2 = tail call i32 @blob_raw_len(%struct.blob_attr* %0)
%3 = add nsw i32 %2, 3
%4 = and i32 %3, -4
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ func_two();
int /*<<< orphan*/ printf(char *);
void func_one(void) {
  printf("func_one() begins\n");
  func_two();
  printf("func_one() returns\n");
}


x86 assembly (clang, -O0):
<func_one>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <func_two@plt>
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<func_one>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <func_two@plt>
lea    0xed7(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"func_one() begins\0A\00"
@.str.1 = [20 x i8] c"func_one() returns\0A\00"
define void @func_one() {
%1 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @func_two()
%3 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [18 x i8] c"func_one() begins\00"
@str.2 = [19 x i8] c"func_one() returns\00"
define void @func_one() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @func_two()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int8_t implicitConversion(uint32_t argc) { return argc; }


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

x86 assembly (clang, -O2):
<implicitConversion>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @implicitConversion(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ memmove(char *, char *, int);
int main(int argc, char **buffer) {
  char buf[10];
  memmove(buf, buf + 4, 4);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x1a(%rbp),%rdi
lea    -0x1a(%rbp),%rsi
add    $0x4,%rsi
mov    $0x4,%edx
call   1030 <memmove@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0x12(%rsp),%rsi
lea    0xe(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memmove@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 0
%9 = getelementptr inbounds i8, i8* %8, i64 4
%10 = call i32 @memmove(i8* %7, i8* %9, i32 4)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 4
%6 = call i32 @memmove(i8* %4, i8* %5, i32 4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Msp430GpioC__12__GeneralIO__makeInput();
void SensirionSht11LogicP__0__DATA__makeInput(void) {
  Msp430GpioC__12__GeneralIO__makeInput();
}


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

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

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

LLVM IR (-O2):
define void @SensirionSht11LogicP__0__DATA__makeInput() {
%1 = tail call i32 (...) @Msp430GpioC__12__GeneralIO__makeInput()
ret void
}
/* Variables and functions */
void *malloc(size_t size) {
  (void)size;
  return (void *)0xdeadbeef;
}


x86 assembly (clang, -O0):
<malloc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0xdeadbeef,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<malloc>:
mov    $0xdeadbeef,%eax
ret

LLVM IR (-O0):
define i8* @malloc(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
ret i8* inttoptr (i64 3735928559 to i8*)
}

LLVM IR (-O2):
define i8* @malloc(i64 %0) {
ret i8* inttoptr (i64 3735928559 to i8*)
}
/* Variables and functions */
int /*<<< orphan*/ compilerAssert();
void chpl_decRefCountsForDomainsInArrayEltTypes3(void) {
  compilerAssert();
  return;
}


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

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

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

LLVM IR (-O2):
define void @chpl_decRefCountsForDomainsInArrayEltTypes3() {
%1 = tail call i32 (...) @compilerAssert()
ret void
}
void blankVFSMfinish(void *info, int seqid) { return; }


x86 assembly (clang, -O0):
<blankVFSMfinish>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @blankVFSMfinish(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @blankVFSMfinish(i8* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int strcmp(char const *, char const *);
int conf_default_cmp(const char *s1, const char *s2) { return strcmp(s1, s2); }


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

x86 assembly (clang, -O2):
<conf_default_cmp>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @conf_default_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ play(int /*<<< orphan*/, int /*<<< orphan*/);
void reset(void) {
  play(0, 0);
  exit(0);
}


x86 assembly (clang, -O0):
<reset>:
push   %rbp
mov    %rsp,%rbp
xor    %esi,%esi
mov    %esi,%edi
call   1030 <play@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<reset>:
push   %rax
xor    %edi,%edi
xor    %esi,%esi
call   1030 <play@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @reset() {
%1 = call i32 @play(i32 0, i32 0)
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @reset() {
%1 = tail call i32 @play(i32 0, i32 0)
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void a(int x) {
  static int c;
  if (c) {
    abort();
  }
  c = 1;
  ;
  if (x != sizeof(int) * 2 * 3)
    abort();
}


x86 assembly (clang, -O0):
<a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,0x2f0a(%rip)
je     112f <a+0x1f>
mov    $0x0,%al
call   1030 <abort@plt>
movl   $0x1,0x2ef3(%rip)
movslq -0x4(%rbp),%rax
cmp    $0x18,%rax
je     114e <a+0x3e>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<a>:
push   %rax
cmpb   $0x1,0x2f14(%rip)
je     1128 <a+0x18>
movb   $0x1,0x2f0b(%rip)
cmp    $0x18,%edi
jne    1128 <a+0x18>
pop    %rax
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@a.c = internal global i32 0
define void @a(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* @a.c
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
store i32 1, i32* @a.c
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = icmp ne i64 %9, 24
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %7
ret void
}

LLVM IR (-O2):
@a.c = internal unnamed_addr global i1 false
define void @a(i32 %0) {
%2 = load i1, i1* @a.c
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
store i1 true, i1* @a.c
%6 = icmp eq i32 %0, 24
br i1 %6, label %9, label %7
7: ; preds = %5
%8 = tail call i32 (...) @abort()
unreachable
9: ; preds = %5
ret void
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
void pack_add_u16(uint8_t *buffer, int byteNr, uint16_t value) {
  *((uint8_t *)(buffer + byteNr + 1)) = (uint8_t)(value >> 8);
  *((uint8_t *)(buffer + byteNr)) = (uint8_t)(value);
}


x86 assembly (clang, -O0):
<pack_add_u16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sar    $0x8,%eax
movslq %eax,%rdx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,0x8(%rax,%rcx,8)
movslq -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pack_add_u16>:
movslq %edx,%rax
sar    $0x8,%edx
movslq %edx,%rcx
movslq %esi,%rdx
mov    %rcx,0x8(%rdi,%rdx,8)
mov    %rax,(%rdi,%rdx,8)
ret

LLVM IR (-O0):
define void @pack_add_u16(i64* %0, i32 %1, i32 %2) {
%4 = alloca i64*
%5 = alloca i32
%6 = alloca i32
store i64* %0, i64** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = ashr i32 %7, 8
%9 = sext i32 %8 to i64
%10 = load i64*, i64** %4
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i64, i64* %10, i64 %12
%14 = getelementptr inbounds i64, i64* %13, i64 1
store i64 %9, i64* %14
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = load i64*, i64** %4
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i64, i64* %17, i64 %19
store i64 %16, i64* %20
ret void
}

LLVM IR (-O2):
define void @pack_add_u16(i64* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = ashr i32 %2, 8
%5 = sext i32 %4 to i64
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i64, i64* %0, i64 %6
%8 = getelementptr inbounds i64, i64* %7, i64 1
store i64 %5, i64* %8
%9 = sext i32 %2 to i64
store i64 %9, i64* %7
ret void
}
void *GetHunkMemory(unsigned long size) {
  void *ptr;
  unsigned long int *memid;
  ptr = malloc(size + sizeof(unsigned long int));
  if (!ptr) {
    return ((void *)0);
  }
  memid = (unsigned long int *)ptr;
  *memid = 0x87654321l;
  return (unsigned long int *)((char *)ptr + sizeof(unsigned long int));
}


x86 assembly (clang, -O0):
<GetHunkMemory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x8,%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1145 <GetHunkMemory+0x35>
movq   $0x0,-0x8(%rbp)
jmp    1165 <GetHunkMemory+0x55>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    $0x87654321,%ecx
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetHunkMemory>:
push   %rax
add    $0x8,%rdi
call   1030 <malloc@plt>
test   %rax,%rax
je     112d <GetHunkMemory+0x1d>
mov    $0x87654321,%ecx
mov    %rcx,(%rax)
add    $0x8,%rax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define noalias i8* @GetHunkMemory(i64 %0) {
%2 = add i64 %0, 8
%3 = tail call i8* @malloc(i64 %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = bitcast i8* %3 to i64*
store i64 2271560481, i64* %6
%7 = getelementptr inbounds i8, i8* %3, i64 8
br label %8
8: ; preds = %1, %5
%9 = phi i8* [ %7, %5 ], [ null, %1 ]
ret i8* %9
}
int main() {
  int i;
  int res = 12;
  goto L1;
  i = 0;
  do {
    if (i > 100) {
    L1:
      res = 0;
      goto L2;
    }
  } while (i < 100);
L2:
  return res;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0xc,-0xc(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 12, i32* %3
br label %9
4: ; No predecessors!
br label %5
5: ; preds = %11, %4
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 100
br i1 %7, label %8, label %10
8: ; preds = %5
br label %9
9: ; preds = %8, %0
store i32 0, i32* %3
br label %15
10: ; preds = %5
br label %11
11: ; preds = %10
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 100
br i1 %13, label %5, label %14
14: ; preds = %11
br label %15
15: ; preds = %14, %9
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
void Enc(char *, char *, char);
void Dec(char *cipher, char *plain, char key) {
  return Enc(cipher, plain, key);
}


x86 assembly (clang, -O0):
<Dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movsbl -0x11(%rbp),%edx
call   1030 <Enc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Dec>:
jmp    1030 <Enc@plt>

LLVM IR (-O0):
define void @Dec(i8* %0, i8* %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8 %2, i8* %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = load i8, i8* %6
ret void
}

LLVM IR (-O2):
define void @Dec(i8* %0, i8* %1, i8 signext %2) {
tail call void @Enc(i8* %0, i8* %1, i8 signext %2)
ret void
}
int compare2(const void *arg1, const void *arg2) {
  return *((int *)arg1) - *((int *)arg2);
}


x86 assembly (clang, -O0):
<compare2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare2>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

LLVM IR (-O0):
define i32 @compare2(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @compare2(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
int toInt(char c) {
  int yes = -1;
  char numChar[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
  int numInt[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
  for (int i = 0; i <= 10; ++i) {
    if (c == numChar[i]) {
      yes = numInt[i];
      break;
    }
  }
  return yes;
}


x86 assembly (clang, -O0):
<toInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xed1(%rip),%ax
mov    %ax,-0xa(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeca(%rip),%rsi
mov    $0x28,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x44(%rbp)
cmpl   $0xa,-0x44(%rbp)
jg     1199 <toInt+0x89>
movsbl -0x1(%rbp),%eax
movslq -0x44(%rbp),%rcx
movsbl -0x12(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    1186 <toInt+0x76>
movslq -0x44(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
mov    %eax,-0x8(%rbp)
jmp    1199 <toInt+0x89>
jmp    118b <toInt+0x7b>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1157 <toInt+0x47>
mov    -0x8(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toInt>:
add    $0xd0,%dil
mov    $0xffffffff,%eax
cmp    $0x9,%dil
ja     111d <toInt+0x1d>
movzbl %dil,%eax
lea    0xee6(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
@__const.toInt.numChar = [10 x i8] c"0123456789"
@__const.toInt.numInt = [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9]
define i32 @toInt(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
%4 = alloca [10 x i8]
%5 = alloca [10 x i32]
%6 = alloca i32
store i8 %0, i8* %2
store i32 -1, i32* %3
%7 = bitcast [10 x i8]* %4 to i8*
%8 = bitcast [10 x i32]* %5 to i8*
store i32 0, i32* %6
br label %9
9: ; preds = %27, %1
%10 = load i32, i32* %6
%11 = icmp sle i32 %10, 10
br i1 %11, label %12, label %30
12: ; preds = %9
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %14, %19
br i1 %20, label %21, label %26
21: ; preds = %12
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10 x i32], [10 x i32]* %5, i64 0, i64 %23
%25 = load i32, i32* %24
store i32 %25, i32* %3
br label %30
26: ; preds = %12
br label %27
27: ; preds = %26
%28 = load i32, i32* %6
%29 = add nsw i32 %28, 1
store i32 %29, i32* %6
br label %9
30: ; preds = %21, %9
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@__const.toInt.numInt = [10 x i32] [i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9]
define i32 @toInt(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = zext i8 %2 to i64
%6 = getelementptr inbounds [10 x i32], [10 x i32]* @__const.toInt.numInt, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ -1, %1 ]
ret i32 %9
}
void generate_segv(int val) {
  int *p = 0;
  printf("EIP of segfault: 0x%x (only accurate with if compiled with -O)\n",
         &&segfault);
  val++;
segfault:
  *p = val;
}


x86 assembly (clang, -O0):
<generate_segv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    0xed6(%rip),%rdi
xor    %eax,%eax
lea    0xe(%rip),%rsi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_segv>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>

LLVM IR (-O0):
@.str = [64 x i8] c"EIP of segfault: 0x%x (only accurate with if compiled with -O)\0A\00"
define void @generate_segv(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
store i32* null, i32** %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* blockaddress(@generate_segv, %7))
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
store i32 %6, i32* %2
br label %7
7: ; preds = %1, %10
%8 = load i32, i32* %2
%9 = load i32*, i32** %3
store i32 %8, i32* %9
ret void
10: ; No predecessors!
indirectbr i8* undef, [label %7]
}

LLVM IR (-O2):
@.str = [64 x i8] c"EIP of segfault: 0x%x (only accurate with if compiled with -O)\0A\00"
define void @generate_segv(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* inttoptr (i32 1 to i8*))
unreachable
}
void XkbGetAutoRepeatRate() {}


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

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

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

LLVM IR (-O2):
define void @XkbGetAutoRepeatRate() {
ret void
}
void print_binary_tree_pre_order(struct bstNode *root) {}


x86 assembly (clang, -O0):
<print_binary_tree_pre_order>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.bstNode = type opaque
define void @print_binary_tree_pre_order(%struct.bstNode* %0) {
%2 = alloca %struct.bstNode*
store %struct.bstNode* %0, %struct.bstNode** %2
ret void
}

LLVM IR (-O2):
%struct.bstNode = type opaque
define void @print_binary_tree_pre_order(%struct.bstNode* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int num_hetero_threads_sanity_check(int num_threads) {
  if (num_threads > (6)) {
    printf("HETEROGENEOUS SANITY CHECK - There are only %d heterogeneous "
           "processors!\n",
           (6));
    printf("  but the program is trying to simultaneously create %d hetero. "
           "threads!\n",
           num_threads);
    return -999;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<num_hetero_threads_sanity_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x6,-0x8(%rbp)
jle    1151 <num_hetero_threads_sanity_check+0x41>
lea    0xed4(%rip),%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xf0a(%rip),%rdi
call   1030 <printf@plt>
movl   $0xfffffc19,-0x4(%rbp)
jmp    1158 <num_hetero_threads_sanity_check+0x48>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<num_hetero_threads_sanity_check>:
xor    %eax,%eax
cmp    $0x7,%edi
jl     113f <num_hetero_threads_sanity_check+0x2f>
push   %rbx
mov    %edi,%ebx
lea    0xedf(%rip),%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
lea    0xf18(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    $0xfffffc19,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [74 x i8] c"HETEROGENEOUS SANITY CHECK - There are only %d heterogeneous processors!\0A\00"
@.str.1 = [74 x i8] c" but the program is trying to simultaneously create %d hetero. threads!\0A\00"
define i32 @num_hetero_threads_sanity_check(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sgt i32 %4, 6
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i32 6)
%8 = load i32, i32* %3
%9 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0), i32 %8)
store i32 -999, i32* %2
br label %11
10: ; preds = %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %6
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
@.str = [74 x i8] c"HETEROGENEOUS SANITY CHECK - There are only %d heterogeneous processors!\0A\00"
@.str.1 = [74 x i8] c" but the program is trying to simultaneously create %d hetero. threads!\0A\00"
define i32 @num_hetero_threads_sanity_check(i32 %0) {
%2 = icmp sgt i32 %0, 6
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i32 6)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ -999, %3 ], [ 0, %1 ]
ret i32 %7
}
const char *pcre_version(void) {
  return "4"
         "."
         "3"
         " "
         "21-May-2003";
}


x86 assembly (clang, -O0):
<pcre_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pcre_version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [16 x i8] c"4.3 21-May-2003\00"
define i8* @pcre_version() {
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [16 x i8] c"4.3 21-May-2003\00"
define i8* @pcre_version() {
ret i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0)
}
void CAN1_TX_IRQHandler() {}


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

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

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

LLVM IR (-O2):
define void @CAN1_TX_IRQHandler() {
ret void
}
/* Variables and functions */
unsigned long invertbits(unsigned long bits, size_t at, size_t size) {
  unsigned long mask = ~(~0UL << size) << (at + 1 - size);
  unsigned long inverted = ~bits & mask;
  bits &= ~mask;
  return bits | inverted;
}


x86 assembly (clang, -O0):
<invertbits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    $0xffffffffffffffff,%rax
shl    %cl,%rax
xor    $0xffffffffffffffff,%rax
mov    -0x10(%rbp),%rcx
add    $0x1,%rcx
sub    -0x18(%rbp),%rcx
shl    %cl,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rax
xor    $0xffffffffffffffff,%rax
and    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
xor    $0xffffffffffffffff,%rax
and    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
or     -0x28(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<invertbits>:
mov    %rdx,%rcx
mov    $0xffffffffffffffff,%rax
shl    %cl,%rax
not    %rax
sub    %ecx,%esi
lea    0x1(%rsi),%ecx
shl    %cl,%rax
xor    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @invertbits(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%9 = load i64, i64* %6
%10 = shl i64 -1, %9
%11 = xor i64 %10, -1
%12 = load i64, i64* %5
%13 = add i64 %12, 1
%14 = load i64, i64* %6
%15 = sub i64 %13, %14
%16 = shl i64 %11, %15
store i64 %16, i64* %7
%17 = load i64, i64* %4
%18 = xor i64 %17, -1
%19 = load i64, i64* %7
%20 = and i64 %18, %19
store i64 %20, i64* %8
%21 = load i64, i64* %7
%22 = xor i64 %21, -1
%23 = load i64, i64* %4
%24 = and i64 %23, %22
store i64 %24, i64* %4
%25 = load i64, i64* %4
%26 = load i64, i64* %8
%27 = or i64 %25, %26
ret i64 %27
}

LLVM IR (-O2):
define i64 @invertbits(i64 %0, i64 %1, i64 %2) {
%4 = shl nsw i64 -1, %2
%5 = xor i64 %4, -1
%6 = add i64 %1, 1
%7 = sub i64 %6, %2
%8 = shl i64 %5, %7
%9 = xor i64 %8, %0
ret i64 %9
}