xunge/DecIR huggingface dataset:
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ const UINT16_MAX;
scalar_t__ const UINT8_MAX;
int map_code_width_(const uint32_t value) {
  if (value <= UINT8_MAX) {
    return 1;
  }
  if (value <= UINT16_MAX) {
    return 2;
  }
  return 4;
}


x86 assembly (clang, -O0):
<map_code_width_>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2ecd(%rip),%rcx
cmp    (%rcx),%rax
jg     1128 <map_code_width_+0x28>
movl   $0x1,-0x4(%rbp)
jmp    114f <map_code_width_+0x4f>
mov    -0x10(%rbp),%rax
mov    0x2ea5(%rip),%rcx
cmp    (%rcx),%rax
jg     1148 <map_code_width_+0x48>
movl   $0x2,-0x4(%rbp)
jmp    114f <map_code_width_+0x4f>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_code_width_>:
xor    %eax,%eax
test   %rdi,%rdi
setg   %al
lea    (%rax,%rax,2),%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
@UINT8_MAX = constant i64 0
@UINT16_MAX = constant i64 0
define i32 @map_code_width_(i64 %0) {
%2 = icmp slt i64 %0, 1
%3 = select i1 %2, i32 1, i32 4
ret i32 %3
}
/* Variables and functions */
int bf_g(char **, int);
int fg(char **args) { return (bf_g(args, 1)); }


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

x86 assembly (clang, -O2):
<fg>:
mov    $0x1,%esi
jmp    1030 <bf_g@plt>

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

LLVM IR (-O2):
define i32 @fg(i8** %0) {
%2 = tail call i32 @bf_g(i8** %0, i32 1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int GetYearFromUser(void) {
  int year;
  while (1) {
    printf("Which year? ");
    scanf("%d", &year);
    if (year < 100)
      return (1900 + year);
    return (year);
  }
}


x86 assembly (clang, -O0):
<GetYearFromUser>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x64,-0x8(%rbp)
jge    115e <GetYearFromUser+0x3e>
mov    -0x8(%rbp),%eax
add    $0x76c,%eax
mov    %eax,-0x4(%rbp)
jmp    1164 <GetYearFromUser+0x44>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetYearFromUser>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
lea    0x76c(%rcx),%eax
cmp    $0x64,%ecx
cmovge %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"Which year? \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @GetYearFromUser() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp slt i32 %5, 100
%7 = add nsw i32 %5, 1900
%8 = select i1 %6, i32 %7, i32 %5
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void CallLib(void) { printf("Calling CallLib() from Static Library\n"); }


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

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

LLVM IR (-O0):
@.str = [39 x i8] c"Calling CallLib() from Static Library\0A\00"
define void @CallLib() {
%1 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [38 x i8] c"Calling CallLib() from Static Library\00"
define void @CallLib() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int *malloc(int);
void getheap3(int *p) { p = malloc(sizeof(int) * 10); }


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

x86 assembly (clang, -O2):
<getheap3>:
mov    $0x28,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define void @getheap3(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32* @malloc(i32 40)
store i32* %3, i32** %2
ret void
}

LLVM IR (-O2):
define void @getheap3(i32* nocapture readnone %0) {
%2 = tail call i32* @malloc(i32 40)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ TIOCGPGRP;
scalar_t__ ioctl(int, int /*<<< orphan*/, int *);
pid_t tcgetpgrp(int fd) {
  int s;
  if (ioctl(fd, TIOCGPGRP, &s) < 0)
    return ((pid_t)-1);
  return ((pid_t)s);
}


x86 assembly (clang, -O0):
<tcgetpgrp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
jge    1146 <tcgetpgrp+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    114c <tcgetpgrp+0x3c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcgetpgrp>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdx
call   1030 <ioctl@plt>
mov    %rax,%rcx
mov    $0xffffffff,%eax
test   %rcx,%rcx
js     1135 <tcgetpgrp+0x25>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@TIOCGPGRP = global i32 0
define i32 @tcgetpgrp(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @TIOCGPGRP
%5 = call i64 @ioctl(i32 %0, i32 %4, i32* %2)
%6 = icmp slt i64 %5, 0
%7 = load i32, i32* %2
%8 = select i1 %6, i32 -1, i32 %7
ret i32 %8
}
void unit2class() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ htobe64(int /*<<< orphan*/);
void WriteBE64(unsigned char *ptr, uint64_t x) {
  *((uint64_t *)ptr) = htobe64(x);
}


x86 assembly (clang, -O0):
<WriteBE64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <htobe64@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteBE64>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <htobe64@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @WriteBE64(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = call i32 @htobe64(i32 %5)
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32 %6, i32* %8
ret void
}

LLVM IR (-O2):
define void @WriteBE64(i8* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @htobe64(i32 %1)
%4 = bitcast i8* %0 to i32*
store i32 %3, i32* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ TFT_Init_ILI9341_8bit(int, int);
void InitializeTouchPanel() { TFT_Init_ILI9341_8bit(320, 240); }


x86 assembly (clang, -O0):
<InitializeTouchPanel>:
push   %rbp
mov    %rsp,%rbp
mov    $0x140,%edi
mov    $0xf0,%esi
call   1030 <TFT_Init_ILI9341_8bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<InitializeTouchPanel>:
mov    $0x140,%edi
mov    $0xf0,%esi
jmp    1030 <TFT_Init_ILI9341_8bit@plt>

LLVM IR (-O0):
define void @InitializeTouchPanel() {
%1 = call i32 @TFT_Init_ILI9341_8bit(i32 320, i32 240)
ret void
}

LLVM IR (-O2):
define void @InitializeTouchPanel() {
%1 = tail call i32 @TFT_Init_ILI9341_8bit(i32 320, i32 240)
ret void
}
/* Variables and functions */
char *mmalloc(int);
int /*<<< orphan*/ sprintf(char *, char *);
char *serverPing(char *unused1, char *unused2, char *unused3) {
  (void)(unused1);
  (void)(unused2);
  (void)(unused3);
  char *output = mmalloc(6);
  sprintf(output, "pong\n");
  return output;
}


x86 assembly (clang, -O0):
<serverPing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x6,%edi
call   1030 <mmalloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xeb3(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serverPing>:
push   %rax
mov    $0x6,%edi
call   1030 <mmalloc@plt>
movl   $0x676e6f70,(%rax)
movw   $0xa,0x4(%rax)
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"pong\0A\00"
define i8* @serverPing(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i8* @mmalloc(i32 6)
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%14 = load i8*, i8** %7
ret i8* %14
}

LLVM IR (-O2):
@.str = [6 x i8] c"pong\0A\00"
define i8* @serverPing(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = tail call i8* @mmalloc(i32 6)
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(6) %4, i8* align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 6, i1 false)
ret i8* %4
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int32_t if_handles_exception(int32_t if_exception) {
  switch (if_exception) {
  case 94:
    return 1;
  case 96:
    return 0;
  case 95:
    return 0;
  case 0:
    return 0;
  case 97:
    return 0;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<if_handles_exception>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     1182 <if_handles_exception+0x82>
jmp    111a <if_handles_exception+0x1a>
mov    -0xc(%rbp),%eax
sub    $0x5e,%eax
je     115e <if_handles_exception+0x5e>
jmp    112b <if_handles_exception+0x2b>
mov    -0xc(%rbp),%eax
sub    $0x5f,%eax
je     1176 <if_handles_exception+0x76>
jmp    113c <if_handles_exception+0x3c>
mov    -0xc(%rbp),%eax
sub    $0x60,%eax
je     116a <if_handles_exception+0x6a>
jmp    114d <if_handles_exception+0x4d>
mov    -0xc(%rbp),%eax
sub    $0x61,%eax
je     118e <if_handles_exception+0x8e>
jmp    119a <if_handles_exception+0x9a>
movl   $0x1,-0x4(%rbp)
jmp    11a1 <if_handles_exception+0xa1>
movl   $0x0,-0x4(%rbp)
jmp    11a1 <if_handles_exception+0xa1>
movl   $0x0,-0x4(%rbp)
jmp    11a1 <if_handles_exception+0xa1>
movl   $0x0,-0x4(%rbp)
jmp    11a1 <if_handles_exception+0xa1>
movl   $0x0,-0x4(%rbp)
jmp    11a1 <if_handles_exception+0xa1>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<if_handles_exception>:
lea    -0x5e(%rdi),%ecx
cmp    $0x3,%ecx
ja     111e <if_handles_exception+0x1e>
mov    $0x1,%eax
lea    0xeec(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
ret
test   %edi,%edi
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @if_handles_exception(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %10 [
i32 94, label %5
i32 96, label %6
i32 95, label %7
i32 0, label %8
i32 97, label %9
]
5: ; preds = %1
store i32 1, i32* %2
br label %11
6: ; preds = %1
store i32 0, i32* %2
br label %11
7: ; preds = %1
store i32 0, i32* %2
br label %11
8: ; preds = %1
store i32 0, i32* %2
br label %11
9: ; preds = %1
store i32 0, i32* %2
br label %11
10: ; preds = %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9, %8, %7, %6, %5
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @if_handles_exception(i32 %0) {
switch i32 %0, label %6 [
i32 94, label %7
i32 96, label %2
i32 95, label %3
i32 0, label %4
i32 97, label %5
]
2: ; preds = %1
br label %7
3: ; preds = %1
br label %7
4: ; preds = %1
br label %7
5: ; preds = %1
br label %7
6: ; preds = %1
br label %7
7: ; preds = %1, %6, %5, %4, %3, %2
%8 = phi i32 [ 0, %6 ], [ 0, %5 ], [ 0, %4 ], [ 0, %3 ], [ 0, %2 ], [ 1, %1 ]
ret i32 %8
}
/* Variables and functions */
int somefunc2(int, int);
int somefunc1(int x, int y) {
  for (; x < y; x++) {
    y += x;
  }
  return somefunc2(x, y);
}


x86 assembly (clang, -O0):
<somefunc1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1141 <somefunc1+0x31>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111e <somefunc1+0xe>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <somefunc2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<somefunc1>:
cmp    %esi,%edi
jge    1134 <somefunc1+0x24>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%rsi,%rdi,1),%eax
add    $0x1,%edi
cmp    $0x1,%esi
mov    %eax,%esi
jg     1120 <somefunc1+0x10>
mov    %eax,%esi
jmp    1030 <somefunc2@plt>
jmp    1030 <somefunc2@plt>

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

LLVM IR (-O2):
define i32 @somefunc1(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
br i1 %3, label %4, label %10
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i32 [ %8, %4 ], [ %0, %2 ]
%7 = add nsw i32 %5, %6
%8 = add nsw i32 %6, 1
%9 = icmp sgt i32 %5, 1
br i1 %9, label %4, label %10
10: ; preds = %4, %2
%11 = phi i32 [ %0, %2 ], [ %8, %4 ]
%12 = phi i32 [ %1, %2 ], [ %7, %4 ]
%13 = tail call i32 @somefunc2(i32 %11, i32 %12)
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint32_t;

/* Variables and functions */
void volatile_fetch_xor_u32(uint32_t *dest, uint32_t val) {
  *((volatile uint32_t *)dest) ^= val;
}


x86 assembly (clang, -O0):
<volatile_fetch_xor_u32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
xor    %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<volatile_fetch_xor_u32>:
mov    %esi,-0x4(%rsp)
mov    -0x4(%rsp),%eax
xor    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @volatile_fetch_xor_u32(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store volatile i32 %1, i32* %4
%5 = load volatile i32, i32* %4
%6 = load i32*, i32** %3
%7 = load volatile i32, i32* %6
%8 = xor i32 %7, %5
store volatile i32 %8, i32* %6
ret void
}

LLVM IR (-O2):
define void @volatile_fetch_xor_u32(i32* %0, i32 %1) {
%3 = alloca i32
store volatile i32 %1, i32* %3
%4 = load volatile i32, i32* %3
%5 = load volatile i32, i32* %0
%6 = xor i32 %5, %4
store volatile i32 %6, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_mode(int, int, int);
void vga_init() { set_mode(320, 200, 256); }


x86 assembly (clang, -O0):
<vga_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x140,%edi
mov    $0xc8,%esi
mov    $0x100,%edx
call   1030 <set_mode@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vga_init>:
mov    $0x140,%edi
mov    $0xc8,%esi
mov    $0x100,%edx
jmp    1030 <set_mode@plt>

LLVM IR (-O0):
define void @vga_init() {
%1 = call i32 @set_mode(i32 320, i32 200, i32 256)
ret void
}

LLVM IR (-O2):
define void @vga_init() {
%1 = tail call i32 @set_mode(i32 320, i32 200, i32 256)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void extract_voxel(char *lfile, char *rfile, char *prefix) {
  printf("need OpenCV for extraction\n");
}


x86 assembly (clang, -O0):
<extract_voxel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [28 x i8] c"need OpenCV for extraction\0A\00"
define void @extract_voxel(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
%7 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [27 x i8] c"need OpenCV for extraction\00"
define void @extract_voxel(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
ret void
}
void _Jv_JNI_PopSystemFrame() {}


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

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

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

LLVM IR (-O2):
define void @_Jv_JNI_PopSystemFrame() {
ret void
}
int semi_read(int fd, char *buffer, int length) {
  struct {
    int fd;
    char *buffer;
    int length;
  } args;
  args.fd = fd;
  args.buffer = buffer;
  args.length = length;
  return __semi_call(6, &args);
}


x86 assembly (clang, -O0):
<semi_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    $0x6,%edi
lea    -0x30(%rbp),%rsi
mov    $0x0,%al
call   1030 <__semi_call@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<semi_read>:
sub    $0x18,%rsp
mov    %edi,(%rsp)
mov    %rsi,0x8(%rsp)
mov    %edx,0x10(%rsp)
mov    %rsp,%rsi
mov    $0x6,%edi
xor    %eax,%eax
call   1030 <__semi_call@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.anon = type { i32, i8*, i32 }
define i32 @semi_read(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca %struct.anon
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 0
store i32 %8, i32* %9
%10 = load i8*, i8** %5
%11 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 1
store i8* %10, i8** %11
%12 = load i32, i32* %6
%13 = getelementptr inbounds %struct.anon, %struct.anon* %7, i32 0, i32 2
store i32 %12, i32* %13
%14 = call i32 (i32, %struct.anon*, ...) bitcast (i32 (...)* @__semi_call to i32 (i32, %struct.anon*, ...)*)(i32 6, %struct.anon* %7)
ret i32 %14
}

LLVM IR (-O2):
%struct.anon = type { i32, i8*, i32 }
define i32 @semi_read(i32 %0, i8* %1, i32 %2) {
%4 = alloca %struct.anon
%5 = bitcast %struct.anon* %4 to i8*
%6 = getelementptr inbounds %struct.anon, %struct.anon* %4, i64 0, i32 0
store i32 %0, i32* %6
%7 = getelementptr inbounds %struct.anon, %struct.anon* %4, i64 0, i32 1
store i8* %1, i8** %7
%8 = getelementptr inbounds %struct.anon, %struct.anon* %4, i64 0, i32 2
store i32 %2, i32* %8
%9 = call i32 (i32, %struct.anon*, ...) bitcast (i32 (...)* @__semi_call to i32 (i32, %struct.anon*, ...)*)(i32 6, %struct.anon* %4)
ret i32 %9
}
void prepareExit(void) {}


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

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

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

LLVM IR (-O2):
define void @prepareExit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ceil(double);
double luaL_check_number(int);
int /*<<< orphan*/ lua_pushnumber(int /*<<< orphan*/);
void math_ceil(void) {
  double d = luaL_check_number(1);
  lua_pushnumber(ceil(d));
}


x86 assembly (clang, -O0):
<math_ceil>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1040 <luaL_check_number@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <ceil@plt>
mov    %eax,%edi
call   1050 <lua_pushnumber@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_ceil>:
push   %rax
mov    $0x1,%edi
call   1040 <luaL_check_number@plt>
call   1030 <ceil@plt>
mov    %eax,%edi
pop    %rax
jmp    1050 <lua_pushnumber@plt>

LLVM IR (-O0):
define void @math_ceil() {
%1 = alloca double
%2 = call double @luaL_check_number(i32 1)
store double %2, double* %1
%3 = load double, double* %1
%4 = call i32 @ceil(double %3)
%5 = call i32 @lua_pushnumber(i32 %4)
ret void
}

LLVM IR (-O2):
define void @math_ceil() {
%1 = tail call double @luaL_check_number(i32 1)
%2 = tail call i32 @ceil(double %1)
%3 = tail call i32 @lua_pushnumber(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, char *);
void display_version(const char *progname) {
  printf("version: %s %s\n", progname, "1.0");
}


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

x86 assembly (clang, -O2):
<display_version>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
lea    0xeef(%rip),%rdx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"version: %s %s\0A\00"
@.str.1 = [4 x i8] c"1.0\00"
define void @display_version(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"version: %s %s\0A\00"
@.str.1 = [4 x i8] c"1.0\00"
define void @display_version(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void about(void) {
  fprintf(stderr,
          "psxdump.c - Dumps playstation disks to file\n\nA quick hack that's "
          "(c) 1999 Fabio Baracca <fabiobar@tiscalinet.it>\nLicensed under GNU "
          "GPL - *HEAVILY BASED* on code from readxa.c\nthat's (c) 1996,1997 "
          "Gerd Knorr <kraxel@cs.tu-berlin.de>\n\n");
}


x86 assembly (clang, -O0):
<about>:
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):
<about>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [235 x i8] c"psxdump.c - Dumps playstation disks to file\0A\0AA quick hack that's (c) 1999 Fabio Baracca <fabiobar@tiscalinet.it>\0ALicensed under GNU GPL - *HEAVILY BASED* on code from readxa.c\0Athat's (c) 1996,1997 Gerd Knorr <kraxel@cs.tu-berlin.de>\0A\0A\00"
define void @about() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([235 x i8], [235 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [235 x i8] c"psxdump.c - Dumps playstation disks to file\0A\0AA quick hack that's (c) 1999 Fabio Baracca <fabiobar@tiscalinet.it>\0ALicensed under GNU GPL - *HEAVILY BASED* on code from readxa.c\0Athat's (c) 1996,1997 Gerd Knorr <kraxel@cs.tu-berlin.de>\0A\0A\00"
define void @about() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([235 x i8], [235 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct group {
  int dummy;
};
typedef enum nss_status { ____Placeholder_nss_status } nss_status;

/* Variables and functions */
int ENOENT;
int NSS_STATUS_UNAVAIL;
enum nss_status _nss_noenum_getgrent_r(struct group *gr, char *buffer,
                                       size_t buflen, int *errnop) {
  *errnop = ENOENT;
  return NSS_STATUS_UNAVAIL;
}


x86 assembly (clang, -O0):
<_nss_noenum_getgrent_r>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2ebe(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_nss_noenum_getgrent_r>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rcx)
mov    0x2ed6(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.group = type { i32 }
@ENOENT = global i32 0
@NSS_STATUS_UNAVAIL = global i32 0
define i32 @_nss_noenum_getgrent_r(%struct.group* %0, i8* %1, i64 %2, i32* %3) {
%5 = alloca %struct.group*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32*
store %struct.group* %0, %struct.group** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i32* %3, i32** %8
%9 = load i32, i32* @ENOENT
%10 = load i32*, i32** %8
store i32 %9, i32* %10
%11 = load i32, i32* @NSS_STATUS_UNAVAIL
ret i32 %11
}

LLVM IR (-O2):
%struct.group = type { i32 }
@ENOENT = global i32 0
@NSS_STATUS_UNAVAIL = global i32 0
define i32 @_nss_noenum_getgrent_r(%struct.group* nocapture readnone %0, i8* nocapture readnone %1, i64 %2, i32* nocapture writeonly %3) {
%5 = load i32, i32* @ENOENT
store i32 %5, i32* %3
%6 = load i32, i32* @NSS_STATUS_UNAVAIL
ret i32 %6
}
int test_imm_22uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x22 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_22uint64_midword_reg>:
test   $0x220000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_22uint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 34
%6 = icmp ne i64 %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_22uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 2228224
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int fline__setup(char *file_path) {
  extern FILE *fp;
  if ((fp = fopen(file_path, "rb")) == NULL) {
    fprintf(stderr, "Can't open file '%s' \n", file_path);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<fline__setup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    0x2e95(%rip),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    1175 <fline__setup+0x55>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe9f(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    117c <fline__setup+0x5c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fline__setup>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rcx
mov    0x2e9e(%rip),%rax
mov    %rcx,(%rax)
xor    %eax,%eax
test   %rcx,%rcx
je     1146 <fline__setup+0x26>
pop    %rbx
ret
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
lea    0xead(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@fp = external global i32*
@stderr = global i32 0
@.str.1 = [23 x i8] c"Can't open file '%s' \0A\00"
define i32 @fline__setup(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** @fp
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %3
%10 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %9)
store i32 1, i32* %2
br label %12
11: ; preds = %1
store i32 0, i32* %2
br label %12
12: ; preds = %11, %7
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@fp = external global i32*
@stderr = global i32 0
@.str.1 = [23 x i8] c"Can't open file '%s' \0A\00"
define i32 @fline__setup(i8* %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %2, i32** @fp
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %8
}
/* Variables and functions */
int partition(int *, int, int);
void quickSort(int *A, int lo, int hi) {
  if (lo < hi) {
    int p = partition(A, lo, hi);
    quickSort(A, lo, p - 1);
    quickSort(A, p + 1, hi);
  }
}


x86 assembly (clang, -O0):
<quickSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <quickSort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quickSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quickSort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quickSort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quickSort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quickSort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quickSort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @quickSort(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %3
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call i32 @partition(i32* %12, i32 %13, i32 %14)
store i32 %15, i32* %7
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = load i32, i32* %7
%19 = sub nsw i32 %18, 1
%20 = load i32*, i32** %4
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
%23 = load i32, i32* %6
br label %24
24: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
define void @quickSort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quickSort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Binary(int);
int main(int argc, char *argv[]) { Binary(5); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x5,%edi
call   1030 <Binary@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @Binary(i32 5)
ret i32 0
}
int islower(int c) { return (((c >= 'a') && (c <= 'z')) ? (1) : (0)); }


x86 assembly (clang, -O0):
<islower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x61,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <islower+0x20>
cmpl   $0x7a,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<islower>:
add    $0xffffff9f,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @islower(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
int get_trace_clock(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @get_trace_clock() {
ret i32 0
}

LLVM IR (-O2):
define i32 @get_trace_clock() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ itemFireWpn();
void input_fire(void) { itemFireWpn(); }


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

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

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

LLVM IR (-O2):
define void @input_fire() {
%1 = tail call i32 (...) @itemFireWpn()
ret void
}
int main() {
  int s = 0, e = 0, m = 0, i = 0, N = 30;
  while (N > 0) {
    N--;
    if (i != 0) {
      s = s + e + m;
      i--;
      e = 0;
      m = 0;
    } else if (e != 0) {
      e--;
      m++;
    } else {
      i = i + m + e + s - 1;
      s = 0;
      e = 1;
      m = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1e,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    11c5 <main+0xc5>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1173 <main+0x73>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    11c0 <main+0xc0>
cmpl   $0x0,-0xc(%rbp)
je     1194 <main+0x94>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11bb <main+0xbb>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    11c0 <main+0xc0>
jmp    112e <main+0x2e>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 30, i32* %6
br label %7
7: ; preds = %41, %0
%8 = load i32, i32* %6
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %42
10: ; preds = %7
%11 = load i32, i32* %6
%12 = add nsw i32 %11, -1
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %23
15: ; preds = %10
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = add nsw i32 %16, %17
%19 = load i32, i32* %4
%20 = add nsw i32 %18, %19
store i32 %20, i32* %2
%21 = load i32, i32* %5
%22 = add nsw i32 %21, -1
store i32 %22, i32* %5
store i32 0, i32* %3
store i32 0, i32* %4
br label %41
23: ; preds = %10
%24 = load i32, i32* %3
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = load i32, i32* %3
%28 = add nsw i32 %27, -1
store i32 %28, i32* %3
%29 = load i32, i32* %4
%30 = add nsw i32 %29, 1
store i32 %30, i32* %4
br label %40
31: ; preds = %23
%32 = load i32, i32* %5
%33 = load i32, i32* %4
%34 = add nsw i32 %32, %33
%35 = load i32, i32* %3
%36 = add nsw i32 %34, %35
%37 = load i32, i32* %2
%38 = add nsw i32 %36, %37
%39 = sub nsw i32 %38, 1
store i32 %39, i32* %5
store i32 0, i32* %2
store i32 1, i32* %3
store i32 0, i32* %4
br label %40
40: ; preds = %31, %26
br label %41
41: ; preds = %40, %15
br label %7
42: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISREG(int /*<<< orphan*/);
scalar_t__ stat(char const *, struct stat *);
int IsAReg(const char *name) {
  struct stat info;
  return ((stat(name, &info) == 0) && (S_ISREG(info.st_mode))) ? 1 : 0;
}


x86 assembly (clang, -O0):
<IsAReg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
jne    115d <IsAReg+0x3d>
mov    -0x10(%rbp),%edi
call   1040 <S_ISREG@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsAReg>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1135 <IsAReg+0x15>
pop    %rcx
ret
mov    (%rsp),%edi
call   1040 <S_ISREG@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @IsAReg(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @stat(i8* %4, %struct.stat* %3)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = getelementptr inbounds %struct.stat, %struct.stat* %3, i32 0, i32 0
%9 = load i32, i32* %8
%10 = call i64 @S_ISREG(i32 %9)
%11 = icmp ne i64 %10, 0
br label %12
12: ; preds = %7, %1
%13 = phi i1 [ false, %1 ], [ %11, %7 ]
%14 = zext i1 %13 to i64
%15 = select i1 %13, i32 1, i32 0
ret i32 %15
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @IsAReg(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = call i64 @S_ISREG(i32 %8)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %6, %1
%13 = phi i32 [ 0, %1 ], [ %11, %6 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void print(double *list) {
  int i = 0;
  for (; list[i] != 0; i++)
    printf("%g\n", list[i]);
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1148 <print+0x38>
jp     1148 <print+0x38>
jmp    116f <print+0x5f>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xea4(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <print+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %r14
push   %rbx
push   %rax
movsd  (%rdi),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1124 <print+0x14>
jnp    115c <print+0x4c>
mov    %rdi,%rbx
add    $0x8,%rbx
lea    0xece(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <printf@plt>
xorpd  %xmm1,%xmm1
movsd  (%rbx),%xmm0
add    $0x8,%rbx
ucomisd %xmm1,%xmm0
jne    1140 <print+0x30>
jp     1140 <print+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%g\0A\00"
define void @print(double* nocapture %0) {
%2 = load double, double* %0
%3 = fcmp une double %2, 0.000000e+00
br i1 %3, label %4, label %12
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi double [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds double, double* %0, i64 %8
%10 = load double, double* %9
%11 = fcmp une double %10, 0.000000e+00
br i1 %11, label %4, label %12
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char *malloc(size_t);
int /*<<< orphan*/ perror(int /*<<< orphan*/ *);
char *charalloc(size_t len) {
  char *buffer;
  buffer = malloc((len + 1) * sizeof(char));
  if (buffer == NULL) {
    perror(NULL);
    exit(EXIT_FAILURE);
  }
  buffer[0] = '\0';
  return buffer;
}


x86 assembly (clang, -O0):
<charalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
shl    $0x0,%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1173 <charalloc+0x43>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <perror@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<charalloc>:
push   %rax
add    $0x1,%rdi
call   1030 <malloc@plt>
test   %rax,%rax
je     1144 <charalloc+0x14>
movb   $0x0,(%rax)
pop    %rcx
ret
xor    %edi,%edi
call   1040 <perror@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define i8* @charalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = add i64 %4, 1
%6 = mul i64 %5, 1
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %1
%11 = call i32 @perror(i32* null)
%12 = load i32, i32* @EXIT_FAILURE
%13 = call i32 @exit(i32 %12)
unreachable
14: ; preds = %1
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 0
store i8 0, i8* %16
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define noalias i8* @charalloc(i64 %0) {
%2 = add i64 %0, 1
%3 = tail call i8* @malloc(i64 %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = tail call i32 @perror(i32* null)
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %1
store i8 0, i8* %3
ret i8* %3
}
/* Variables and functions */
scalar_t__ _gpio_in(int);
int /*<<< orphan*/ _gpiomode(int, int);
int /*<<< orphan*/ _gpiotoggle(int, int);
int /*<<< orphan*/ _sleep(int);
long int _user_start() {
  _gpiomode(20, 0b000);
  while (((unsigned char)1)) {
    if (_gpio_in(20))
      _gpiotoggle(21, 1);
    _sleep(1000);
  }
  return 0;
}


x86 assembly (clang, -O0):
<_user_start>:
push   %rbp
mov    %rsp,%rbp
mov    $0x14,%edi
xor    %esi,%esi
call   1060 <_gpiomode@plt>
mov    $0x14,%edi
call   1050 <_gpio_in@plt>
cmp    $0x0,%rax
je     1173 <_user_start+0x33>
mov    $0x15,%edi
mov    $0x1,%esi
call   1040 <_gpiotoggle@plt>
mov    $0x3e8,%edi
call   1030 <_sleep@plt>
jmp    1150 <_user_start+0x10>

x86 assembly (clang, -O2):
<_user_start>:
push   %rax
mov    $0x14,%edi
xor    %esi,%esi
call   1060 <_gpiomode@plt>
jmp    115a <_user_start+0x1a>
nop
mov    $0x3e8,%edi
call   1030 <_sleep@plt>
mov    $0x14,%edi
call   1050 <_gpio_in@plt>
test   %rax,%rax
je     1150 <_user_start+0x10>
mov    $0x15,%edi
mov    $0x1,%esi
call   1040 <_gpiotoggle@plt>
jmp    1150 <_user_start+0x10>

LLVM IR (-O0):
define i64 @_user_start() {
%1 = call i32 @_gpiomode(i32 20, i32 0)
br label %2
2: ; preds = %0, %7
%3 = call i64 @_gpio_in(i32 20)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = call i32 @_gpiotoggle(i32 21, i32 1)
br label %7
7: ; preds = %5, %2
%8 = call i32 @_sleep(i32 1000)
br label %2
}

LLVM IR (-O2):
define i64 @_user_start() {
%1 = tail call i32 @_gpiomode(i32 20, i32 0)
br label %2
2: ; preds = %0, %7
%3 = tail call i64 @_gpio_in(i32 20)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @_gpiotoggle(i32 21, i32 1)
br label %7
7: ; preds = %5, %2
%8 = tail call i32 @_sleep(i32 1000)
br label %2
}