xunge/DecIR huggingface dataset:
/* Type definitions */
struct ltable_value {
  int dummy;
};
struct ltable_key {
  int dummy;
};
struct ltable {
  int dummy;
};

/* Variables and functions */
struct ltable_value *_get(struct ltable *, struct ltable_key const *);
void *_gud(struct ltable_value *);
void *ltable_get(struct ltable *t, const struct ltable_key *key) {
  struct ltable_value *val = _get(t, key);
  return _gud(val);
}


x86 assembly (clang, -O0):
<ltable_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <_get@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <_gud@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltable_get>:
push   %rax
call   1040 <_get@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <_gud@plt>

LLVM IR (-O0):
%struct.ltable = type { i32 }
%struct.ltable_key = type { i32 }
%struct.ltable_value = type { i32 }
define i8* @ltable_get(%struct.ltable* %0, %struct.ltable_key* %1) {
%3 = alloca %struct.ltable*
%4 = alloca %struct.ltable_key*
%5 = alloca %struct.ltable_value*
store %struct.ltable* %0, %struct.ltable** %3
store %struct.ltable_key* %1, %struct.ltable_key** %4
%6 = load %struct.ltable*, %struct.ltable** %3
%7 = load %struct.ltable_key*, %struct.ltable_key** %4
%8 = call %struct.ltable_value* @_get(%struct.ltable* %6, %struct.ltable_key* %7)
store %struct.ltable_value* %8, %struct.ltable_value** %5
%9 = load %struct.ltable_value*, %struct.ltable_value** %5
%10 = call i8* @_gud(%struct.ltable_value* %9)
ret i8* %10
}

LLVM IR (-O2):
%struct.ltable = type { i32 }
%struct.ltable_key = type { i32 }
%struct.ltable_value = type { i32 }
define i8* @ltable_get(%struct.ltable* %0, %struct.ltable_key* %1) {
%3 = tail call %struct.ltable_value* @_get(%struct.ltable* %0, %struct.ltable_key* %1)
%4 = tail call i8* @_gud(%struct.ltable_value* %3)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char *, char *, int /*<<< orphan*/);
int copieEntierDeConfig(char *parametre, char *ligne, int *configParam,
                        int valeur) {
  if (strncmp(parametre, ligne, strlen(parametre)) == 0) {
    *configParam = valeur;
    return 200;
  }
  return 404;
}


x86 assembly (clang, -O0):
<copieEntierDeConfig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    117e <copieEntierDeConfig+0x5e>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0xc8,-0x4(%rbp)
jmp    1185 <copieEntierDeConfig+0x65>
movl   $0x194,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copieEntierDeConfig>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
mov    $0x194,%eax
test   %rcx,%rcx
jne    115a <copieEntierDeConfig+0x3a>
mov    %r14d,(%r15)
mov    $0xc8,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @copieEntierDeConfig(i8* %0, i8* %1, i32* nocapture writeonly %2, i32 %3) {
%5 = tail call i32 @strlen(i8* %0)
%6 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %4
store i32 %3, i32* %2
br label %9
9: ; preds = %4, %8
%10 = phi i32 [ 200, %8 ], [ 404, %4 ]
ret i32 %10
}
int test_imm_6Auint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x6A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_6Auint64_midword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x10,%rdx
and    $0x6a,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_6Auint64_midword_mem>:
testb  $0x6a,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_6Auint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 106
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_6Auint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 6946816
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
scalar_t__ rand();
int main() {
  volatile float a = (float)rand();
  float x = a / 2.;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec6(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,0x4(%rsp)
movss  0x4(%rsp),%xmm0
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = call i64 (...) @rand()
%4 = sitofp i64 %3 to float
store volatile float %4, float* %1
%5 = load volatile float, float* %1
%6 = fpext float %5 to double
%7 = fdiv double %6, 2.000000e+00
%8 = fptrunc double %7 to float
store float %8, float* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i64 (...) @rand()
%4 = sitofp i64 %3 to float
store volatile float %4, float* %1
%5 = load volatile float, float* %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, int);
void __attribute__((regparm(3))) memcpy_25(void *dest, void *src) {
  memcpy(dest, src, 25);
}


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

x86 assembly (clang, -O2):
<memcpy_25>:
mov    $0x19,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @memcpy_25(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 @memcpy(i8* %5, i8* %6, i32 25)
ret void
}

LLVM IR (-O2):
define void @memcpy_25(i8* %0, i8* %1) {
%3 = tail call i32 @memcpy(i8* %0, i8* %1, i32 25)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void Sys_SleepSec(int seconds) { sleep(seconds); }


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

x86 assembly (clang, -O2):
<Sys_SleepSec>:
jmp    1030 <sleep@plt>

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

LLVM IR (-O2):
define void @Sys_SleepSec(i32 %0) {
%2 = tail call i32 @sleep(i32 %0)
ret void
}
void sanitize_file_name(char *name) {
  for (; *name; name++)
    if (*name == '/')
      *name = '.';
}


x86 assembly (clang, -O0):
<sanitize_file_name>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1142 <sanitize_file_name+0x42>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    112c <sanitize_file_name+0x2c>
mov    -0x8(%rbp),%rax
movb   $0x2e,(%rax)
jmp    1131 <sanitize_file_name+0x31>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <sanitize_file_name+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sanitize_file_name>:
jmp    1117 <sanitize_file_name+0x17>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x2e,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x2f,%al
je     1110 <sanitize_file_name+0x10>
test   %al,%al
jne    1113 <sanitize_file_name+0x13>
ret

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

LLVM IR (-O2):
define void @sanitize_file_name(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
switch i8 %4, label %6 [
i8 0, label %8
i8 47, label %5
]
5: ; preds = %2
store i8 46, i8* %3
br label %6
6: ; preds = %2, %5
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2
ret void
}
int isDigit(const int c) { return c >= '0' && c <= '9'; }


x86 assembly (clang, -O0):
<isDigit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x30,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <isDigit+0x20>
cmpl   $0x39,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isDigit>:
add    $0xffffffd0,%edi
xor    %eax,%eax
cmp    $0xa,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isDigit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 48
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 57
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @isDigit(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
double randomn(double);
double perturbup(double value, double amount) {
  value = value + randomn(value * amount);
  return value;
}


x86 assembly (clang, -O0):
<perturbup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1030 <randomn@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<perturbup>:
push   %rax
movsd  %xmm0,(%rsp)
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <randomn@plt>
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @perturbup(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %3
%7 = load double, double* %4
%8 = fmul double %6, %7
%9 = call double @randomn(double %8)
%10 = fadd double %5, %9
store double %10, double* %3
%11 = load double, double* %3
ret double %11
}

LLVM IR (-O2):
define double @perturbup(double %0, double %1) {
%3 = fmul double %0, %1
%4 = tail call double @randomn(double %3)
%5 = fadd double %4, %0
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ checkTimeout();
int /*<<< orphan*/ sleep(int);
void *loop(void *threadid) {
  while (1) {
    sleep((1));
    checkTimeout();
  }
  return NULL;
}


x86 assembly (clang, -O0):
<loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    $0x0,%al
call   1030 <checkTimeout@plt>
jmp    112c <loop+0xc>

x86 assembly (clang, -O2):
<loop>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1040 <sleep@plt>
xor    %eax,%eax
call   1030 <checkTimeout@plt>
jmp    1130 <loop+0x10>

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

LLVM IR (-O2):
define noalias i8* @loop(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 @sleep(i32 1)
%4 = tail call i32 (...) @checkTimeout()
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  while (n != 42) {
    printf("%d\n", n);
    scanf("%d", &n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x2a,-0x8(%rbp)
je     116d <main+0x4d>
mov    -0x8(%rbp),%esi
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x2a,%esi
je     117c <main+0x5c>
lea    0xeb9(%rip),%r14
lea    0xeaf(%rip),%r15
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    $0x2a,%esi
jne    1160 <main+0x40>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %4
4: ; preds = %7, %0
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 42
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %4
11: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp eq i32 %4, 42
br i1 %5, label %12, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %10, %6 ], [ %4, %0 ]
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 42
br i1 %11, label %12, label %6
12: ; preds = %6, %0
ret i32 0
}
int fn1(int a, int b) {
  int tem1 = a & b;
  int tem2 = a | b;
  return tem1 + tem2;
}


x86 assembly (clang, -O0):
<fn1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn1>:
lea    (%rdi,%rsi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @fn1(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int f1(int, int);
int /*<<< orphan*/ init_bufs();
int /*<<< orphan*/ test_threads();
int main(int argc, char *argv[]) {
  test_threads();
  init_bufs();
  return f1(1, 2);
}


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    $0x0,%al
call   1040 <test_threads@plt>
mov    $0x0,%al
call   1030 <init_bufs@plt>
mov    $0x1,%edi
mov    $0x2,%esi
call   1050 <f1@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <test_threads@plt>
xor    %eax,%eax
call   1030 <init_bufs@plt>
mov    $0x1,%edi
mov    $0x2,%esi
pop    %rax
jmp    1050 <f1@plt>

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
%6 = call i32 (...) @test_threads()
%7 = call i32 (...) @init_bufs()
%8 = call i32 @f1(i32 1, i32 2)
ret i32 %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_threads()
%4 = tail call i32 (...) @init_bufs()
%5 = tail call i32 @f1(i32 1, i32 2)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ l_message(int /*<<< orphan*/ *, char *);
void print_version(void) {
  l_message(NULL, "Lua 5.1.3"
                  "  "
                  "Copyright (C) 1994-2008 Lua.org, PUC-Rio");
}


x86 assembly (clang, -O0):
<print_version>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
lea    0xee1(%rip),%rsi
call   1030 <l_message@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_version>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
jmp    1030 <l_message@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"Lua 5.1.3 Copyright (C) 1994-2008 Lua.org, PUC-Rio\00"
define void @print_version() {
%1 = call i32 @l_message(i32* null, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"Lua 5.1.3 Copyright (C) 1994-2008 Lua.org, PUC-Rio\00"
define void @print_version() {
%1 = tail call i32 @l_message(i32* null, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
ret void
}
int max(int i1, int i2) {
  if (i1 > i2)
    return i1;
  else
    return i2;
}


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1121 <max+0x21>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1127 <max+0x27>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
mov    %esi,%eax
cmp    %esi,%edi
cmovg  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
void yy_1_TemplateTail(char *yytext, int yyleng) {
  ;
  ;
}


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

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

LLVM IR (-O0):
define void @yy_1_TemplateTail(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 @yy_1_TemplateTail(i8* nocapture %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_condattr_t;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ printf(char *, char *);
int pthread_condattr_init(int /*<<< orphan*/ *);
char *strerror(int);
int PTHREAD_CONDATTR_INIT(pthread_condattr_t *a) {
  int err;
  if (err = pthread_condattr_init(a)) {
    printf("%s\n", strerror(err));
    abort();
  }
}


x86 assembly (clang, -O0):
<PTHREAD_CONDATTR_INIT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <pthread_condattr_init@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     117f <PTHREAD_CONDATTR_INIT+0x3f>
mov    -0x14(%rbp),%edi
call   1060 <strerror@plt>
mov    %rax,%rsi
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PTHREAD_CONDATTR_INIT>:
push   %rax
call   1050 <pthread_condattr_init@plt>
test   %eax,%eax
jne    114c <PTHREAD_CONDATTR_INIT+0xc>
pop    %rcx
ret
mov    %eax,%edi
call   1060 <strerror@plt>
lea    0xea6(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @PTHREAD_CONDATTR_INIT(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = call i32 @pthread_condattr_init(i32* %5)
store i32 %6, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* %4
%10 = call i8* @strerror(i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = call i32 (...) @abort()
unreachable
13: ; preds = %1
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @PTHREAD_CONDATTR_INIT(i32* %0) {
%2 = tail call i32 @pthread_condattr_init(i32* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i8* @strerror(i32 %2)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %1
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int getsockopt(int, int /*<<< orphan*/, int, int *, int /*<<< orphan*/ *);
int sock_getsockopt(int s, int optname) {
  int val, len = sizeof(int);
  if (getsockopt(s, SOL_SOCKET, optname, &val, (socklen_t *)&len) == -1)
    return -1;
  else
    return val;
}


x86 assembly (clang, -O0):
<sock_getsockopt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x4,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
mov    -0xc(%rbp),%edx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <getsockopt@plt>
cmp    $0xffffffff,%eax
jne    1156 <sock_getsockopt+0x46>
movl   $0xffffffff,-0x4(%rbp)
jmp    115c <sock_getsockopt+0x4c>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sock_getsockopt>:
push   %rax
mov    %esi,%edx
movl   $0x4,(%rsp)
mov    0x2ec7(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rcx
mov    %rsp,%r8
call   1030 <getsockopt@plt>
cmp    $0xffffffff,%eax
je     1139 <sock_getsockopt+0x29>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
define i32 @sock_getsockopt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 4, i32* %7
%8 = load i32, i32* %4
%9 = load i32, i32* @SOL_SOCKET
%10 = load i32, i32* %5
%11 = call i32 @getsockopt(i32 %8, i32 %9, i32 %10, i32* %6, i32* %7)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %16
14: ; preds = %2
%15 = load i32, i32* %6
store i32 %15, i32* %3
br label %16
16: ; preds = %14, %13
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
define i32 @sock_getsockopt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
store i32 4, i32* %4
%7 = load i32, i32* @SOL_SOCKET
%8 = call i32 @getsockopt(i32 %0, i32 %7, i32 %1, i32* %3, i32* %4)
%9 = icmp eq i32 %8, -1
%10 = load i32, i32* %3
%11 = select i1 %9, i32 -1, i32 %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, double);
int main(int argc, char **argv) {
  double t_c = 55;
  double t_f;
  t_f = t_c * 9 / 5 + 32;
  printf("%f celcius is %f farenheit\n", t_c, t_f);
  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)
movsd  0xeea(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xed5(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xec0(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xeac(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
movsd  0xee0(%rip),%xmm0
movsd  0xee0(%rip),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"%f celcius is %f farenheit\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 5.500000e+01, double* %6
%8 = load double, double* %6
%9 = fmul double %8, 9.000000e+00
%10 = fdiv double %9, 5.000000e+00
%11 = fadd double %10, 3.200000e+01
store double %11, double* %7
%12 = load double, double* %6
%13 = load double, double* %7
%14 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double %12, double %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"%f celcius is %f farenheit\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), double 5.500000e+01, double 1.310000e+02)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
main() {
  int a, b;
  printf("Enter two numbers:");
  scanf("%d%d", &a, &b);
  printf("The sum of %d  and %d is %d", a, b, a + b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
add    -0xc(%rbp),%ecx
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    (%rdx,%rsi,1),%ecx
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Enter two numbers:\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [28 x i8] c"The sum of %d and %d is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = add nsw i32 %8, %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %7, i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Enter two numbers:\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [28 x i8] c"The sum of %d and %d is %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = add nsw i32 %8, %7
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
ret i32 0
}
int is_whitespace(char c) { return (c == ' ' || c == '\t' || c == '\n'); }


x86 assembly (clang, -O0):
<is_whitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x2(%rbp)
je     113b <is_whitespace+0x3b>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x2(%rbp)
je     113b <is_whitespace+0x3b>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_whitespace>:
mov    $0x1,%eax
cmp    $0x9,%dil
je     1111 <is_whitespace+0x11>
cmp    $0x20,%dil
jne    1112 <is_whitespace+0x12>
ret
xor    %eax,%eax
cmp    $0xa,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @is_whitespace(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 32
br i1 %5, label %14, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 9
br i1 %9, label %14, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 10
br label %14
14: ; preds = %10, %6, %1
%15 = phi i1 [ true, %6 ], [ true, %1 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @is_whitespace(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %5
i8 9, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 10
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char colour[3];
  printf("What's your favourite colour?\n");
  scanf("%s", colour);
  printf("The First Letter of your Favourite Colour is: %s\n", colour);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x7(%rbp),%rsi
lea    0xed7(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x7(%rbp),%rsi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xef9(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb8(%rip),%rdi
lea    0xd(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xea7(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"What's your favourite colour?\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [50 x i8] c"The First Letter of your Favourite Colour is: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i8* %6)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [50 x i8] c"The First Letter of your Favourite Colour is: %s\0A\00"
@str = [30 x i8] c"What's your favourite colour?\00"
define i32 @main() {
%1 = alloca [3 x i8]
%2 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0), i8* %2)
ret i32 0
}
char getPageNum() {
  char page[20];
  printf("What is the page number of the article you are citing?\n");
  scanf("%s", page);
  return page;
}


x86 assembly (clang, -O0):
<getPageNum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    0xef7(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    -0x20(%rbp),%rax
movsbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getPageNum>:
push   %rbx
sub    $0x20,%rsp
lea    0xed7(%rip),%rdi
call   1030 <puts@plt>
lea    0xec8(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %ebx,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [56 x i8] c"What is the page number of the article you are citing?\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define signext i8 @getPageNum() {
%1 = alloca [20 x i8]
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%6 = ptrtoint i8* %5 to i8
ret i8 %6
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@str = [55 x i8] c"What is the page number of the article you are citing?\00"
define signext i8 @getPageNum() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = ptrtoint [20 x i8]* %1 to i64
%6 = trunc i64 %5 to i8
ret i8 %6
}
float ulaw_to_float(unsigned char u_val) {
  int t;
  u_val = ~u_val;
  t = ((u_val & 0x0f) << 3) + 0x84;
  t <<= (u_val & 0x70) >> 4;
  return (((u_val & 0x80) ? (0x84 - t) : (t - 0x84)) / (1.0 * 0x8000));
}


x86 assembly (clang, -O0):
<ulaw_to_float>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0xf,%eax
shl    $0x3,%eax
add    $0x84,%eax
mov    %eax,-0x8(%rbp)
movzbl -0x1(%rbp),%ecx
and    $0x70,%ecx
sar    $0x4,%ecx
mov    -0x8(%rbp),%eax
shl    %cl,%eax
mov    %eax,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     115a <ulaw_to_float+0x5a>
mov    $0x84,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1165 <ulaw_to_float+0x65>
mov    -0x8(%rbp),%eax
sub    $0x84,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe8c(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ulaw_to_float>:
not    %dil
movzbl %dil,%eax
lea    0x0(,%rax,8),%ecx
or     $0x84,%ecx
movzbl %cl,%edx
mov    %eax,%ecx
shr    $0x4,%cl
and    $0x7,%cl
shl    %cl,%edx
mov    $0x84,%ecx
sub    %edx,%ecx
add    $0xffffff7c,%edx
test   $0x80,%al
cmovne %ecx,%edx
cvtsi2sd %edx,%xmm0
mulsd  0xec1(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @ulaw_to_float(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = zext i8 %4 to i32
%6 = xor i32 %5, -1
%7 = trunc i32 %6 to i8
store i8 %7, i8* %2
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = and i32 %9, 15
%11 = shl i32 %10, 3
%12 = add nsw i32 %11, 132
store i32 %12, i32* %3
%13 = load i8, i8* %2
%14 = zext i8 %13 to i32
%15 = and i32 %14, 112
%16 = ashr i32 %15, 4
%17 = load i32, i32* %3
%18 = shl i32 %17, %16
store i32 %18, i32* %3
%19 = load i8, i8* %2
%20 = zext i8 %19 to i32
%21 = and i32 %20, 128
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %1
%24 = load i32, i32* %3
%25 = sub nsw i32 132, %24
br label %29
26: ; preds = %1
%27 = load i32, i32* %3
%28 = sub nsw i32 %27, 132
br label %29
29: ; preds = %26, %23
%30 = phi i32 [ %25, %23 ], [ %28, %26 ]
%31 = sitofp i32 %30 to double
%32 = fdiv double %31, 3.276800e+04
%33 = fptrunc double %32 to float
ret float %33
}

LLVM IR (-O2):
define float @ulaw_to_float(i8 zeroext %0) {
%2 = xor i8 %0, -1
%3 = zext i8 %2 to i32
%4 = shl nuw nsw i32 %3, 3
%5 = and i32 %4, 120
%6 = or i32 %5, 132
%7 = lshr i32 %3, 4
%8 = and i32 %7, 7
%9 = shl i32 %6, %8
%10 = and i32 %3, 128
%11 = icmp eq i32 %10, 0
%12 = sub nsw i32 132, %9
%13 = add nsw i32 %9, -132
%14 = select i1 %11, i32 %13, i32 %12
%15 = sitofp i32 %14 to double
%16 = fmul double %15, 0x3F00000000000000
%17 = fptrunc double %16 to float
ret float %17
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void dump_pairing(int *pairing, int N) {
  int i;
  for (i = 0; i < N; i++) {
    printf("%d %d\n", i, pairing[i]);
  }
}


x86 assembly (clang, -O0):
<dump_pairing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <dump_pairing+0x4a>
mov    -0x10(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <dump_pairing+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_pairing>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1147 <dump_pairing+0x37>
mov    %rdi,%r14
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%edx
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <dump_pairing+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d %d\0A\00"
define void @dump_pairing(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = load i32, i32* %5
%12 = load i32*, i32** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %16)
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define void @dump_pairing(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = trunc i64 %7 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %9)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret void
}
void ASN1_GENERALSTRING_free(void) {}


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

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

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

LLVM IR (-O2):
define void @ASN1_GENERALSTRING_free() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
void argtoolongexit(void) {
  printf("sorry, option argument longer than %i, exiting.\n\n", 255);
  exit(1);
}


x86 assembly (clang, -O0):
<argtoolongexit>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
mov    $0xff,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<argtoolongexit>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0xff,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"sorry, option argument longer than %i, exiting.\0A\0A\00"
define void @argtoolongexit() {
%1 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 255)
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [50 x i8] c"sorry, option argument longer than %i, exiting.\0A\0A\00"
define void @argtoolongexit() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 255)
%2 = tail call i32 @exit(i32 1)
unreachable
}
long abs_fun_long(long a) {
  long mask = a >> 39;
  return (a + mask) ^ mask;
}


x86 assembly (clang, -O0):
<abs_fun_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
sar    $0x27,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    -0x10(%rbp),%rax
xor    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs_fun_long>:
mov    %rdi,%rcx
sar    $0x27,%rcx
lea    (%rdi,%rcx,1),%rax
xor    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @abs_fun_long(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = ashr i64 %4, 39
store i64 %5, i64* %3
%6 = load i64, i64* %2
%7 = load i64, i64* %3
%8 = add nsw i64 %6, %7
%9 = load i64, i64* %3
%10 = xor i64 %8, %9
ret i64 %10
}

LLVM IR (-O2):
define i64 @abs_fun_long(i64 %0) {
%2 = ashr i64 %0, 39
%3 = add nsw i64 %2, %0
%4 = xor i64 %3, %2
ret i64 %4
}
void *zero() { return 0; }


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

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

LLVM IR (-O0):
define i8* @zero() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @zero() {
ret i8* null
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ chr8setBank0(int);
int /*<<< orphan*/ prg32setBank0(int);
void m38_setParams7XXX(uint16_t addr, uint8_t val) {
  (void)addr;
  chr8setBank0(((val >> 2) & 3) << 13);
  prg32setBank0((val & 3) << 15);
}


x86 assembly (clang, -O0):
<m38_setParams7XXX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
sar    $0x2,%edi
and    $0x3,%edi
shl    $0xd,%edi
call   1040 <chr8setBank0@plt>
mov    -0x8(%rbp),%edi
and    $0x3,%edi
shl    $0xf,%edi
call   1030 <prg32setBank0@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m38_setParams7XXX>:
push   %rbx
mov    %esi,%ebx
mov    %esi,%edi
and    $0xc,%edi
shl    $0xb,%edi
call   1040 <chr8setBank0@plt>
and    $0x3,%ebx
shl    $0xf,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <prg32setBank0@plt>

LLVM IR (-O0):
define void @m38_setParams7XXX(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = ashr i32 %6, 2
%8 = and i32 %7, 3
%9 = shl i32 %8, 13
%10 = call i32 @chr8setBank0(i32 %9)
%11 = load i32, i32* %4
%12 = and i32 %11, 3
%13 = shl i32 %12, 15
%14 = call i32 @prg32setBank0(i32 %13)
ret void
}

LLVM IR (-O2):
define void @m38_setParams7XXX(i32 %0, i32 %1) {
%3 = shl i32 %1, 11
%4 = and i32 %3, 24576
%5 = tail call i32 @chr8setBank0(i32 %4)
%6 = shl i32 %1, 15
%7 = and i32 %6, 98304
%8 = tail call i32 @prg32setBank0(i32 %7)
ret void
}
/* Variables and functions */
int main1(int, char **);
int main(int argc, char *argv[]) { return main1(argc, argv); }


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    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <main1@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
jmp    1030 <main1@plt>

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
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @main1(i32 %6, i8** %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @main1(i32 %0, i8** %1)
ret i32 %3
}
void bar() {
  {
    while (0) {
      switch (0) { default:; }
    }
  }
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <bar+0x9>
xor    %eax,%eax
test   $0x1,%al
jne    1118 <bar+0x18>
jmp    111d <bar+0x1d>
jmp    1109 <bar+0x9>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @bar() {
br label %1
1: ; preds = %2, %0
br i1 false, label %2, label %3
2: ; preds = %1
br label %1
3: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @bar() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int gnt_net_decode(char *a_pszDst, int *a_piDst, const char *a_pszSrc,
                   int a_iSrc) {
  assert(a_pszDst && a_piDst && a_pszSrc && a_iSrc);
  return 0;
}


x86 assembly (clang, -O0):
<gnt_net_decode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x1d(%rbp)
je     1161 <gnt_net_decode+0x51>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x1d(%rbp)
je     1161 <gnt_net_decode+0x51>
xor    %eax,%eax
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x1d(%rbp)
je     1161 <gnt_net_decode+0x51>
cmpl   $0x0,-0x1c(%rbp)
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gnt_net_decode>:
push   %rax
test   %rdi,%rdi
setne  %dil
test   %rsi,%rsi
setne  %al
and    %dil,%al
test   %rdx,%rdx
setne  %dl
test   %ecx,%ecx
setne  %cl
and    %dl,%cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @gnt_net_decode(i8* readnone %0, i32* readnone %1, i8* readnone %2, i32 %3) {
%5 = icmp ne i8* %0, null
%6 = icmp ne i32* %1, null
%7 = and i1 %5, %6
%8 = icmp ne i8* %2, null
%9 = and i1 %7, %8
%10 = icmp ne i32 %3, 0
%11 = and i1 %9, %10
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
ret i32 0
}