xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fatal(char *);
void *malloc(size_t);
void *realloc(void *, size_t);
void *srealloc(void *p, size_t size) {
  void *q;
  if (p) {
    q = realloc(p, size);
  } else {
    q = malloc(size);
  }
  if (!q)
    fatal("out of memory");
  return q;
}


x86 assembly (clang, -O0):
<srealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1161 <srealloc+0x31>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
jmp    116e <srealloc+0x3e>
mov    -0x10(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1185 <srealloc+0x55>
lea    0xe80(%rip),%rdi
call   1050 <fatal@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<srealloc>:
push   %rbx
test   %rdi,%rdi
je     113d <srealloc+0xd>
call   1040 <realloc@plt>
jmp    1145 <srealloc+0x15>
mov    %rsi,%rdi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1159 <srealloc+0x29>
lea    0xeac(%rip),%rdi
call   1050 <fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"out of memory\00"
define i8* @srealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
%11 = call i8* @realloc(i8* %9, i64 %10)
store i8* %11, i8** %5
br label %15
12: ; preds = %2
%13 = load i64, i64* %4
%14 = call i8* @malloc(i64 %13)
store i8* %14, i8** %5
br label %15
15: ; preds = %12, %8
%16 = load i8*, i8** %5
%17 = icmp ne i8* %16, null
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = call i32 @fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
%21 = load i8*, i8** %5
ret i8* %21
}

LLVM IR (-O2):
@.str = [14 x i8] c"out of memory\00"
define i8* @srealloc(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i8* @realloc(i8* %0, i64 %1)
br label %8
6: ; preds = %2
%7 = tail call i8* @malloc(i64 %1)
br label %8
8: ; preds = %6, %4
%9 = phi i8* [ %5, %4 ], [ %7, %6 ]
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %8
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "Usage [-d][-p PORT][-t TIMEOUT] <device>\n");
  fprintf(stderr,
          "Where <device> is /dev/ttyUSB0:9600:8N1 or localhost:5000\n");
  exit(2);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xee1(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xeeb(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [42 x i8] c"Usage [-d][-p PORT][-t TIMEOUT] <device>\0A\00"
@.str.1 = [59 x i8] c"Where <device> is /dev/ttyUSB0:9600:8N1 or localhost:5000\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [42 x i8] c"Usage [-d][-p PORT][-t TIMEOUT] <device>\0A\00"
@.str.1 = [59 x i8] c"Where <device> is /dev/ttyUSB0:9600:8N1 or localhost:5000\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @exit(i32 2)
unreachable
}
/* Type definitions */
typedef char *int64_t;

/* Variables and functions */
int64_t syscall_spawn(const char *file, int argc, const char *const *argv) {
  int64_t ret;
  __asm__ volatile("syscall"
                   : "=a"(ret)
                   : "a"(0x5), "D"(file), "S"(argc), "d"(argv)
                   : "%rcx", "%r11");
  return ret;
}


x86 assembly (clang, -O0):
<syscall_spawn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    $0x5,%eax
syscall
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscall_spawn>:
mov    $0x5,%eax
syscall
ret

LLVM IR (-O0):
define i8* @syscall_spawn(i8* %0, i32 %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = load i8**, i8*** %6
%11 = call i8* asm sideeffect "syscall", "={ax},{ax},{di},{si},{dx},~{rcx},~{r11},~{dirflag},~{fpsr},~{flags}"(i32 5, i8* %8, i32 %9, i8** %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %7
ret i8* %12
}

LLVM IR (-O2):
define i8* @syscall_spawn(i8* %0, i32 %1, i8** %2) {
%4 = tail call i8* asm sideeffect "syscall", "={ax},{ax},{di},{si},{dx},~{rcx},~{r11},~{dirflag},~{fpsr},~{flags}"(i32 5, i8* %0, i32 %1, i8** %2)
ret i8* %4
}
void sleep(unsigned int msec) {
  asm("int %2" : : "a"(7), "b"(msec), "i"(0x80));
}


x86 assembly (clang, -O0):
<sleep>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%ebx
mov    $0x7,%eax
int    $0x80
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleep>:
push   %rbx
mov    %edi,%ebx
mov    $0x7,%eax
int    $0x80
pop    %rbx
ret

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

LLVM IR (-O2):
define void @sleep(i32 %0) {
tail call void asm sideeffect "int $2", "{ax},{bx},i,~{dirflag},~{fpsr},~{flags}"(i32 7, i32 %0, i32 128)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("Usage: wlan_interleaver_gentab [OPTION]\n");
  printf("  h     : print help\n");
  printf("  r     : rate {6,9,12,18,24,36,48,54} M bits/s\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xf02(%rip),%rdi
call   1030 <printf@plt>
lea    0xf0c(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
lea    0xf0d(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Usage: wlan_interleaver_gentab [OPTION]\0A\00"
@.str.1 = [22 x i8] c" h : print help\0A\00"
@.str.2 = [49 x i8] c" r : rate {6,9,12,18,24,36,48,54} M bits/s\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [40 x i8] c"Usage: wlan_interleaver_gentab [OPTION]\00"
@str.3 = [21 x i8] c" h : print help\00"
@str.4 = [48 x i8] c" r : rate {6,9,12,18,24,36,48,54} M bits/s\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Type definitions */
struct lb_header {
  int dummy;
};

/* Variables and functions */
struct lb_header *__find_lb_table(int, int);
struct lb_header *find_lb_table(void) {
  struct lb_header *head;
  head = 0;
  if (!head) {
    head = __find_lb_table(0x00000, 0x1000);
  }
  if (!head) {
    head = __find_lb_table(0xf0000, 0x100000);
  }
  return head;
}


x86 assembly (clang, -O0):
<find_lb_table>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113b <find_lb_table+0x2b>
xor    %edi,%edi
mov    $0x1000,%esi
call   1030 <__find_lb_table@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1159 <find_lb_table+0x49>
mov    $0xf0000,%edi
mov    $0x100000,%esi
call   1030 <__find_lb_table@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_lb_table>:
push   %rax
xor    %edi,%edi
mov    $0x1000,%esi
call   1030 <__find_lb_table@plt>
test   %rax,%rax
je     1124 <find_lb_table+0x14>
pop    %rcx
ret
mov    $0xf0000,%edi
mov    $0x100000,%esi
pop    %rax
jmp    1030 <__find_lb_table@plt>

LLVM IR (-O0):
%struct.lb_header = type { i32 }
define %struct.lb_header* @find_lb_table() {
%1 = alloca %struct.lb_header*
store %struct.lb_header* null, %struct.lb_header** %1
%2 = load %struct.lb_header*, %struct.lb_header** %1
%3 = icmp ne %struct.lb_header* %2, null
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = call %struct.lb_header* @__find_lb_table(i32 0, i32 4096)
store %struct.lb_header* %5, %struct.lb_header** %1
br label %6
6: ; preds = %4, %0
%7 = load %struct.lb_header*, %struct.lb_header** %1
%8 = icmp ne %struct.lb_header* %7, null
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = call %struct.lb_header* @__find_lb_table(i32 983040, i32 1048576)
store %struct.lb_header* %10, %struct.lb_header** %1
br label %11
11: ; preds = %9, %6
%12 = load %struct.lb_header*, %struct.lb_header** %1
ret %struct.lb_header* %12
}

LLVM IR (-O2):
%struct.lb_header = type { i32 }
define %struct.lb_header* @find_lb_table() {
%1 = tail call %struct.lb_header* @__find_lb_table(i32 0, i32 4096)
%2 = icmp eq %struct.lb_header* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call %struct.lb_header* @__find_lb_table(i32 983040, i32 1048576)
br label %5
5: ; preds = %3, %0
%6 = phi %struct.lb_header* [ %1, %0 ], [ %4, %3 ]
ret %struct.lb_header* %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void factors(int x) {
  int i;
  for (i = 1; i <= x; i++) {
    if (x % i == 0) {
      printf("%d", i);
    }
  }
}


x86 assembly (clang, -O0):
<factors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1160 <factors+0x50>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    114d <factors+0x3d>
mov    -0x8(%rbp),%esi
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
jmp    1152 <factors+0x42>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <factors+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<factors>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edi,%edi
jle    1158 <factors+0x48>
mov    %edi,%r15d
mov    %edi,%ebp
neg    %ebp
mov    $0x1,%ebx
lea    0xed2(%rip),%r14
jmp    1142 <factors+0x32>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
je     1158 <factors+0x48>
mov    %r15d,%eax
cltd
idiv   %ebx
test   %edx,%edx
jne    1130 <factors+0x20>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1130 <factors+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @factors(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %12, label %3
3: ; preds = %1, %9
%4 = phi i32 [ %10, %9 ], [ 1, %1 ]
%5 = srem i32 %0, %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %9
9: ; preds = %3, %7
%10 = add nuw i32 %4, 1
%11 = icmp eq i32 %4, %0
br i1 %11, label %12, label %3
12: ; preds = %9, %1
ret void
}
void purgeandquit(n) int n;
{
  purge();
  quit();
}


x86 assembly (clang, -O0):
<purgeandquit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <purge@plt>
mov    $0x0,%al
call   1030 <quit@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @purgeandquit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @purge()
%4 = call i32 (...) @quit()
ret void
}

LLVM IR (-O2):
define void @purgeandquit(i32 %0) {
%2 = tail call i32 (...) @purge()
%3 = tail call i32 (...) @quit()
ret void
}
/* Variables and functions */
long double fmod(long double, long double);
long double fmodl(long double x, long double y) { return fmod(x, y); }


x86 assembly (clang, -O0):
<fmodl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x10(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
call   1030 <fmod@plt>
fld    %st(0)
fstp   %st(0)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmodl>:
jmp    1030 <fmod@plt>

LLVM IR (-O0):
define x86_fp80 @fmodl(x86_fp80 %0, x86_fp80 %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %3
store x86_fp80 %1, x86_fp80* %4
%5 = load x86_fp80, x86_fp80* %3
%6 = load x86_fp80, x86_fp80* %4
%7 = call x86_fp80 @fmod(x86_fp80 %5, x86_fp80 %6)
ret x86_fp80 %7
}

LLVM IR (-O2):
define x86_fp80 @fmodl(x86_fp80 %0, x86_fp80 %1) {
%3 = tail call x86_fp80 @fmod(x86_fp80 %0, x86_fp80 %1)
ret x86_fp80 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ u_int64_t;

/* Variables and functions */
int /*<<< orphan*/ store_ntohll(int /*<<< orphan*/);
u_int64_t store_swp_ntoh64(u_int64_t v) { return store_ntohll(v); }


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

x86 assembly (clang, -O2):
<store_swp_ntoh64>:
jmp    1030 <store_ntohll@plt>

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

LLVM IR (-O2):
define i32 @store_swp_ntoh64(i32 %0) {
%2 = tail call i32 @store_ntohll(i32 %0)
ret i32 %2
}
int main() {
  int arr[2];
  int *p;
  p = &arr[1];
  *p = 0;
  return arr[1];
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ close(int);
int open(char *, int /*<<< orphan*/);
int sprintf(char *, char *, int);
int /*<<< orphan*/ write(int, char *, int);
void sysfs_set_value(char *fname, int val) {
  char buf[64];
  int fd = open(fname, O_WRONLY);
  int sz = sprintf(buf, "%d\n", val);
  write(fd, buf, sz);
  close(fd);
}


x86 assembly (clang, -O0):
<sysfs_set_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e7e(%rip),%rax
mov    (%rax),%esi
call   1050 <open@plt>
mov    %eax,-0x54(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xe8e(%rip),%rsi
call   1060 <sprintf@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%edi
lea    -0x50(%rbp),%rsi
mov    -0x58(%rbp),%edx
call   1030 <write@plt>
mov    -0x54(%rbp),%edi
call   1040 <close@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sysfs_set_value>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %esi,%ebx
mov    0x2e87(%rip),%rax
mov    (%rax),%esi
call   1050 <open@plt>
mov    %eax,%ebp
lea    0xe9f(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %ebx,%edx
call   1060 <sprintf@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %ebp,%edi
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <close@plt>

LLVM IR (-O0):
@O_WRONLY = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define void @sysfs_set_value(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [64 x i8]
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%8 = load i8*, i8** %3
%9 = load i32, i32* @O_WRONLY
%10 = call i32 @open(i8* %8, i32 %9)
store i32 %10, i32* %6
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%12 = load i32, i32* %4
%13 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %12)
store i32 %13, i32* %7
%14 = load i32, i32* %6
%15 = getelementptr inbounds [64 x i8], [64 x i8]* %5, i64 0, i64 0
%16 = load i32, i32* %7
%17 = call i32 @write(i32 %14, i8* %15, i32 %16)
%18 = load i32, i32* %6
%19 = call i32 @close(i32 %18)
ret void
}

LLVM IR (-O2):
@O_WRONLY = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define void @sysfs_set_value(i8* nocapture %0, i32 %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* @O_WRONLY
%6 = tail call i32 @open(i8* %0, i32 %5)
%7 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%8 = call i32 @write(i32 %6, i8* %4, i32 %7)
%9 = tail call i32 @close(i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
char *strdup(char const *);
char *xstrdup(const char *str) {
  char *ret = strdup(str);
  if (!ret) {
    ;
    ret = strdup(str);
    if (!ret)
      die("Out of memory, strdup failed");
  }
  return ret;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    116d <xstrdup+0x4d>
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1168 <xstrdup+0x48>
lea    0xe9d(%rip),%rdi
call   1030 <die@plt>
jmp    116d <xstrdup+0x4d>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strdup@plt>
test   %rax,%rax
je     1130 <xstrdup+0x10>
pop    %rbx
ret
mov    %rbx,%rdi
call   1040 <strdup@plt>
test   %rax,%rax
jne    112e <xstrdup+0xe>
lea    0xebc(%rip),%rdi
call   1030 <die@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Out of memory, strdup failed\00"
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strdup(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %16, label %8
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i8* @strdup(i8* %9)
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = icmp ne i8* %11, null
br i1 %12, label %15, label %13
13: ; preds = %8
%14 = call i32 @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %8
br label %16
16: ; preds = %15, %1
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@.str = [29 x i8] c"Out of memory, strdup failed\00"
define noalias i8* @xstrdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = tail call i8* @strdup(i8* %0)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @die(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %4, %7, %1
%10 = phi i8* [ %2, %1 ], [ %5, %4 ], [ null, %7 ]
ret i8* %10
}
/* Type definitions */
struct timeval {
  double tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
double tmr_get_timestamp(void) {
  struct timeval tv;
  gettimeofday(&tv, 0);
  return tv.tv_sec + tv.tv_usec / 1e6;
}


x86 assembly (clang, -O0):
<tmr_get_timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xecb(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tmr_get_timestamp>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdl 0x10(%rsp),%xmm0
divsd  0xed2(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, i32 }
define double @tmr_get_timestamp() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load i32, i32* %5
%7 = sitofp i32 %6 to double
%8 = fdiv double %7, 1.000000e+06
%9 = fadd double %4, %8
ret double %9
}

LLVM IR (-O2):
%struct.timeval = type { double, i32 }
define double @tmr_get_timestamp() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i32, i32* %6
%8 = sitofp i32 %7 to double
%9 = fdiv double %8, 1.000000e+06
%10 = fadd double %5, %9
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ debug_windows_tree();
int debug_windows_cb(void *data, const char *signal, const char *type_data,
                     void *signal_data) {
  (void)data;
  (void)signal;
  (void)type_data;
  (void)signal_data;
  debug_windows_tree();
  return 0;
}


x86 assembly (clang, -O0):
<debug_windows_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0x0,%al
call   1030 <debug_windows_tree@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @debug_windows_cb(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i8*, i8** %7
%12 = load i8*, i8** %8
%13 = call i32 (...) @debug_windows_tree()
ret i32 0
}

LLVM IR (-O2):
define i32 @debug_windows_cb(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3) {
%5 = tail call i32 (...) @debug_windows_tree()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/);
int main() {
  int i;
  if (i == 100)
    pthread_exit(0);
  assert(i != 100);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x8(%rbp)
jne    1140 <main+0x20>
xor    %edi,%edi
call   1040 <pthread_exit@plt>
cmpl   $0x64,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 100
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @pthread_exit(i32 0)
br label %7
7: ; preds = %5, %0
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 100
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @assert(i32 0)
ret i32 0
}
/* Variables and functions */
int number_returner();
int main(int argc, char **argv) { return number_returner() == 100 ? 0 : 1; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <number_returner@plt>
mov    %eax,%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x64,%edx
cmove  %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <number_returner@plt>
xor    %ecx,%ecx
cmp    $0x64,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

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 (...) @number_returner()
%7 = icmp eq i32 %6, 100
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 0, i32 1
ret i32 %9
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @number_returner()
%4 = icmp ne i32 %3, 100
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
char const *getenv(char const *);
const char *posixGetEnv(const char *name) { return getenv(name); }


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

x86 assembly (clang, -O2):
<posixGetEnv>:
jmp    1030 <getenv@plt>

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

LLVM IR (-O2):
define i8* @posixGetEnv(i8* nocapture %0) {
%2 = tail call i8* @getenv(i8* %0)
ret i8* %2
}
void fd_delay() {
  int i;
  for (i = 0; i < 1000000; i++) {
  }
}


x86 assembly (clang, -O0):
<fd_delay>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0xf4240,-0x4(%rbp)
jge    112b <fd_delay+0x2b>
jmp    111d <fd_delay+0x1d>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <fd_delay+0xb>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @fd_delay() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PDCWrite(int, unsigned char);
void PDCGPIOWrite(unsigned char ucIdx, unsigned char ucValue) {
  ;
  if (ucIdx == 0) {
    PDCWrite(0x8, ucValue);
  } else if (ucIdx == 1) {
    PDCWrite(0xA, ucValue);
  } else {
    PDCWrite(0xC, ucValue);
  }
}


x86 assembly (clang, -O0):
<PDCGPIOWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jne    1144 <PDCGPIOWrite+0x34>
mov    $0x8,%edi
movzbl -0x2(%rbp),%esi
call   1030 <PDCWrite@plt>
jmp    1177 <PDCGPIOWrite+0x67>
movzbl -0x1(%rbp),%eax
cmp    $0x1,%eax
jne    1164 <PDCGPIOWrite+0x54>
mov    $0xa,%edi
movzbl -0x2(%rbp),%esi
call   1030 <PDCWrite@plt>
jmp    1172 <PDCGPIOWrite+0x62>
mov    $0xc,%edi
movzbl -0x2(%rbp),%esi
call   1030 <PDCWrite@plt>
jmp    1177 <PDCGPIOWrite+0x67>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PDCGPIOWrite>:
xor    %eax,%eax
cmp    $0x1,%dil
setne  %al
add    %eax,%eax
add    $0xa,%eax
test   %edi,%edi
mov    $0x8,%edi
cmovne %eax,%edi
jmp    1030 <PDCWrite@plt>

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

LLVM IR (-O2):
define void @PDCGPIOWrite(i8 zeroext %0, i8 zeroext %1) {
%3 = icmp eq i8 %0, 1
%4 = select i1 %3, i32 10, i32 12
%5 = icmp eq i8 %0, 0
%6 = select i1 %5, i32 8, i32 %4
%7 = tail call i32 @PDCWrite(i32 %6, i8 zeroext %1)
ret void
}
/* Variables and functions */
int icost(int);
int icosd(int d) { return icost(d); }


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

x86 assembly (clang, -O2):
<icosd>:
jmp    1030 <icost@plt>

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

LLVM IR (-O2):
define i32 @icosd(i32 %0) {
%2 = tail call i32 @icost(i32 %0)
ret i32 %2
}
void EVP_BytesToKey(void) {}


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

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

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

LLVM IR (-O2):
define void @EVP_BytesToKey() {
ret void
}
int main() {
  int x, y;
  if (&x > &y) {
    printf("&x > &y | %x > %x\n", &x, &y);
  } else {
    printf("&y > &x | %x > %x\n", &y, &x);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rax
lea    -0xc(%rbp),%rcx
cmp    %rcx,%rax
jbe    114b <main+0x3b>
lea    0xec9(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1161 <main+0x51>
lea    0xec1(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x8(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsp,%rax
lea    0x4(%rsp),%rcx
cmp    %rax,%rcx
jbe    112f <main+0x1f>
lea    0xedb(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
jmp    113e <main+0x2e>
lea    0xedd(%rip),%rdi
mov    %rsp,%rsi
lea    0x4(%rsp),%rdx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [19 x i8] c"&x > &y | %x > %x\0A\00"
@.str.1 = [19 x i8] c"&y > &x | %x > %x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = icmp ugt i32* %1, %2
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
br label %10
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %1)
br label %10
10: ; preds = %8, %6
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ REPORT_RESULT();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("hello, world!\n");
  int result = 0;
  REPORT_RESULT();
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"hello, world!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @REPORT_RESULT()
ret i32 0
}
/* Type definitions */
struct dirent {
  char *d_name;
};

/* Variables and functions */
int is_a_buffer(const struct dirent *d) {
  if (d->d_name[0] >= '0' && d->d_name[0] <= '9')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_a_buffer>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     113a <is_a_buffer+0x3a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jg     113a <is_a_buffer+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    1141 <is_a_buffer+0x41>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_a_buffer>:
mov    (%rdi),%rax
mov    (%rax),%cl
add    $0xd0,%cl
xor    %eax,%eax
cmp    $0xa,%cl
setb   %al
ret

LLVM IR (-O0):
%struct.dirent = type { i8* }
define i32 @is_a_buffer(%struct.dirent* %0) {
%2 = alloca i32
%3 = alloca %struct.dirent*
store %struct.dirent* %0, %struct.dirent** %3
%4 = load %struct.dirent*, %struct.dirent** %3
%5 = getelementptr inbounds %struct.dirent, %struct.dirent* %4, i32 0, i32 0
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp sge i32 %9, 48
br i1 %10, label %11, label %20
11: ; preds = %1
%12 = load %struct.dirent*, %struct.dirent** %3
%13 = getelementptr inbounds %struct.dirent, %struct.dirent* %12, i32 0, i32 0
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp sle i32 %17, 57
br i1 %18, label %19, label %20
19: ; preds = %11
store i32 1, i32* %2
br label %21
20: ; preds = %11, %1
store i32 0, i32* %2
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %2
ret i32 %22
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
define i32 @is_a_buffer(%struct.dirent* nocapture %0) {
%2 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = add i8 %4, -48
%6 = icmp ult i8 %5, 10
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_SET_CC_FIFOP_PIN() { set_io_bit(-4, 1); }


x86 assembly (clang, -O0):
<TOSH_SET_CC_FIFOP_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffffc,%edi
mov    $0x1,%esi
call   1030 <set_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_SET_CC_FIFOP_PIN>:
mov    $0xfffffffc,%edi
mov    $0x1,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_SET_CC_FIFOP_PIN() {
%1 = call i32 @set_io_bit(i32 -4, i32 1)
ret void
}

LLVM IR (-O2):
define void @TOSH_SET_CC_FIFOP_PIN() {
%1 = tail call i32 @set_io_bit(i32 -4, i32 1)
ret void
}
struct ocfs2_disk_dqtrailer *ocfs2_block_dqtrailer(int blocksize, void *buf) {
  char *ptr = buf;
  ptr += blocksize - 8;
  return (struct ocfs2_disk_dqtrailer *)ptr;
}


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

x86 assembly (clang, -O2):
<ocfs2_block_dqtrailer>:
movslq %edi,%rax
add    %rsi,%rax
add    $0xfffffffffffffff8,%rax
ret

LLVM IR (-O0):
%struct.ocfs2_disk_dqtrailer = type opaque
define %struct.ocfs2_disk_dqtrailer* @ocfs2_block_dqtrailer(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
store i8* %6, i8** %5
%7 = load i32, i32* %3
%8 = sub nsw i32 %7, 8
%9 = load i8*, i8** %5
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds i8, i8* %9, i64 %10
store i8* %11, i8** %5
%12 = load i8*, i8** %5
%13 = bitcast i8* %12 to %struct.ocfs2_disk_dqtrailer*
ret %struct.ocfs2_disk_dqtrailer* %13
}

LLVM IR (-O2):
%struct.ocfs2_disk_dqtrailer = type opaque
define %struct.ocfs2_disk_dqtrailer* @ocfs2_block_dqtrailer(i32 %0, i8* readnone %1) {
%3 = add nsw i32 %0, -8
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %1, i64 %4
%6 = bitcast i8* %5 to %struct.ocfs2_disk_dqtrailer*
ret %struct.ocfs2_disk_dqtrailer* %6
}
/* Variables and functions */
int /*<<< orphan*/ AbEnd(char *, char const *);
void InvDef(const char *Def) { AbEnd("Invalid definition: '%s'", Def); }


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

x86 assembly (clang, -O2):
<InvDef>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <AbEnd@plt>

LLVM IR (-O0):
@.str = [25 x i8] c"Invalid definition: '%s'\00"
define void @InvDef(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @AbEnd(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"Invalid definition: '%s'\00"
define void @InvDef(i8* %0) {
%2 = tail call i32 @AbEnd(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ PTHREAD_CREATE_DETACHED;
int thread_create(void *, void *, int, int /*<<< orphan*/ *,
                  int /*<<< orphan*/);
int thread_create_detached(void *function, void *arg, int retries,
                           pthread_t *tid) {
  return thread_create(function, arg, retries, tid, PTHREAD_CREATE_DETACHED);
}


x86 assembly (clang, -O0):
<thread_create_detached>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    0x2ea3(%rip),%rax
mov    (%rax),%r8d
call   1030 <thread_create@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_create_detached>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%r8d
jmp    1030 <thread_create@plt>

LLVM IR (-O0):
@PTHREAD_CREATE_DETACHED = global i32 0
define i32 @thread_create_detached(i8* %0, i8* %1, i32 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = load i32*, i32** %8
%13 = load i32, i32* @PTHREAD_CREATE_DETACHED
%14 = call i32 @thread_create(i8* %9, i8* %10, i32 %11, i32* %12, i32 %13)
ret i32 %14
}

LLVM IR (-O2):
@PTHREAD_CREATE_DETACHED = global i32 0
define i32 @thread_create_detached(i8* %0, i8* %1, i32 %2, i32* %3) {
%5 = load i32, i32* @PTHREAD_CREATE_DETACHED
%6 = tail call i32 @thread_create(i8* %0, i8* %1, i32 %2, i32* %3, i32 %5)
ret i32 %6
}
/* Type definitions */
typedef scalar_t__ x;
typedef int uint32_t;

/* Variables and functions */
extern uint32_t __swab32(uint32_t x) {
  return ((uint32_t)((((uint32_t)(x) & (uint32_t)0x000000FF) << 24) |
                     (((uint32_t)(x) & (uint32_t)0x0000FF00) << 8) |
                     (((uint32_t)(x) & (uint32_t)0x00FF0000) >> 8) |
                     (((uint32_t)(x) & (uint32_t)0xFF000000) >> 24)));
}


x86 assembly (clang, -O0):
<__swab32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff,%eax
shl    $0x18,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff000000,%ecx
sar    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__swab32>:
mov    %edi,%eax
and    $0xffffff,%eax
bswap  %eax
sar    $0x18,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @__swab32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 255
%5 = shl i32 %4, 24
%6 = load i32, i32* %2
%7 = and i32 %6, 65280
%8 = shl i32 %7, 8
%9 = or i32 %5, %8
%10 = load i32, i32* %2
%11 = and i32 %10, 16711680
%12 = ashr i32 %11, 8
%13 = or i32 %9, %12
%14 = load i32, i32* %2
%15 = and i32 %14, -16777216
%16 = ashr i32 %15, 24
%17 = or i32 %13, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @__swab32(i32 %0) {
%2 = and i32 %0, 16777215
%3 = tail call i32 @llvm.bswap.i32(i32 %2)
%4 = ashr i32 %0, 24
%5 = or i32 %3, %4
ret i32 %5
}
void X509at_get_attr_count(void) {}


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

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

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

LLVM IR (-O2):
define void @X509at_get_attr_count() {
ret void
}
int regulator_disable(struct regulator *regulator) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.regulator = type opaque
define i32 @regulator_disable(%struct.regulator* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ LOG_INFO;
int /*<<< orphan*/ LOG_NOWAIT;
int /*<<< orphan*/ LOG_USER;
int /*<<< orphan*/ closelog();
int /*<<< orphan*/ openlog(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ syslog(int /*<<< orphan*/, char *);
int main(void) {
  openlog("mydaemon", LOG_NOWAIT, LOG_USER);
  syslog(LOG_INFO, "logging message in C");
  closelog();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%esi
mov    0x2e99(%rip),%rax
mov    (%rax),%edx
lea    0xea8(%rip),%rdi
call   1050 <openlog@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1040 <syslog@plt>
mov    $0x0,%al
call   1030 <closelog@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ea0(%rip),%rax
mov    (%rax),%esi
mov    0x2ea7(%rip),%rax
mov    (%rax),%edx
lea    0xeb6(%rip),%rdi
call   1050 <openlog@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
lea    0xeaa(%rip),%rsi
call   1040 <syslog@plt>
xor    %eax,%eax
call   1030 <closelog@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"mydaemon\00"
@LOG_NOWAIT = global i32 0
@LOG_USER = global i32 0
@LOG_INFO = global i32 0
@.str.1 = [21 x i8] c"logging message in C\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @LOG_NOWAIT
%3 = load i32, i32* @LOG_USER
%4 = call i32 @openlog(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
%5 = load i32, i32* @LOG_INFO
%6 = call i32 @syslog(i32 %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (...) @closelog()
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"mydaemon\00"
@LOG_NOWAIT = global i32 0
@LOG_USER = global i32 0
@LOG_INFO = global i32 0
@.str.1 = [21 x i8] c"logging message in C\00"
define i32 @main() {
%1 = load i32, i32* @LOG_NOWAIT
%2 = load i32, i32* @LOG_USER
%3 = tail call i32 @openlog(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%4 = load i32, i32* @LOG_INFO
%5 = tail call i32 @syslog(i32 %4, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (...) @closelog()
ret i32 0
}
int terminator(void *ptr) { return *(int *)ptr; }


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

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

LLVM IR (-O0):
define i32 @terminator(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @terminator(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
int compare_char(const void *op1, const void *op2) {
  return *((char *)op1) - *((char *)op2);
}


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

x86 assembly (clang, -O2):
<compare_char>:
movsbl (%rdi),%eax
movsbl (%rsi),%ecx
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @compare_char(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* %5
%7 = sext i8 %6 to i32
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @compare_char(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = sub nsw i32 %4, %6
ret i32 %7
}