xunge/DecIR huggingface dataset:
/* Variables and functions */
unsigned long getnum(char const *);
int /*<<< orphan*/ mkrandtree_sub(unsigned int, int /*<<< orphan*/,
                                  unsigned int *, unsigned int);
int random();
int /*<<< orphan*/ srandom(unsigned long);
void wl_mkrandtree(const char *seed) {
  unsigned testcode = 103;
  unsigned numthings, count;
  unsigned long seednum = getnum(seed);
  srandom(seednum);
  numthings = random() % 44 + 12;
  count = 0;
  mkrandtree_sub(testcode, 0, &count, numthings);
}


x86 assembly (clang, -O0):
<wl_mkrandtree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x67,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getnum@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <srandom@plt>
mov    $0x0,%al
call   1060 <random@plt>
mov    $0x2c,%ecx
cltd
idiv   %ecx
add    $0xc,%edx
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%ecx
xor    %esi,%esi
lea    -0x14(%rbp),%rdx
call   1050 <mkrandtree_sub@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wl_mkrandtree>:
push   %rax
call   1030 <getnum@plt>
mov    %rax,%rdi
call   1040 <srandom@plt>
xor    %eax,%eax
call   1060 <random@plt>
cltq
imul   $0x2e8ba2e9,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
imul   $0x2c,%ecx,%ecx
neg    %ecx
add    %eax,%ecx
add    $0xc,%ecx
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdx
mov    $0x67,%edi
xor    %esi,%esi
call   1050 <mkrandtree_sub@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @wl_mkrandtree(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
store i8* %0, i8** %2
store i32 103, i32* %3
%7 = load i8*, i8** %2
%8 = call i64 @getnum(i8* %7)
store i64 %8, i64* %6
%9 = load i64, i64* %6
%10 = call i32 @srandom(i64 %9)
%11 = call i32 (...) @random()
%12 = srem i32 %11, 44
%13 = add nsw i32 %12, 12
store i32 %13, i32* %4
store i32 0, i32* %5
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i32 @mkrandtree_sub(i32 %14, i32 0, i32* %5, i32 %15)
ret void
}

LLVM IR (-O2):
define void @wl_mkrandtree(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i64 @getnum(i8* %0)
%5 = tail call i32 @srandom(i64 %4)
%6 = tail call i32 (...) @random()
%7 = srem i32 %6, 44
%8 = add nsw i32 %7, 12
store i32 0, i32* %2
%9 = call i32 @mkrandtree_sub(i32 103, i32 0, i32* %2, i32 %8)
ret void
}
int int_cmp_asc(const void *a, const void *b) {
  const int *ia = (const int *)a;
  const int *ib = (const int *)b;
  return *ia - *ib;
}


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

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

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

LLVM IR (-O2):
define i32 @int_cmp_asc(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %5, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
void newFunction_(char str[]) {
  sprintf(str, "Hello");
  strcat(str, "World");
}


x86 assembly (clang, -O0):
<newFunction_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xebf(%rip),%rsi
call   1030 <strcat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<newFunction_>:
movw   $0x6f,0x4(%rdi)
movl   $0x6c6c6548,(%rdi)
lea    0xee3(%rip),%rsi
jmp    1030 <strcat@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"Hello\00"
@.str.1 = [6 x i8] c"World\00"
define void @newFunction_(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"Hello\00"
@.str.1 = [6 x i8] c"World\00"
define void @newFunction_(i8* %0) {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(6) %0, i8* align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 6, i1 false)
%2 = tail call i32 @strcat(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int test04(int a, int b, int c, int d) {
  int x = a != b;
  int y = c != d;
  return x == y;
}


x86 assembly (clang, -O0):
<test04>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test04>:
cmp    %esi,%edi
sete   %al
cmp    %ecx,%edx
setne  %cl
xor    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @test04(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = icmp ne i32 %11, %12
%14 = zext i1 %13 to i32
store i32 %14, i32* %9
%15 = load i32, i32* %7
%16 = load i32, i32* %8
%17 = icmp ne i32 %15, %16
%18 = zext i1 %17 to i32
store i32 %18, i32* %10
%19 = load i32, i32* %9
%20 = load i32, i32* %10
%21 = icmp eq i32 %19, %20
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @test04(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp eq i32 %0, %1
%6 = icmp ne i32 %2, %3
%7 = xor i1 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int mockup_5(void *user_data) {
  if (user_data != NULL) {
    *((int *)user_data) = 5;
  }
  return 5;
}


x86 assembly (clang, -O0):
<mockup_5>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     111d <mockup_5+0x1d>
mov    -0x8(%rbp),%rax
movl   $0x5,(%rax)
mov    $0x5,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mockup_5>:
test   %rdi,%rdi
je     110b <mockup_5+0xb>
movl   $0x5,(%rdi)
mov    $0x5,%eax
ret

LLVM IR (-O0):
define i32 @mockup_5(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i8*, i8** %2
%7 = bitcast i8* %6 to i32*
store i32 5, i32* %7
br label %8
8: ; preds = %5, %1
ret i32 5
}

LLVM IR (-O2):
define i32 @mockup_5(i8* writeonly %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = bitcast i8* %0 to i32*
store i32 5, i32* %4
br label %5
5: ; preds = %3, %1
ret i32 5
}
void free_2d_double(double **p) {
  free(p[0]);
  free(p);
}


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

x86 assembly (clang, -O2):
<free_2d_double>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @free_2d_double(double** %0) {
%2 = alloca double**
store double** %0, double*** %2
%3 = load double**, double*** %2
%4 = getelementptr inbounds double*, double** %3, i64 0
%5 = load double*, double** %4
%6 = bitcast double* %5 to i8*
%7 = load double**, double*** %2
%8 = bitcast double** %7 to i8*
ret void
}

LLVM IR (-O2):
define void @free_2d_double(double** nocapture %0) {
%2 = bitcast double** %0 to i8**
%3 = load i8*, i8** %2
tail call void @free(i8* %3)
%4 = bitcast double** %0 to i8*
tail call void @free(i8* %4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int read(int, char *, int);
void flush(int fd) {
  int res;
  char buf[32];
  while ((res = read(fd, buf, sizeof(buf))) > 0) {
    if (res < 0)
      perror("flush/read");
  }
}


x86 assembly (clang, -O0):
<flush>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x20,%edx
call   1030 <read@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1163 <flush+0x43>
cmpl   $0x0,-0x8(%rbp)
jge    115e <flush+0x3e>
lea    0xea7(%rip),%rdi
call   1040 <perror@plt>
jmp    112b <flush+0xb>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flush>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %edi,%ebx
mov    %rsp,%r14
nopl   0x0(%rax)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x20,%edx
call   1030 <read@plt>
test   %eax,%eax
jg     1120 <flush+0x10>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c"flush/read\00"
define void @flush(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [32 x i8]
store i32 %0, i32* %2
br label %5
5: ; preds = %15, %1
%6 = load i32, i32* %2
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%8 = call i32 @read(i32 %6, i8* %7, i32 32)
store i32 %8, i32* %3
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %5
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
br label %5
16: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @flush(i32 %0) {
%2 = alloca [32 x i8]
%3 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
br label %4
4: ; preds = %4, %1
%5 = call i32 @read(i32 %0, i8* %3, i32 32)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %4, label %7
7: ; preds = %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ calculaDomingoCarnaval(int, int *, int *);
int ehDomingoDeCarnaval(int ano, int mes, int dia) {
  int diaCarnaval, mesCarnaval, anoCarnaval = ano;
  calculaDomingoCarnaval(anoCarnaval, &mesCarnaval, &diaCarnaval);
  return (dia == diaCarnaval && mes == mesCarnaval && ano == anoCarnaval);
}


x86 assembly (clang, -O0):
<ehDomingoDeCarnaval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x14(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1030 <calculaDomingoCarnaval@plt>
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
cmp    -0x10(%rbp),%ecx
mov    %al,-0x19(%rbp)
jne    1165 <ehDomingoDeCarnaval+0x55>
mov    -0x8(%rbp),%ecx
xor    %eax,%eax
cmp    -0x14(%rbp),%ecx
mov    %al,-0x19(%rbp)
jne    1165 <ehDomingoDeCarnaval+0x55>
mov    -0x4(%rbp),%eax
cmp    -0x18(%rbp),%eax
sete   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ehDomingoDeCarnaval>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
call   1030 <calculaDomingoCarnaval@plt>
xor    0x4(%rsp),%ebx
xor    (%rsp),%ebp
xor    %eax,%eax
or     %ebx,%ebp
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ehDomingoDeCarnaval(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %4
store i32 %10, i32* %9
%11 = load i32, i32* %9
%12 = call i32 @calculaDomingoCarnaval(i32 %11, i32* %8, i32* %7)
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %24
16: ; preds = %3
%17 = load i32, i32* %5
%18 = load i32, i32* %8
%19 = icmp eq i32 %17, %18
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32, i32* %4
%22 = load i32, i32* %9
%23 = icmp eq i32 %21, %22
br label %24
24: ; preds = %20, %16, %3
%25 = phi i1 [ false, %16 ], [ false, %3 ], [ %23, %20 ]
%26 = zext i1 %25 to i32
ret i32 %26
}

LLVM IR (-O2):
define i32 @ehDomingoDeCarnaval(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %4 to i8*
%7 = bitcast i32* %5 to i8*
%8 = call i32 @calculaDomingoCarnaval(i32 %0, i32* %5, i32* %4)
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, %2
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, %1
%13 = select i1 %10, i1 %12, i1 false
%14 = zext i1 %13 to i32
ret i32 %14
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ gptp(char *, int);
void g_pthread_mutex_t() { gptp("pthread_mutex_t", sizeof(pthread_mutex_t)); }


x86 assembly (clang, -O0):
<g_pthread_mutex_t>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x4,%esi
call   1030 <gptp@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_pthread_mutex_t>:
lea    0xee9(%rip),%rdi
mov    $0x4,%esi
jmp    1030 <gptp@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"pthread_mutex_t\00"
define void @g_pthread_mutex_t() {
%1 = call i32 @gptp(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"pthread_mutex_t\00"
define void @g_pthread_mutex_t() {
%1 = tail call i32 @gptp(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}
void OBJ_txt2nid(void) {}


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

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

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

LLVM IR (-O2):
define void @OBJ_txt2nid() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int *, int /*<<< orphan*/ const *, int);
uint32_t get32bit(const uint8_t **ptr) {
  uint32_t t32;
  memcpy(&t32, *ptr, 4);
  (*ptr) += 4;
  return ((((t32) << 24) & 0xFF000000) | (((t32) << 8) & 0xFF0000) |
          (((t32) >> 8) & 0xFF00) | (((t32) >> 24) & 0xFF));
}


x86 assembly (clang, -O0):
<get32bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
lea    -0xc(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x10,%rcx
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
shl    $0x18,%eax
and    $0xff000000,%eax
mov    -0xc(%rbp),%ecx
shl    $0x8,%ecx
and    $0xff0000,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff00,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
sar    $0x18,%ecx
and    $0xff,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get32bit>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    (%rdi),%rsi
lea    0xc(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
addq   $0x10,(%rbx)
mov    0xc(%rsp),%eax
bswap  %eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get32bit(i32** %0) {
%2 = alloca i32**
%3 = alloca i32
store i32** %0, i32*** %2
%4 = load i32**, i32*** %2
%5 = load i32*, i32** %4
%6 = call i32 @memcpy(i32* %3, i32* %5, i32 4)
%7 = load i32**, i32*** %2
%8 = load i32*, i32** %7
%9 = getelementptr inbounds i32, i32* %8, i64 4
store i32* %9, i32** %7
%10 = load i32, i32* %3
%11 = shl i32 %10, 24
%12 = and i32 %11, -16777216
%13 = load i32, i32* %3
%14 = shl i32 %13, 8
%15 = and i32 %14, 16711680
%16 = or i32 %12, %15
%17 = load i32, i32* %3
%18 = ashr i32 %17, 8
%19 = and i32 %18, 65280
%20 = or i32 %16, %19
%21 = load i32, i32* %3
%22 = ashr i32 %21, 24
%23 = and i32 %22, 255
%24 = or i32 %20, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @get32bit(i32** nocapture %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32*, i32** %0
%5 = call i32 @memcpy(i32* %2, i32* %4, i32 4)
%6 = load i32*, i32** %0
%7 = getelementptr inbounds i32, i32* %6, i64 4
store i32* %7, i32** %0
%8 = load i32, i32* %2
%9 = call i32 @llvm.bswap.i32(i32 %8)
ret i32 %9
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, int *, int);
int little_endian() {
  uint16_t t = 0x0001;
  char c[2];
  memcpy(c, &t, sizeof t);
  return c[0];
}


x86 assembly (clang, -O0):
<little_endian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
lea    -0x6(%rbp),%rdi
lea    -0x4(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
movsbl -0x6(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<little_endian>:
push   %rax
movl   $0x1,0x4(%rsp)
lea    0x2(%rsp),%rdi
lea    0x4(%rsp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
movsbl 0x2(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @little_endian() {
%1 = alloca i32
%2 = alloca [2 x i8]
store i32 1, i32* %1
%3 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%4 = call i32 @memcpy(i8* %3, i32* %1, i32 4)
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @little_endian() {
%1 = alloca i32
%2 = alloca [2 x i8]
%3 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%5 = call i32 @memcpy(i8* %4, i32* %1, i32 4)
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
ret i32 %7
}
unsigned int pack(const unsigned char *b) {
  return ((unsigned int)b[0] << 24) | ((unsigned int)b[1] << 16) |
         ((unsigned int)b[2] << 8) | (unsigned int)b[3];
}


x86 assembly (clang, -O0):
<pack>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pack>:
mov    (%rdi),%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @pack(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl i32 %6, 24
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 16
%13 = or i32 %7, %12
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 2
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = or i32 %13, %18
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i64 3
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = or i32 %19, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @pack(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw i32 %3, 24
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 16
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 8
%14 = or i32 %9, %13
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = or i32 %14, %17
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ SpinSomeMore();
void Spin() {
  volatile unsigned int count = 0;
  int i;
  for (i = 0; i < 1000; i++) {
    count++;
  }
  SpinSomeMore();
}


x86 assembly (clang, -O0):
<Spin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jge    114a <Spin+0x3a>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <Spin+0x16>
mov    $0x0,%al
call   1030 <SpinSomeMore@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Spin>:
movl   $0x0,-0x4(%rsp)
mov    $0x3e8,%eax
nopl   (%rax)
addl   $0x1,-0x4(%rsp)
addl   $0x1,-0x4(%rsp)
addl   $0x1,-0x4(%rsp)
addl   $0x1,-0x4(%rsp)
addl   $0x1,-0x4(%rsp)
add    $0xfffffffb,%eax
jne    1120 <Spin+0x10>
xor    %eax,%eax
jmp    1030 <SpinSomeMore@plt>

LLVM IR (-O0):
define void @Spin() {
%1 = alloca i32
%2 = alloca i32
store volatile i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %9, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 1000
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load volatile i32, i32* %1
%8 = add i32 %7, 1
store volatile i32 %8, i32* %1
br label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 1
store i32 %11, i32* %2
br label %3
12: ; preds = %3
%13 = call i32 (...) @SpinSomeMore()
ret void
}

LLVM IR (-O2):
define void @Spin() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store volatile i32 0, i32* %1
br label %3
3: ; preds = %3, %0
%4 = phi i32 [ 0, %0 ], [ %15, %3 ]
%5 = load volatile i32, i32* %1
%6 = add i32 %5, 1
store volatile i32 %6, i32* %1
%7 = load volatile i32, i32* %1
%8 = add i32 %7, 1
store volatile i32 %8, i32* %1
%9 = load volatile i32, i32* %1
%10 = add i32 %9, 1
store volatile i32 %10, i32* %1
%11 = load volatile i32, i32* %1
%12 = add i32 %11, 1
store volatile i32 %12, i32* %1
%13 = load volatile i32, i32* %1
%14 = add i32 %13, 1
store volatile i32 %14, i32* %1
%15 = add nuw nsw i32 %4, 5
%16 = icmp eq i32 %15, 1000
br i1 %16, label %17, label %3
17: ; preds = %3
%18 = tail call i32 (...) @SpinSomeMore()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
int main(int argc, char **argv) {
  while (1)
    sleep(10000000);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x989680,%edi
call   1030 <sleep@plt>
jmp    1126 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x989680,%edi
call   1030 <sleep@plt>
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
br label %6
6: ; preds = %2, %6
%7 = call i32 @sleep(i32 10000000)
br label %6
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %3
%4 = tail call i32 @sleep(i32 10000000)
br label %3
}
int strfill(char *strin, int count, char c) {
  int i;
  for (i = 0; i < count; i++)
    *strin++ = c;
  *strin = '\0';
  return count;
}


x86 assembly (clang, -O0):
<strfill>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1145 <strfill+0x45>
mov    -0xd(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1117 <strfill+0x17>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strfill>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
test   %esi,%esi
jle    1137 <strfill+0x27>
mov    %ebx,%eax
movzbl %dl,%esi
mov    %r14,%rdi
mov    %rax,%rdx
call   1030 <memset@plt>
lea    -0x1(%rbx),%eax
add    %rax,%r14
add    $0x1,%r14
movb   $0x0,(%r14)
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @strfill(i8* nocapture writeonly %0, i32 returned %1, i8 signext %2) {
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %11
5: ; preds = %3
%6 = zext i32 %1 to i64
%7 = add nsw i32 %1, -1
%8 = zext i32 %7 to i64
%9 = add nuw nsw i64 %8, 1
%10 = getelementptr i8, i8* %0, i64 %9
br label %11
11: ; preds = %5, %3
%12 = phi i8* [ %0, %3 ], [ %10, %5 ]
store i8 0, i8* %12
ret i32 %1
}
float BackMiddleEaseOut(float p) {
  float d = 1.0;
  float b = 1;
  float c = 1;
  float s = 0.1175;
  p = p / d - 1;
  return c * (p * p * ((s + 1) * p + s)) + b;
}


x86 assembly (clang, -O0):
<BackMiddleEaseOut>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xeef(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xee2(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xed5(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xecc(%rip),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
movss  0xeb1(%rip),%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x10(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
mulss  -0x4(%rbp),%xmm2
movss  0xe91(%rip),%xmm1
addss  -0x14(%rbp),%xmm1
movss  -0x4(%rbp),%xmm4
movss  -0x14(%rbp),%xmm3
mulss  %xmm4,%xmm1
addss  %xmm3,%xmm1
mulss  %xmm1,%xmm2
movss  -0xc(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<BackMiddleEaseOut>:
addss  0xef8(%rip),%xmm0
movaps %xmm0,%xmm1
mulss  0xef1(%rip),%xmm0
addss  0xeed(%rip),%xmm0
mulss  %xmm1,%xmm1
mulss  %xmm1,%xmm0
addss  0xee1(%rip),%xmm0
ret

LLVM IR (-O0):
define float @BackMiddleEaseOut(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %2
store float 1.000000e+00, float* %3
store float 1.000000e+00, float* %4
store float 1.000000e+00, float* %5
store float 0x3FBE147AE0000000, float* %6
%7 = load float, float* %2
%8 = load float, float* %3
%9 = fdiv float %7, %8
%10 = fsub float %9, 1.000000e+00
store float %10, float* %2
%11 = load float, float* %5
%12 = load float, float* %2
%13 = load float, float* %2
%14 = fmul float %12, %13
%15 = load float, float* %6
%16 = fadd float %15, 1.000000e+00
%17 = load float, float* %2
%18 = load float, float* %6
%19 = call float @llvm.fmuladd.f32(float %16, float %17, float %18)
%20 = fmul float %14, %19
%21 = load float, float* %4
%22 = call float @llvm.fmuladd.f32(float %11, float %20, float %21)
ret float %22
}

LLVM IR (-O2):
define float @BackMiddleEaseOut(float %0) {
%2 = fadd float %0, -1.000000e+00
%3 = fmul float %2, %2
%4 = tail call float @llvm.fmuladd.f32(float %2, float 0x3FF1E147A0000000, float 0x3FBE147AE0000000)
%5 = fmul float %3, %4
%6 = fadd float %5, 1.000000e+00
ret float %6
}
/* Type definitions */
typedef int /*<<< orphan*/ cc_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_control_char(cc_t *cc, int len) {
  printf("input char array size %d\n", len);
  printf("    VDISCARD not defined\n");
}


x86 assembly (clang, -O0):
<print_control_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xed7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [26 x i8] c"input char array size %d\0A\00"
@.str.1 = [26 x i8] c" VDISCARD not defined\0A\00"
define void @print_control_char(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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"input char array size %d\0A\00"
@str = [25 x i8] c" VDISCARD not defined\00"
define void @print_control_char(i32* nocapture readnone %0, i32 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sensor_data_request();
void notify_sensor_data_request() { sensor_data_request(); }


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

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

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

LLVM IR (-O2):
define void @notify_sensor_data_request() {
%1 = tail call i32 (...) @sensor_data_request()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bomb(char *);
extern int do_aspawn() { bomb("do_aspawn"); }


x86 assembly (clang, -O0):
<do_aspawn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <bomb@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_aspawn>:
lea    0xee9(%rip),%rdi
jmp    1030 <bomb@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"do_aspawn\00"
define i32 @do_aspawn() {
%1 = alloca i32
%2 = call i32 @bomb(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [10 x i8] c"do_aspawn\00"
define i32 @do_aspawn() {
%1 = tail call i32 @bomb(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
char _irc_toupper(char);
char *irc_strupr(char *str) {
  char *c;
  c = str;
  while (*c) {
    *c = _irc_toupper(*c);
    c++;
  }
  return str;
}


x86 assembly (clang, -O0):
<irc_strupr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1156 <irc_strupr+0x46>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <_irc_toupper@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <irc_strupr+0x14>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irc_strupr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
test   %al,%al
je     1146 <irc_strupr+0x36>
lea    0x1(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <_irc_toupper@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <irc_strupr+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @irc_strupr(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call signext i8 @_irc_toupper(i8 signext %5)
store i8 %7, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret i8* %0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ __debugfs_init();
int /*<<< orphan*/ *__real_fopen(char const *, char const *);
int /*<<< orphan*/ printf(char *);
FILE *fopen(__const char *__restrict __filename,
            __const char *__restrict __modes) {
  printf("calling "
         "fopen"
         "\n");
  __debugfs_init();
  return (__real_fopen(__filename, __modes));
}


x86 assembly (clang, -O0):
<fopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <__debugfs_init@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <__real_fopen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fopen>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xebf(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1050 <__debugfs_init@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <__real_fopen@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"calling fopen\0A\00"
define i32* @fopen(i8* noalias %0, i8* noalias %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @__debugfs_init()
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32* @__real_fopen(i8* %7, i8* %8)
ret i32* %9
}

LLVM IR (-O2):
@str = [14 x i8] c"calling fopen\00"
define i32* @fopen(i8* noalias %0, i8* noalias %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @__debugfs_init()
%5 = tail call i32* @__real_fopen(i8* %0, i8* %1)
ret i32* %5
}
/* Variables and functions */
double fabs(double);
int fudgeNumbers(double num1, double num2, double fudgeFactor) {
  if (fabs(num1 - num2) <= fudgeFactor)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<fudgeNumbers>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
movaps 0xedc(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1143 <fudgeNumbers+0x43>
movl   $0x1,-0x4(%rbp)
jmp    114a <fudgeNumbers+0x4a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fudgeNumbers>:
subsd  %xmm1,%xmm0
andpd  0xef4(%rip),%xmm0
xor    %eax,%eax
ucomisd %xmm0,%xmm2
setae  %al
ret

LLVM IR (-O0):
define i32 @fudgeNumbers(double %0, double %1, double %2) {
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%8 = load double, double* %5
%9 = load double, double* %6
%10 = fsub double %8, %9
%11 = call double @llvm.fabs.f64(double %10)
%12 = load double, double* %7
%13 = fcmp ole double %11, %12
br i1 %13, label %14, label %15
14: ; preds = %3
store i32 1, i32* %4
br label %16
15: ; preds = %3
store i32 0, i32* %4
br label %16
16: ; preds = %15, %14
%17 = load i32, i32* %4
ret i32 %17
}

LLVM IR (-O2):
define i32 @fudgeNumbers(double %0, double %1, double %2) {
%4 = fsub double %0, %1
%5 = tail call double @llvm.fabs.f64(double %4)
%6 = fcmp ole double %5, %2
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char *applet(char *const);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
void usage(FILE *f, char *const arg0) {
  fprintf(f,
          "Usage: %s [OPTIONS] SYMBOL LIBRARY [--] [ARGS...]\n"
          "\n"
          "Run a symbol in a shared object or executable.\n"
          "\n"
          "Options:\n"
          " -h or --help          Display this message.\n"
          " -V or --version       Display the version.\n"
          "",
          applet(arg0));
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <applet@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rdx
lea    0xeb1(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <applet@plt>
lea    0xecd(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
pop    %rbx
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@.str = [198 x i8] c"Usage: %s [OPTIONS] SYMBOL LIBRARY [--] [ARGS...]\0A\0ARun a symbol in a shared object or executable.\0A\0AOptions:\0A -h or --help Display this message.\0A -V or --version Display the version.\0A\00"
define void @usage(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 i8* @applet(i8* %6)
%8 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([198 x i8], [198 x i8]* @.str, i64 0, i64 0), i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [198 x i8] c"Usage: %s [OPTIONS] SYMBOL LIBRARY [--] [ARGS...]\0A\0ARun a symbol in a shared object or executable.\0A\0AOptions:\0A -h or --help Display this message.\0A -V or --version Display the version.\0A\00"
define void @usage(i32* nocapture %0, i8* %1) {
%3 = tail call i8* @applet(i8* %1)
%4 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([198 x i8], [198 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}
int sem_down_now(int sem) {
  if (0 == sem) {
    return -1;
  }
  --sem;
  return 0;
}


x86 assembly (clang, -O0):
<sem_down_now>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
xor    %eax,%eax
cmp    -0x8(%rbp),%eax
jne    111e <sem_down_now+0x1e>
movl   $0xffffffff,-0x4(%rbp)
jmp    112e <sem_down_now+0x2e>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sem_down_now>:
cmp    $0x1,%edi
sbb    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @sem_down_now(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = sext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ modelview_mul(float **);
int /*<<< orphan*/ modelview_push();
void modelview_mul_push(float m[4][4]) {
  modelview_push();
  modelview_mul(m);
}


x86 assembly (clang, -O0):
<modelview_mul_push>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <modelview_push@plt>
mov    -0x8(%rbp),%rdi
call   1040 <modelview_mul@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modelview_mul_push>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <modelview_push@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <modelview_mul@plt>

LLVM IR (-O0):
define void @modelview_mul_push([4 x float]* %0) {
%2 = alloca [4 x float]*
store [4 x float]* %0, [4 x float]** %2
%3 = call i32 (...) @modelview_push()
%4 = load [4 x float]*, [4 x float]** %2
%5 = bitcast [4 x float]* %4 to float**
%6 = call i32 @modelview_mul(float** %5)
ret void
}

LLVM IR (-O2):
define void @modelview_mul_push([4 x float]* %0) {
%2 = tail call i32 (...) @modelview_push()
%3 = bitcast [4 x float]* %0 to float**
%4 = tail call i32 @modelview_mul(float** %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(int /*<<< orphan*/, char *);
int /*<<< orphan*/ mkdir(char *, int);
int /*<<< orphan*/ os_compatible_path(char *);
void ensure_directory(char *dirname) {
  FILE *fp;
  if ((fp = fopen(os_compatible_path(dirname), "rb")) == 0)
    mkdir(dirname, 511);
  else
    fclose(fp);
}


x86 assembly (clang, -O0):
<ensure_directory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <os_compatible_path@plt>
mov    %eax,%edi
lea    0xea2(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1184 <ensure_directory+0x44>
mov    -0x8(%rbp),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
jmp    118d <ensure_directory+0x4d>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ensure_directory>:
push   %rbx
mov    %rdi,%rbx
call   1050 <os_compatible_path@plt>
lea    0xeb0(%rip),%rsi
mov    %eax,%edi
call   1060 <fopen@plt>
test   %rax,%rax
je     1165 <ensure_directory+0x25>
mov    %rax,%rdi
pop    %rbx
jmp    1040 <fclose@plt>
mov    %rbx,%rdi
mov    $0x1ff,%esi
pop    %rbx
jmp    1030 <mkdir@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
define void @ensure_directory(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @os_compatible_path(i8* %4)
%6 = call i32* @fopen(i32 %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %3
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @mkdir(i8* %9, i32 511)
br label %14
11: ; preds = %1
%12 = load i32*, i32** %3
%13 = call i32 @fclose(i32* %12)
br label %14
14: ; preds = %11, %8
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
define void @ensure_directory(i8* %0) {
%2 = tail call i32 @os_compatible_path(i8* %0)
%3 = tail call i32* @fopen(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @mkdir(i8* %0, i32 511)
br label %9
7: ; preds = %1
%8 = tail call i32 @fclose(i32* %3)
br label %9
9: ; preds = %7, %5
ret void
}
void av_bprint_finalize() {}


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

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

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

LLVM IR (-O2):
define void @av_bprint_finalize() {
ret void
}
void __attribute__((weak)) echo(char *chain) {}


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

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

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

LLVM IR (-O2):
define weak void @echo(i8* %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ arch_local_irq_restore(unsigned long);
unsigned long arch_local_save_flags();
void arch_local_irq_disable(void) {
  unsigned long flags = arch_local_save_flags();
  flags &= ~1;
  arch_local_irq_restore(flags);
}


x86 assembly (clang, -O0):
<arch_local_irq_disable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <arch_local_save_flags@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xfffffffffffffffe,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <arch_local_irq_restore@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arch_local_irq_disable>:
push   %rax
xor    %eax,%eax
call   1040 <arch_local_save_flags@plt>
and    $0xfffffffffffffffe,%rax
mov    %rax,%rdi
pop    %rax
jmp    1030 <arch_local_irq_restore@plt>

LLVM IR (-O0):
define void @arch_local_irq_disable() {
%1 = alloca i64
%2 = call i64 (...) @arch_local_save_flags()
store i64 %2, i64* %1
%3 = load i64, i64* %1
%4 = and i64 %3, -2
store i64 %4, i64* %1
%5 = load i64, i64* %1
%6 = call i32 @arch_local_irq_restore(i64 %5)
ret void
}

LLVM IR (-O2):
define void @arch_local_irq_disable() {
%1 = tail call i64 (...) @arch_local_save_flags()
%2 = and i64 %1, -2
%3 = tail call i32 @arch_local_irq_restore(i64 %2)
ret void
}
__attribute__((always_)) void __set_bit(int nr, volatile unsigned long *addr) {
  asm volatile("bts %1,%0"
               : "+m"(*(volatile long *)(addr))
               : "Ir"(nr)
               : "memory");
}


x86 assembly (clang, -O0):
<__set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
bts    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__set_bit>:
bts    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @__set_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
store i32 %0, i32* %3
store i64* %1, i64** %4
%5 = load i64*, i64** %4
%6 = load i32, i32* %3
ret void
}

LLVM IR (-O2):
define void @__set_bit(i32 %0, i64* %1) {
tail call void asm sideeffect "bts $1,$0", "=*m,Ir,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %1, i32 %0, i64* elementtype(i64) %1)
ret void
}
void timeR_idlemark(int state) {}


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

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

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

LLVM IR (-O2):
define void @timeR_idlemark(i32 %0) {
ret void
}
void delay_loop(void) {
  volatile int i, j;
  for (i = 0; i < 100; i++)
    for (j = 0; j < 1000; j++)
      ;
}


x86 assembly (clang, -O0):
<delay_loop>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    $0x64,%eax
jge    1152 <delay_loop+0x52>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    $0x3e8,%eax
jge    113f <delay_loop+0x3f>
jmp    1131 <delay_loop+0x31>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111e <delay_loop+0x1e>
jmp    1144 <delay_loop+0x44>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <delay_loop+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay_loop>:
movl   $0x0,-0x4(%rsp)
mov    -0x4(%rsp),%eax
cmp    $0x63,%eax
jle    112e <delay_loop+0x2e>
ret
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
addl   $0x1,-0x4(%rsp)
mov    -0x4(%rsp),%eax
cmp    $0x64,%eax
jge    1111 <delay_loop+0x11>
movl   $0x0,-0x8(%rsp)
mov    -0x8(%rsp),%eax
cmp    $0x3e7,%eax
jg     1120 <delay_loop+0x20>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
addl   $0x1,-0x8(%rsp)
mov    -0x8(%rsp),%eax
cmp    $0x3e8,%eax
jl     1150 <delay_loop+0x50>
jmp    1120 <delay_loop+0x20>

LLVM IR (-O0):
define void @delay_loop() {
%1 = alloca i32
%2 = alloca i32
store volatile i32 0, i32* %1
br label %3
3: ; preds = %15, %0
%4 = load volatile i32, i32* %1
%5 = icmp slt i32 %4, 100
br i1 %5, label %6, label %18
6: ; preds = %3
store volatile i32 0, i32* %2
br label %7
7: ; preds = %11, %6
%8 = load volatile i32, i32* %2
%9 = icmp slt i32 %8, 1000
br i1 %9, label %10, label %14
10: ; preds = %7
br label %11
11: ; preds = %10
%12 = load volatile i32, i32* %2
%13 = add nsw i32 %12, 1
store volatile i32 %13, i32* %2
br label %7
14: ; preds = %7
br label %15
15: ; preds = %14
%16 = load volatile i32, i32* %1
%17 = add nsw i32 %16, 1
store volatile i32 %17, i32* %1
br label %3
18: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @delay_loop() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
store volatile i32 0, i32* %1
%5 = load volatile i32, i32* %1
%6 = icmp slt i32 %5, 100
br i1 %6, label %7, label %20
7: ; preds = %0, %15
store volatile i32 0, i32* %2
%8 = load volatile i32, i32* %2
%9 = icmp slt i32 %8, 1000
br i1 %9, label %10, label %15
10: ; preds = %7, %10
%11 = load volatile i32, i32* %2
%12 = add nsw i32 %11, 1
store volatile i32 %12, i32* %2
%13 = load volatile i32, i32* %2
%14 = icmp slt i32 %13, 1000
br i1 %14, label %10, label %15
15: ; preds = %10, %7
%16 = load volatile i32, i32* %1
%17 = add nsw i32 %16, 1
store volatile i32 %17, i32* %1
%18 = load volatile i32, i32* %1
%19 = icmp slt i32 %18, 100
br i1 %19, label %7, label %20
20: ; preds = %15, %0
ret void
}