xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ unlink(char *);
void erase_calibration() {
  printf("Erasing calibration values...\n");
  unlink("/etc/ADC-calibration.dat");
}


x86 assembly (clang, -O0):
<erase_calibration>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
lea    0xee8(%rip),%rdi
call   1030 <unlink@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<erase_calibration>:
push   %rax
lea    0xef1(%rip),%rdi
call   1040 <puts@plt>
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1030 <unlink@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Erasing calibration values...\0A\00"
@.str.1 = [25 x i8] c"/etc/ADC-calibration.dat\00"
define void @erase_calibration() {
%1 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @unlink(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [25 x i8] c"/etc/ADC-calibration.dat\00"
@str = [30 x i8] c"Erasing calibration values...\00"
define void @erase_calibration() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @unlink(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int fun2(int n) {
  if (n == 0)
    return n;
  return fun2(n / 10) + n % 10;
}


x86 assembly (clang, -O0):
<fun2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1130 <fun2+0x20>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1158 <fun2+0x48>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <fun2@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun2>:
xor    %eax,%eax
test   %edi,%edi
je     113b <fun2+0x3b>
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %esi,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <fun2+0x10>
ret

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

LLVM IR (-O2):
define i32 @fun2(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ %0, %1 ]
%5 = phi i32 [ %8, %3 ], [ 0, %1 ]
%6 = sdiv i32 %4, 10
%7 = srem i32 %4, 10
%8 = add nsw i32 %7, %5
%9 = add i32 %4, 9
%10 = icmp ult i32 %9, 19
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ coro_yield(int /*<<< orphan*/ *);
void *coro(void *arg) {
  while (1)
    coro_yield(NULL);
  return NULL;
}


x86 assembly (clang, -O0):
<coro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1030 <coro_yield@plt>
jmp    111c <coro+0xc>

x86 assembly (clang, -O2):
<coro>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
call   1030 <coro_yield@plt>
jmp    1120 <coro+0x10>

LLVM IR (-O0):
define i8* @coro(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
%4 = call i32 @coro_yield(i32* null)
br label %3
}

LLVM IR (-O2):
define noalias i8* @coro(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 @coro_yield(i32* null)
br label %2
}
int test_imm_F7int8_reg(signed char val) {
  return ((val) & (0xF7 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_F7int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xf7,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_F7int8_reg>:
test   $0xf7,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_F7int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, 247
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_F7int8_reg(i8 signext %0) {
%2 = and i8 %0, -9
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, unsigned char);
int main(void) {
  char c;
  unsigned char d = 0xFF;
  for (c = 0; c < d; c++) {
    printf("Again! c = %i < d = %i ??? \n", c, d);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0xff,-0x6(%rbp)
movb   $0x0,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
movzbl -0x6(%rbp),%ecx
cmp    %ecx,%eax
jge    115a <main+0x4a>
mov    -0x5(%rbp),%al
lea    0xebf(%rip),%rdi
movsbl %al,%esi
movzbl -0x6(%rbp),%edx
call   1030 <printf@plt>
mov    -0x5(%rbp),%al
add    $0x1,%al
mov    %al,-0x5(%rbp)
jmp    1127 <main+0x17>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
nopl   (%rax)
movsbl %bl,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0xff,%edx
call   1030 <printf@plt>
add    $0x1,%bl
jmp    1120 <main+0x10>

LLVM IR (-O0):
@.str = [29 x i8] c"Again! c = %i < d = %i ??? \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i8
store i32 0, i32* %1
store i8 -1, i8* %3
store i8 0, i8* %2
br label %4
4: ; preds = %14, %0
%5 = load i8, i8* %2
%6 = sext i8 %5 to i32
%7 = load i8, i8* %3
%8 = zext i8 %7 to i32
%9 = icmp slt i32 %6, %8
br i1 %9, label %10, label %17
10: ; preds = %4
%11 = load i8, i8* %2
%12 = load i8, i8* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8 signext %11, i8 zeroext %12)
br label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = add i8 %15, 1
store i8 %16, i8* %2
br label %4
17: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Again! c = %i < d = %i ??? \0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i8 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8 signext %2, i8 zeroext -1)
%4 = add i8 %2, 1
br label %1
}
void f15(a18, a19) register int a18;
struct file *a19;
{
}


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

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

LLVM IR (-O0):
%struct.file = type opaque
define void @f15(i32 %0, %struct.file* %1) {
%3 = alloca i32
%4 = alloca %struct.file*
store i32 %0, i32* %3
store %struct.file* %1, %struct.file** %4
ret void
}

LLVM IR (-O2):
%struct.file = type opaque
define void @f15(i32 %0, %struct.file* nocapture %1) {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ do_cpuid(int /*<<< orphan*/, int *);
bool cpu_isamd(void) {
  uint32_t regs[4];
  do_cpuid(0, regs);
  if ((regs[1] == 0x68747541) && (regs[2] == 0x444d4163) &&
      (regs[3] == 0x69746e65))
    return true;
  return false;
}


x86 assembly (clang, -O0):
<cpu_isamd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1030 <do_cpuid@plt>
cmpl   $0x68747541,-0x1c(%rbp)
jne    1156 <cpu_isamd+0x46>
cmpl   $0x444d4163,-0x18(%rbp)
jne    1156 <cpu_isamd+0x46>
cmpl   $0x69746e65,-0x14(%rbp)
jne    1156 <cpu_isamd+0x46>
movl   $0x1,-0x4(%rbp)
jmp    115d <cpu_isamd+0x4d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_isamd>:
sub    $0x18,%rsp
mov    %rsp,%rsi
xor    %edi,%edi
call   1030 <do_cpuid@plt>
mov    $0x68747541,%eax
xor    0x4(%rsp),%eax
mov    $0x444d4163,%ecx
xor    0x8(%rsp),%ecx
mov    $0x69746e65,%edx
xor    0xc(%rsp),%edx
or     %eax,%ecx
xor    %eax,%eax
or     %ecx,%edx
sete   %al
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @cpu_isamd() {
%1 = alloca i32
%2 = alloca [4 x i32]
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%4 = call i32 @do_cpuid(i32 0, i32* %3)
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 1
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 1752462657
br i1 %7, label %8, label %17
8: ; preds = %0
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 2
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 1145913699
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 3
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 1769238117
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 1, i32* %1
br label %18
17: ; preds = %12, %8, %0
store i32 0, i32* %1
br label %18
18: ; preds = %17, %16
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
define i32 @cpu_isamd() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @do_cpuid(i32 0, i32* %3)
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 1752462657
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%9 = load i32, i32* %8
%10 = icmp eq i32 %9, 1145913699
%11 = select i1 %7, i1 %10, i1 false
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 3
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, 1769238117
%15 = select i1 %11, i1 %14, i1 false
%16 = zext i1 %15 to i32
ret i32 %16
}
/* Variables and functions */
int strtol(char const *, char **, int);
int atoiv(char const *arg, int def) {
  if (!arg)
    return def;
  char *endptr;
  int val = strtol(arg, &endptr, 10);
  if (arg == endptr)
    return def;
  return val;
}


x86 assembly (clang, -O0):
<atoiv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1135 <atoiv+0x25>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <atoiv+0x59>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
jne    1163 <atoiv+0x53>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1169 <atoiv+0x59>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atoiv>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
test   %rdi,%rdi
je     1131 <atoiv+0x21>
mov    %rdi,%rbx
mov    %rsp,%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
cmp    %rbx,(%rsp)
cmovne %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @atoiv(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = icmp eq i8* %0, null
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = bitcast i8** %3 to i8*
%7 = call i32 @strtol(i8* %0, i8** %3, i32 10)
%8 = load i8*, i8** %3
%9 = icmp eq i8* %8, %0
%10 = select i1 %9, i32 %1, i32 %7
br label %11
11: ; preds = %2, %5
%12 = phi i32 [ %10, %5 ], [ %1, %2 ]
ret i32 %12
}
/* Type definitions */
typedef void uint8_t;
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ stl_be_p(void *, int);
void stq_be_p(void *ptr, uint64_t v) {
  stl_be_p(ptr, v >> 32);
  stl_be_p((uint8_t *)ptr + 4, v);
}


x86 assembly (clang, -O0):
<stq_be_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x20,%ecx
sar    %cl,%esi
call   1030 <stl_be_p@plt>
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    -0xc(%rbp),%esi
call   1030 <stl_be_p@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stq_be_p>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <stl_be_p@plt>
add    $0x4,%rbx
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <stl_be_p@plt>

LLVM IR (-O0):
define void @stq_be_p(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = ashr i32 %6, 32
%8 = call i32 @stl_be_p(i8* %5, i32 %7)
%9 = load i8*, i8** %3
%10 = getelementptr i8, i8* %9, i64 4
%11 = load i32, i32* %4
%12 = call i32 @stl_be_p(i8* %10, i32 %11)
ret void
}

LLVM IR (-O2):
define void @stq_be_p(i8* %0, i32 %1) {
%3 = tail call i32 @stl_be_p(i8* %0, i32 poison)
%4 = getelementptr i8, i8* %0, i64 4
%5 = tail call i32 @stl_be_p(i8* %4, i32 %1)
ret void
}
/* Type definitions */
struct tml_doc {
  int dummy;
};

/* Variables and functions */
size_t strlen(char const *);
struct tml_doc *tml_parse_memory(char const *, size_t);
struct tml_doc *tml_parse_string(const char *str) {
  size_t len = strlen(str);
  return tml_parse_memory(str, len);
}


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

x86 assembly (clang, -O2):
<tml_parse_string>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1040 <tml_parse_memory@plt>

LLVM IR (-O0):
%struct.tml_doc = type { i32 }
define %struct.tml_doc* @tml_parse_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
store i64 %5, i64* %3
%6 = load i8*, i8** %2
%7 = load i64, i64* %3
%8 = call %struct.tml_doc* @tml_parse_memory(i8* %6, i64 %7)
ret %struct.tml_doc* %8
}

LLVM IR (-O2):
%struct.tml_doc = type { i32 }
define %struct.tml_doc* @tml_parse_string(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = tail call %struct.tml_doc* @tml_parse_memory(i8* %0, i64 %2)
ret %struct.tml_doc* %3
}
void vtDrawBorders() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
void writeFile(const char *s) {
  FILE *fp;
  fp = fopen("test.txt", "w+");
  fprintf(fp, "%s\n", s);
  fclose(fp);
}


x86 assembly (clang, -O0):
<writeFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
lea    0xebf(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xeaa(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeFile>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xec2(%rip),%rdi
lea    0xec4(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xeb8(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"test.txt\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define void @writeFile(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = load i8*, i8** %2
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = load i32*, i32** %3
%9 = call i32 @fclose(i32* %8)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"test.txt\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define void @writeFile(i8* %0) {
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%4 = tail call i32 @fclose(i32* %2)
ret void
}
/* Type definitions */
struct tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int sexit(char **command, struct tm start) {
  printf("Goodbye!\n");
  return 0;
}


x86 assembly (clang, -O0):
<sexit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %esi,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sexit>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [10 x i8] c"Goodbye!\0A\00"
define i32 @sexit(i8** %0, i32 %1) {
%3 = alloca %struct.tm
%4 = alloca i8**
%5 = getelementptr inbounds %struct.tm, %struct.tm* %3, i32 0, i32 0
store i32 %1, i32* %5
store i8** %0, i8*** %4
%6 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [9 x i8] c"Goodbye!\00"
define i32 @sexit(i8** nocapture readnone %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void printint(int n) {}


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

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

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

LLVM IR (-O2):
define void @printint(i32 %0) {
ret void
}
unsigned short rotl16(unsigned short val, int count) {
  count &= 15;
  return (val << count) | (val >> (16 - count));
}


x86 assembly (clang, -O0):
<rotl16>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x8(%rbp)
movzwl -0x2(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
movzwl -0x2(%rbp),%edx
mov    $0x10,%ecx
sub    -0x8(%rbp),%ecx
sar    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotl16>:
mov    %esi,%ecx
mov    %edi,%eax
rol    %cl,%ax
ret

LLVM IR (-O0):
define zeroext i16 @rotl16(i16 zeroext %0, i32 %1) {
%3 = alloca i16
%4 = alloca i32
store i16 %0, i16* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, 15
store i32 %6, i32* %4
%7 = load i16, i16* %3
%8 = zext i16 %7 to i32
%9 = load i32, i32* %4
%10 = shl i32 %8, %9
%11 = load i16, i16* %3
%12 = zext i16 %11 to i32
%13 = load i32, i32* %4
%14 = sub nsw i32 16, %13
%15 = ashr i32 %12, %14
%16 = or i32 %10, %15
%17 = trunc i32 %16 to i16
ret i16 %17
}

LLVM IR (-O2):
define zeroext i16 @rotl16(i16 zeroext %0, i32 %1) {
%3 = trunc i32 %1 to i16
%4 = tail call i16 @llvm.fshl.i16(i16 %0, i16 %0, i16 %3)
ret i16 %4
}
void __hard_fault_handler() {
  for (;;) {
    __asm__ volatile("nop");
  }
}


x86 assembly (clang, -O0):
<__hard_fault_handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <__hard_fault_handler+0x9>
nop
jmp    1109 <__hard_fault_handler+0x9>

x86 assembly (clang, -O2):
<__hard_fault_handler>:
nop
jmp    1100 <__hard_fault_handler>

LLVM IR (-O0):
define void @__hard_fault_handler() {
br label %1
1: ; preds = %1, %0
br label %1
}

LLVM IR (-O2):
define void @__hard_fault_handler() {
br label %1
1: ; preds = %1, %0
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ uart_send_crlf();
int /*<<< orphan*/ uart_send_string(char *);
void send_bye(void) {
  uart_send_string("BYE");
  uart_send_crlf();
}


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

x86 assembly (clang, -O2):
<send_bye>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <uart_send_string@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <uart_send_crlf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"BYE\00"
define void @send_bye() {
%1 = call i32 @uart_send_string(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @uart_send_crlf()
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"BYE\00"
define void @send_bye() {
%1 = tail call i32 @uart_send_string(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @uart_send_crlf()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_find_next_prime(int);
int /*<<< orphan*/ ft_putchar(char);
int main() {
  ft_find_next_prime(62);
  ft_putchar('\n');
  return (0);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3e,%edi
call   1040 <ft_find_next_prime@plt>
mov    $0xa,%edi
call   1030 <ft_putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @ft_find_next_prime(i32 62)
%3 = call i32 @ft_putchar(i8 signext 10)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @ft_find_next_prime(i32 62)
%2 = tail call i32 @ft_putchar(i8 signext 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_usege() {
  fprintf(stderr, "Usege: genkey [key_file]\n"
                  "if no key_file named (or if a single hyphen-minus (-)"
                  " is given as a key_file) stdout is used\n");
}


x86 assembly (clang, -O0):
<print_usege>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usege>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [119 x i8] c"Usege: genkey [key_file]\0Aif no key_file named (or if a single hyphen-minus (-) is given as a key_file) stdout is used\0A\00"
define void @print_usege() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [119 x i8] c"Usege: genkey [key_file]\0Aif no key_file named (or if a single hyphen-minus (-) is given as a key_file) stdout is used\0A\00"
define void @print_usege() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str, i64 0, i64 0))
ret void
}
int checksum(int arr[], int size, int sum, int j) {
  if (j > size)
    return 0;
  else {
  }
}


x86 assembly (clang, -O0):
<checksum>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1129 <checksum+0x29>
movl   $0x0,-0x4(%rbp)
jmp    112e <checksum+0x2e>
jmp    112e <checksum+0x2e>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @checksum(i32* nocapture readnone %0, i32 %1, i32 %2, i32 %3) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long long, unsigned long long, ...);
void Test(long long Val, int Amt) {
  printf("0x%llx op %d:\n", Val, Amt);
  printf("  ashr: 0x%llx\n  lshr: 0x%llx\n  shl: 0x%llx\n", Val >> Amt,
         (unsigned long long)Val >> Amt, Val << Amt);
}


x86 assembly (clang, -O0):
<Test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rdx
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
sar    %cl,%rsi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
shr    %cl,%rdx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shl    %cl,%rax
mov    %rax,%rcx
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Test>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movslq %esi,%r14
lea    0xedf(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rsi
mov    %r14d,%ecx
sar    %cl,%rsi
mov    %rbx,%rdx
shr    %cl,%rdx
shl    %cl,%rbx
lea    0xec8(%rip),%rdi
mov    %rbx,%rcx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"0x%llx op %d:\0A\00"
@.str.1 = [45 x i8] c" ashr: 0x%llx\0A lshr: 0x%llx\0A shl: 0x%llx\0A\00"
define void @Test(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64 %5, i64 %7)
%9 = load i64, i64* %3
%10 = load i32, i32* %4
%11 = zext i32 %10 to i64
%12 = ashr i64 %9, %11
%13 = load i64, i64* %3
%14 = load i32, i32* %4
%15 = zext i32 %14 to i64
%16 = lshr i64 %13, %15
%17 = load i64, i64* %3
%18 = load i32, i32* %4
%19 = zext i32 %18 to i64
%20 = shl i64 %17, %19
%21 = call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i64 %12, i64 %16, i64 %20)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"0x%llx op %d:\0A\00"
@.str.1 = [45 x i8] c" ashr: 0x%llx\0A lshr: 0x%llx\0A shl: 0x%llx\0A\00"
define void @Test(i64 %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = tail call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64 %0, i64 %3)
%5 = zext i32 %1 to i64
%6 = ashr i64 %0, %5
%7 = lshr i64 %0, %5
%8 = shl i64 %0, %5
%9 = tail call i32 (i8*, i64, i64, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i64 %6, i64 %7, i64 %8)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ rtn;
typedef int int64_t;

/* Variables and functions */
scalar_t__ fgetxattr(int, char const *, int *, int);
int fsfr_fgetxattr_int(int fd, const char *name) {
  int64_t rtn = -1;
  if (fgetxattr(fd, name, &rtn, sizeof(rtn)) > 0)
    return (int)rtn;
  return -1;
}


x86 assembly (clang, -O0):
<fsfr_fgetxattr_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x4,%ecx
call   1030 <fgetxattr@plt>
cmp    $0x0,%rax
jle    1150 <fsfr_fgetxattr_int+0x40>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1157 <fsfr_fgetxattr_int+0x47>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsfr_fgetxattr_int>:
push   %rax
movl   $0xffffffff,0x4(%rsp)
ff
lea    0x4(%rsp),%rdx
mov    $0x4,%ecx
call   1030 <fgetxattr@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
jle    1139 <fsfr_fgetxattr_int+0x29>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @fsfr_fgetxattr_int(i32 %0, i8* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 -1, i32* %3
%5 = call i64 @fgetxattr(i32 %0, i8* %1, i32* %3, i32 4)
%6 = icmp sgt i64 %5, 0
%7 = load i32, i32* %3
%8 = select i1 %6, i32 %7, i32 -1
ret i32 %8
}
int countOnes(int bits) {
  int c = 0;
  while (bits != 0) {
    if (bits % 10 == 1)
      c++;
    bits = bits / 10;
  }
  return c;
}


x86 assembly (clang, -O0):
<countOnes>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1148 <countOnes+0x48>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x1,%edx
jne    1135 <countOnes+0x35>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <countOnes+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<countOnes>:
xor    %eax,%eax
test   %edi,%edi
je     1143 <countOnes+0x43>
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
xor    %edx,%edx
cmp    $0x1,%esi
sete   %dl
add    %edx,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <countOnes+0x10>
ret

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

LLVM IR (-O2):
define i32 @countOnes(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %13, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ 0, %1 ]
%5 = phi i32 [ %10, %3 ], [ %0, %1 ]
%6 = srem i32 %5, 10
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i32
%9 = add nuw nsw i32 %4, %8
%10 = sdiv i32 %5, 10
%11 = add i32 %5, 9
%12 = icmp ult i32 %11, 19
br i1 %12, label %13, label %3
13: ; preds = %3, %1
%14 = phi i32 [ 0, %1 ], [ %9, %3 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int m;
  for (m = 1; m < 256; m++) {
    printf("%c  %d\n", m, m);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    1153 <main+0x43>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xee0(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"%c %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 1, %0 ], [ %4, %1 ]
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 256
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
int test_imm_82int8_mem(signed char *val) {
  return ((*val) & (0x82 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_82int8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0x82,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_82int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 130
%7 = icmp ne i32 %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_82int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -126
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
char *get_env_value(varname)
char *varname;
{ return ((char *)getenv(varname)); }


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

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

LLVM IR (-O0):
define i8* @get_env_value(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @getenv to i32 (i8*, ...)*)(i8* %3)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}

LLVM IR (-O2):
define i8* @get_env_value(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @getenv to i32 (i8*, ...)*)(i8* %0)
%3 = sext i32 %2 to i64
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}
/* Variables and functions */
int kms_crypto_init();
int /*<<< orphan*/ kms_message_b64_initialize_rmap();
int kms_message_init(void) {
  kms_message_b64_initialize_rmap();
  return kms_crypto_init();
}


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

x86 assembly (clang, -O2):
<kms_message_init>:
push   %rax
xor    %eax,%eax
call   1030 <kms_message_b64_initialize_rmap@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <kms_crypto_init@plt>

LLVM IR (-O0):
define i32 @kms_message_init() {
%1 = call i32 (...) @kms_message_b64_initialize_rmap()
%2 = call i32 (...) @kms_crypto_init()
ret i32 %2
}

LLVM IR (-O2):
define i32 @kms_message_init() {
%1 = tail call i32 (...) @kms_message_b64_initialize_rmap()
%2 = tail call i32 (...) @kms_crypto_init()
ret i32 %2
}
int security_msg_queue_alloc(struct msg_queue *msq) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.msg_queue = type opaque
define i32 @security_msg_queue_alloc(%struct.msg_queue* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *, int, int, int);
void print_time(void *data, time_t now) {
  struct tm *lt = localtime(&now);
  printf("%s: %02d:%02d:%02d\n", (char *)data, lt->tm_hour, lt->tm_min,
         lt->tm_sec);
}


x86 assembly (clang, -O0):
<print_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%r8d
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_time>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %esi,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%edx
mov    0x4(%rax),%ecx
mov    0x8(%rax),%r8d
lea    0xeba(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32 }
@.str = [20 x i8] c"%s: %02d:%02d:%02d\0A\00"
define void @print_time(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca %struct.tm*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = call %struct.tm* @localtime(i32* %4)
store %struct.tm* %6, %struct.tm** %5
%7 = load i8*, i8** %3
%8 = load %struct.tm*, %struct.tm** %5
%9 = getelementptr inbounds %struct.tm, %struct.tm* %8, i32 0, i32 0
%10 = load i32, i32* %9
%11 = load %struct.tm*, %struct.tm** %5
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 1
%13 = load i32, i32* %12
%14 = load %struct.tm*, %struct.tm** %5
%15 = getelementptr inbounds %struct.tm, %struct.tm* %14, i32 0, i32 2
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %10, i32 %13, i32 %16)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32 }
@.str = [20 x i8] c"%s: %02d:%02d:%02d\0A\00"
define void @print_time(i8* %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call %struct.tm* @localtime(i32* %3)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%10 = load i32, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %6, i32 %8, i32 %10)
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int32_t enbyte(int32_t x) { return x & 0x000000ff; }


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

x86 assembly (clang, -O2):
<enbyte>:
movzbl %dil,%eax
ret

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

LLVM IR (-O2):
define i32 @enbyte(i32 %0) {
%2 = and i32 %0, 255
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void tell(char *s) { write(2, s, strlen(s)); }


x86 assembly (clang, -O0):
<tell>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x2,%edi
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tell>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1030 <write@plt>

LLVM IR (-O0):
define void @tell(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @strlen(i8* %4)
%6 = call i32 @write(i32 2, i8* %3, i32 %5)
ret void
}

LLVM IR (-O2):
define void @tell(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @write(i32 2, i8* %0, i32 %2)
ret void
}
int execve(char *name, char **argv, char **env) { return -1; }


x86 assembly (clang, -O0):
<execve>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @execve(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
ret i32 -1
}

LLVM IR (-O2):
define i32 @execve(i8* nocapture readnone %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
ret i32 -1
}
void abcdefghijk7lmnopqrstuvwxzy() {}


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

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

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

LLVM IR (-O2):
define void @abcdefghijk7lmnopqrstuvwxzy() {
ret void
}
char othercase(ch)
int ch;
{
  assert(isalpha(ch));
  if (isupper(ch))
    return (tolower(ch));
  else if (islower(ch))
    return (toupper(ch));
  else
    return (ch);
}


x86 assembly (clang, -O0):
<othercase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1070 <isalpha@plt>
mov    %eax,%edi
mov    $0x0,%al
call   1050 <assert@plt>
mov    -0x8(%rbp),%edi
call   1080 <isupper@plt>
cmp    $0x0,%eax
je     119d <othercase+0x3d>
mov    -0x8(%rbp),%edi
call   1060 <tolower@plt>
mov    %al,-0x1(%rbp)
jmp    11c4 <othercase+0x64>
mov    -0x8(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%eax
je     11be <othercase+0x5e>
mov    -0x8(%rbp),%edi
call   1040 <toupper@plt>
mov    %al,-0x1(%rbp)
jmp    11c4 <othercase+0x64>
mov    -0x8(%rbp),%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<othercase>:
push   %rbx
mov    %edi,%ebx
call   1070 <isalpha@plt>
mov    %eax,%edi
xor    %eax,%eax
call   1050 <assert@plt>
mov    %ebx,%edi
call   1080 <isupper@plt>
test   %eax,%eax
je     1185 <othercase+0x25>
mov    %ebx,%edi
call   1060 <tolower@plt>
jmp    1197 <othercase+0x37>
mov    %ebx,%edi
call   1030 <islower@plt>
test   %eax,%eax
je     1199 <othercase+0x39>
mov    %ebx,%edi
call   1040 <toupper@plt>
mov    %eax,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @othercase(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 @isalpha(i32 %4)
%6 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %5)
%7 = load i32, i32* %3
%8 = call i32 @isupper(i32 %7)
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = load i32, i32* %3
%12 = call i32 @tolower(i32 %11)
%13 = trunc i32 %12 to i8
store i8 %13, i8* %2
br label %25
14: ; preds = %1
%15 = load i32, i32* %3
%16 = call i32 @islower(i32 %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i32, i32* %3
%20 = call i32 @toupper(i32 %19)
%21 = trunc i32 %20 to i8
store i8 %21, i8* %2
br label %25
22: ; preds = %14
%23 = load i32, i32* %3
%24 = trunc i32 %23 to i8
store i8 %24, i8* %2
br label %25
25: ; preds = %22, %18, %10
%26 = load i8, i8* %2
ret i8 %26
}

LLVM IR (-O2):
define signext i8 @othercase(i32 %0) {
%2 = tail call i32 @isalpha(i32 %0)
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %2)
%4 = tail call i32 @isupper(i32 %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %1
%7 = tail call i32 @tolower(i32 %0)
br label %13
8: ; preds = %1
%9 = tail call i32 @islower(i32 %0)
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = tail call i32 @toupper(i32 %0)
br label %13
13: ; preds = %8, %11, %6
%14 = phi i32 [ %7, %6 ], [ %12, %11 ], [ %0, %8 ]
%15 = trunc i32 %14 to i8
ret i8 %15
}
/* Variables and functions */
int /*<<< orphan*/ events_network_shutdown();
int /*<<< orphan*/ events_timer_shutdown();
void events_shutdown(void) {
  events_network_shutdown();
  events_timer_shutdown();
}


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

x86 assembly (clang, -O2):
<events_shutdown>:
push   %rax
xor    %eax,%eax
call   1030 <events_network_shutdown@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <events_timer_shutdown@plt>

LLVM IR (-O0):
define void @events_shutdown() {
%1 = call i32 (...) @events_network_shutdown()
%2 = call i32 (...) @events_timer_shutdown()
ret void
}

LLVM IR (-O2):
define void @events_shutdown() {
%1 = tail call i32 (...) @events_network_shutdown()
%2 = tail call i32 (...) @events_timer_shutdown()
ret void
}
void recurse(int param) {
  int numbers[10240] = {10};
  recurse(param + numbers[0]);
}


x86 assembly (clang, -O0):
<recurse>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa010,%rsp
mov    %edi,-0x4(%rbp)
lea    -0xa010(%rbp),%rdi
xor    %esi,%esi
mov    $0xa000,%edx
call   1040 <memset@plt>
movl   $0xa,-0xa010(%rbp)
mov    -0x4(%rbp),%edi
add    -0xa010(%rbp),%edi
call   1030 <recurse@plt>
add    $0xa010,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recurse>:
jmp    1100 <recurse>

LLVM IR (-O0):
define void @recurse(i32 %0) {
%2 = alloca i32
%3 = alloca [10240 x i32]
store i32 %0, i32* %2
%4 = bitcast [10240 x i32]* %3 to i8*
%5 = bitcast i8* %4 to <{ i32, [10239 x i32] }>*
%6 = getelementptr inbounds <{ i32, [10239 x i32] }>, <{ i32, [10239 x i32] }>* %5, i32 0, i32 0
store i32 10, i32* %6
%7 = load i32, i32* %2
%8 = getelementptr inbounds [10240 x i32], [10240 x i32]* %3, i64 0, i64 0
%9 = load i32, i32* %8
%10 = add nsw i32 %7, %9
ret void
}

LLVM IR (-O2):
define void @recurse(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
int _create_get_raw_encoders(long *lenc, long *renc) {}


x86 assembly (clang, -O0):
<_create_get_raw_encoders>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @_create_get_raw_encoders(i64* nocapture readnone %0, i64* nocapture readnone %1) {
ret i32 undef
}