xunge/DecIR huggingface dataset:
unsigned long reverse(unsigned long num) {
  unsigned long rev;
  rev = 0;
  while (num > 0) {
    rev = rev * 10 + num % 10;
    num /= 10;
  }
  return rev;
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jbe    1154 <reverse+0x54>
imul   $0xa,-0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    -0x18(%rbp),%rax
add    %rdx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x8(%rbp)
jmp    1110 <reverse+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
test   %rdi,%rdi
je     114a <reverse+0x4a>
mov    %rdi,%rcx
xor    %eax,%eax
movabs $0xcccccccccccccccd,%r8
cc cc cc
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%rax,%rax,4),%rsi
mov    %rcx,%rax
mul    %r8
shr    $0x3,%rdx
lea    (%rdx,%rdx,1),%rax
lea    (%rax,%rax,4),%rax
mov    %rcx,%rdi
sub    %rax,%rdi
lea    (%rdi,%rsi,2),%rax
cmp    $0x9,%rcx
mov    %rdx,%rcx
ja     1120 <reverse+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @reverse(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ 0, %1 ]
%5 = phi i64 [ %9, %3 ], [ %0, %1 ]
%6 = mul i64 %4, 10
%7 = urem i64 %5, 10
%8 = add i64 %6, %7
%9 = udiv i64 %5, 10
%10 = icmp ult i64 %5, 10
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i64 [ 0, %1 ], [ %8, %3 ]
ret i64 %12
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
uint32_t add2(uint32_t x, uint32_t y) { return (y + 1 + x) - 1; }


x86 assembly (clang, -O0):
<add2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
add    -0x8(%rbp),%rax
sub    $0x1,%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @add2(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = add nsw i64 %5, 1
%7 = load i64, i64* %3
%8 = add nsw i64 %6, %7
%9 = sub nsw i64 %8, 1
ret i64 %9
}

LLVM IR (-O2):
define i64 @add2(i64 %0, i64 %1) {
%3 = add i64 %1, %0
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ esp_sdio_exit();
void rockchip_wifi_exit_module_esp8089(void) { esp_sdio_exit(); }


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

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

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

LLVM IR (-O2):
define void @rockchip_wifi_exit_module_esp8089() {
%1 = tail call i32 (...) @esp_sdio_exit()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fatal(char *);
void *malloc(int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
void *xmalloc(int n) {
  void *p;
  p = malloc(n);
  if (p == ((void *)0))
    fatal("out of memory");
  memset(p, 0, n);
  return p;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115e <xmalloc+0x2e>
lea    0xea7(%rip),%rdi
call   1050 <fatal@plt>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114e <xmalloc+0x1e>
lea    0xeb7(%rip),%rdi
call   1050 <fatal@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %ebp,%edx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"out of memory\00"
define i8* @xmalloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = tail call i32 @memset(i8* %2, i32 0, i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ gmvwrite_nodev_data_lstruct(char *, char *, char *, char *,
                                               char *, char *);
void fgmvwrite_nodev_data_lstruct_(char *nxv, char *nyv, char *nzv, char *x,
                                   char *y, char *z) {
  gmvwrite_nodev_data_lstruct(nxv, nyv, nzv, x, y, z);
}


x86 assembly (clang, -O0):
<fgmvwrite_nodev_data_lstruct_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
call   1030 <gmvwrite_nodev_data_lstruct@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgmvwrite_nodev_data_lstruct_>:
jmp    1030 <gmvwrite_nodev_data_lstruct@plt>

LLVM IR (-O0):
define void @fgmvwrite_nodev_data_lstruct_(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i8* %5, i8** %12
%13 = load i8*, i8** %7
%14 = load i8*, i8** %8
%15 = load i8*, i8** %9
%16 = load i8*, i8** %10
%17 = load i8*, i8** %11
%18 = load i8*, i8** %12
%19 = call i32 @gmvwrite_nodev_data_lstruct(i8* %13, i8* %14, i8* %15, i8* %16, i8* %17, i8* %18)
ret void
}

LLVM IR (-O2):
define void @fgmvwrite_nodev_data_lstruct_(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = tail call i32 @gmvwrite_nodev_data_lstruct(i8* %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ swap(char **, int /*<<< orphan*/, int /*<<< orphan*/);
void vecswap(char *a[], int i, int j, int n) {
  while (n-- > 0)
    swap(a, i++, j++);
}


x86 assembly (clang, -O0):
<vecswap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
jle    115d <vecswap+0x4d>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
call   1030 <swap@plt>
jmp    1125 <vecswap+0x15>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vecswap>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %ecx,%ecx
jle    114c <vecswap+0x3c>
mov    %ecx,%ebx
mov    %rdi,%r14
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0x1(%rsi),%r15d
lea    0x1(%rdx),%ebp
mov    %r14,%rdi
call   1030 <swap@plt>
add    $0xffffffff,%ebx
mov    %ebp,%edx
mov    %r15d,%esi
cmp    $0x1,%ebx
ja     1130 <vecswap+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @vecswap(i8** %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %3, 0
br i1 %5, label %6, label %15
6: ; preds = %4, %6
%7 = phi i32 [ %10, %6 ], [ %3, %4 ]
%8 = phi i32 [ %12, %6 ], [ %2, %4 ]
%9 = phi i32 [ %11, %6 ], [ %1, %4 ]
%10 = add nsw i32 %7, -1
%11 = add nsw i32 %9, 1
%12 = add nsw i32 %8, 1
%13 = tail call i32 @swap(i8** %0, i32 %9, i32 %8)
%14 = icmp ugt i32 %7, 1
br i1 %14, label %6, label %15
15: ; preds = %6, %4
ret void
}
/* Variables and functions */
int remove(char *);
int clear_log_file() {
  int err;
  err = remove("cfg/log.txt");
  if (!err)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<clear_log_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <remove@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    113d <clear_log_file+0x2d>
movl   $0x1,-0x4(%rbp)
jmp    1144 <clear_log_file+0x34>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_log_file>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <remove@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"cfg/log.txt\00"
define i32 @clear_log_file() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @remove(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %0
store i32 1, i32* %1
br label %8
7: ; preds = %0
store i32 0, i32* %1
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@.str = [12 x i8] c"cfg/log.txt\00"
define i32 @clear_log_file() {
%1 = tail call i32 @remove(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
typedef scalar_t__ int16_t;

/* Variables and functions */
void put_int16(char *buff, const int16_t ival) {
  *(int16_t *)buff = (int16_t)ival;
}


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

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

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

LLVM IR (-O2):
define void @put_int16(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
void INT_Excep_CMTU1_CMT2(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_CMTU1_CMT2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CRYPTO_cleanup_all_ex_data();
int /*<<< orphan*/ ERR_free_strings();
int /*<<< orphan*/ ERR_remove_state(int /*<<< orphan*/);
int /*<<< orphan*/ EVP_cleanup();
void rsa_cleanup() {
  CRYPTO_cleanup_all_ex_data();
  ERR_free_strings();
  ERR_remove_state(0);
  EVP_cleanup();
}


x86 assembly (clang, -O0):
<rsa_cleanup>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <CRYPTO_cleanup_all_ex_data@plt>
mov    $0x0,%al
call   1060 <ERR_free_strings@plt>
xor    %edi,%edi
call   1030 <ERR_remove_state@plt>
mov    $0x0,%al
call   1050 <EVP_cleanup@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rsa_cleanup>:
push   %rax
xor    %eax,%eax
call   1040 <CRYPTO_cleanup_all_ex_data@plt>
xor    %eax,%eax
call   1060 <ERR_free_strings@plt>
xor    %edi,%edi
call   1030 <ERR_remove_state@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <EVP_cleanup@plt>

LLVM IR (-O0):
define void @rsa_cleanup() {
%1 = call i32 (...) @CRYPTO_cleanup_all_ex_data()
%2 = call i32 (...) @ERR_free_strings()
%3 = call i32 @ERR_remove_state(i32 0)
%4 = call i32 (...) @EVP_cleanup()
ret void
}

LLVM IR (-O2):
define void @rsa_cleanup() {
%1 = tail call i32 (...) @CRYPTO_cleanup_all_ex_data()
%2 = tail call i32 (...) @ERR_free_strings()
%3 = tail call i32 @ERR_remove_state(i32 0)
%4 = tail call i32 (...) @EVP_cleanup()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ isAActor(int);
int /*<<< orphan*/ output(char *);
int /*<<< orphan*/ showInstance(int);
int /*<<< orphan*/ sprintf(char *, char *, int);
void showActor(int act) {
  char str[80];
  if (!isAActor(act)) {
    sprintf(str, "Instance %d is not an actor.", act);
    output(str);
    return;
  }
  showInstance(act);
}


x86 assembly (clang, -O0):
<showActor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <isAActor@plt>
cmp    $0x0,%eax
jne    117d <showActor+0x3d>
lea    -0x60(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe96(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x60(%rbp),%rdi
call   1030 <output@plt>
jmp    1185 <showActor+0x45>
mov    -0x4(%rbp),%edi
call   1040 <showInstance@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showActor>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %edi,%ebx
call   1050 <isAActor@plt>
test   %eax,%eax
je     1160 <showActor+0x20>
mov    %ebx,%edi
add    $0x58,%rsp
pop    %rbx
pop    %r14
jmp    1040 <showInstance@plt>
lea    0xe99(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %ebx,%edx
call   1060 <sprintf@plt>
mov    %r14,%rdi
call   1030 <output@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Instance %d is not an actor.\00"
define void @showActor(i32 %0) {
%2 = alloca i32
%3 = alloca [80 x i8]
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @isAActor(i32 %4)
%6 = icmp ne i32 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%9 = load i32, i32* %2
%10 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%12 = call i32 @output(i8* %11)
br label %16
13: ; preds = %1
%14 = load i32, i32* %2
%15 = call i32 @showInstance(i32 %14)
br label %16
16: ; preds = %13, %7
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Instance %d is not an actor.\00"
define void @showActor(i32 %0) {
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @isAActor(i32 %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %0)
%8 = call i32 @output(i8* %3)
br label %11
9: ; preds = %1
%10 = tail call i32 @showInstance(i32 %0)
br label %11
11: ; preds = %9, %6
ret void
}
/* Variables and functions */
char *strdup(char const *);
char *strrchr(char const *, char);
char *get_filename_ext(const char *fname) {
  const char *d = strrchr(fname, '.');
  if (!d)
    return 0;
  ++d;
  if (*d == '\0')
    return 0;
  return strdup(d);
}


x86 assembly (clang, -O0):
<get_filename_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1156 <get_filename_ext+0x36>
movq   $0x0,-0x8(%rbp)
jmp    118c <get_filename_ext+0x6c>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    117f <get_filename_ext+0x5f>
movq   $0x0,-0x8(%rbp)
jmp    118c <get_filename_ext+0x6c>
mov    -0x18(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_filename_ext>:
push   %rax
mov    $0x2e,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1143 <get_filename_ext+0x23>
cmpb   $0x0,0x1(%rax)
je     1143 <get_filename_ext+0x23>
add    $0x1,%rax
mov    %rax,%rdi
pop    %rax
jmp    1040 <strdup@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define noalias i8* @get_filename_ext(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 46)
%3 = icmp eq i8* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i8* @strdup(i8* %5)
br label %10
10: ; preds = %4, %1, %8
%11 = phi i8* [ %9, %8 ], [ null, %1 ], [ null, %4 ]
ret i8* %11
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ const *);
struct tm *from_unix_time(const time_t *timep) {
  return localtime(timep);
}


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

x86 assembly (clang, -O2):
<from_unix_time>:
jmp    1030 <localtime@plt>

LLVM IR (-O0):
%struct.tm = type { i32 }
define %struct.tm* @from_unix_time(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call %struct.tm* @localtime(i32* %3)
ret %struct.tm* %4
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define %struct.tm* @from_unix_time(i32* %0) {
%2 = tail call %struct.tm* @localtime(i32* %0)
ret %struct.tm* %2
}
/* Variables and functions */
double exp(double);
double expo(double x) { return exp(x); }


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

x86 assembly (clang, -O2):
<expo>:
jmp    1030 <exp@plt>

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

LLVM IR (-O2):
define double @expo(double %0) {
%2 = tail call double @exp(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void usage(char *program) {
  printf("%s: chroot into a new Linux namespace.\n\n", program);
  printf("Usage:\n");
  printf("  %s <chroot path> <executable> [executable args]\n", program);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf10(%rip),%rdi
call   1030 <puts@plt>
lea    0xed1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"%s: chroot into a new Linux namespace.\0A\0A\00"
@.str.1 = [8 x i8] c"Usage:\0A\00"
@.str.2 = [51 x i8] c" %s <chroot path> <executable> [executable args]\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = load i8*, i8** %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [41 x i8] c"%s: chroot into a new Linux namespace.\0A\0A\00"
@.str.2 = [51 x i8] c" %s <chroot path> <executable> [executable args]\0A\00"
@str = [7 x i8] c"Usage:\00"
define void @usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0), i8* %0)
%5 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ ConsolePrint(int /*<<< orphan*/);
void ConsolePrints(unsigned char *str) {
  while (*str)
    ConsolePrint(*str++);
}


x86 assembly (clang, -O0):
<ConsolePrints>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <ConsolePrints+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%edi
call   1030 <ConsolePrint@plt>
jmp    111c <ConsolePrints+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ConsolePrints>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <ConsolePrints+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movzbl %al,%edi
call   1030 <ConsolePrint@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <ConsolePrints+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @ConsolePrints(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = load i8, i8* %8
%11 = zext i8 %10 to i32
%12 = call i32 @ConsolePrint(i32 %11)
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @ConsolePrints(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = zext i8 %5 to i32
%9 = tail call i32 @ConsolePrint(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("Firejail profile builder\n");
  printf("Usage: firejail [--debug] --build[=profile-file] "
         "program-and-arguments\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
lea    0xef3(%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    0xef5(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Firejail profile builder\0A\00"
@.str.1 = [72 x i8] c"Usage: firejail [--debug] --build[=profile-file] program-and-arguments\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [25 x i8] c"Firejail profile builder\00"
@str.2 = [71 x i8] c"Usage: firejail [--debug] --build[=profile-file] program-and-arguments\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.2, i64 0, i64 0))
ret void
}
int main() { auto double a = 1.0; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movsd  0xef4(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca double
store double 1.000000e+00, double* %1
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(char *, char *, int);
int main(void) {
  char source[65536], destination[65536];
  int i, j;
  for (j = 0; j < 100; j++)
    memcpy(destination, source, 65536);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20020,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x20018(%rbp)
cmpl   $0x64,-0x20018(%rbp)
jge    1165 <main+0x55>
lea    -0x20010(%rbp),%rdi
lea    -0x10010(%rbp),%rsi
mov    $0x10000,%edx
call   1030 <memcpy@plt>
mov    -0x20018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20018(%rbp)
jmp    112c <main+0x1c>
mov    -0x4(%rbp),%eax
add    $0x20020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20000,%rsp
mov    $0x64,%ebp
mov    %rsp,%r14
lea    0x10000(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x10000,%edx
call   1030 <memcpy@plt>
add    $0xffffffff,%ebp
jne    1130 <main+0x20>
xor    %eax,%eax
add    $0x20000,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [65536 x i8]
%3 = alloca [65536 x i8]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %6
6: ; preds = %13, %0
%7 = load i32, i32* %5
%8 = icmp slt i32 %7, 100
br i1 %8, label %9, label %16
9: ; preds = %6
%10 = getelementptr inbounds [65536 x i8], [65536 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [65536 x i8], [65536 x i8]* %2, i64 0, i64 0
%12 = call i32 @memcpy(i8* %10, i8* %11, i32 65536)
br label %13
13: ; preds = %9
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %6
16: ; preds = %6
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [65536 x i8]
%2 = alloca [65536 x i8]
%3 = getelementptr inbounds [65536 x i8], [65536 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [65536 x i8], [65536 x i8]* %2, i64 0, i64 0
br label %5
5: ; preds = %0, %5
%6 = phi i32 [ 0, %0 ], [ %8, %5 ]
%7 = call i32 @memcpy(i8* %4, i8* %3, i32 65536)
%8 = add nuw nsw i32 %6, 1
%9 = icmp eq i32 %8, 100
br i1 %9, label %10, label %5
10: ; preds = %5
ret i32 0
}
void inter_mail_sql_final(void) { return; }


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

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

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

LLVM IR (-O2):
define void @inter_mail_sql_final() {
ret void
}
void parse_version(char *verstr) {
  while (*verstr && *verstr != '.')
    verstr++;
  if (*verstr) {
    verstr++;
    while (*verstr && *verstr != '.')
      verstr++;
  }
}


x86 assembly (clang, -O0):
<parse_version>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     112d <parse_version+0x2d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113d <parse_version+0x3d>
jmp    114e <parse_version+0x4e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <parse_version+0x8>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     11b2 <parse_version+0xb2>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xa(%rbp)
je     118c <parse_version+0x8c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    119c <parse_version+0x9c>
jmp    11ad <parse_version+0xad>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1167 <parse_version+0x67>
jmp    11b2 <parse_version+0xb2>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @parse_version(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %15, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 46
br label %13
13: ; preds = %8, %3
%14 = phi i1 [ false, %3 ], [ %12, %8 ]
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = load i8*, i8** %2
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %2
br label %3
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = load i8, i8* %19
%21 = icmp ne i8 %20, 0
br i1 %21, label %22, label %41
22: ; preds = %18
%23 = load i8*, i8** %2
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %2
br label %25
25: ; preds = %37, %22
%26 = load i8*, i8** %2
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %25
%31 = load i8*, i8** %2
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp ne i32 %33, 46
br label %35
35: ; preds = %30, %25
%36 = phi i1 [ false, %25 ], [ %34, %30 ]
br i1 %36, label %37, label %40
37: ; preds = %35
%38 = load i8*, i8** %2
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %2
br label %25
40: ; preds = %35
br label %41
41: ; preds = %40, %18
ret void
}

LLVM IR (-O2):
define void @parse_version(i8* nocapture %0) {
ret void
}
int av_play(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @av_play() {
ret i32 0
}
void foo(int x, float p[]) {
  int w;
  return;
}


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

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

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

LLVM IR (-O2):
define void @foo(i32 %0, float* nocapture %1) {
ret void
}
/* Variables and functions */
bool consoleInputAvail() { return false; }


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

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

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

LLVM IR (-O2):
define i32 @consoleInputAvail() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, char, size_t);
void *util_Malloc(size_t);
void *util_Calloc(size_t sz) {
  void *p = util_Malloc(sz);
  memset(p, '\0', sz);
  return p;
}


x86 assembly (clang, -O0):
<util_Calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <util_Malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_Calloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <util_Malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @util_Calloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @util_Malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load i64, i64* %2
%8 = call i32 @memset(i8* %6, i8 signext 0, i64 %7)
%9 = load i8*, i8** %3
ret i8* %9
}

LLVM IR (-O2):
define i8* @util_Calloc(i64 %0) {
%2 = tail call i8* @util_Malloc(i64 %0)
%3 = tail call i32 @memset(i8* %2, i8 signext 0, i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int open(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ t_error(char *, char const *);
int open_rd(const char *fn) {
  int fd;
  fd = open(fn, O_RDONLY);
  if (fd == -1) {
    t_error("unable to open file for reading: %s", fn);
  }
  return fd;
}


x86 assembly (clang, -O0):
<open_rd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
jne    115b <open_rd+0x3b>
mov    -0x8(%rbp),%rsi
lea    0xeaa(%rip),%rdi
call   1040 <t_error@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_rd>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
mov    %eax,%ebp
cmp    $0xffffffff,%eax
jne    114a <open_rd+0x2a>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
call   1040 <t_error@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
@.str = [36 x i8] c"unable to open file for reading: %s\00"
define i32 @open_rd(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i32, i32* @O_RDONLY
%6 = call i32 @open(i8* %4, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 @t_error(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@.str = [36 x i8] c"unable to open file for reading: %s\00"
define i32 @open_rd(i8* %0) {
%2 = load i32, i32* @O_RDONLY
%3 = tail call i32 @open(i8* %0, i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @t_error(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %5, %1
ret i32 %3
}
int omap4_finish_suspend(unsigned long cpu_state) {}


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

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

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

LLVM IR (-O2):
define i32 @omap4_finish_suspend(i64 %0) {
ret i32 undef
}
int compare(const void *a, const void *b) {
  return (*(long long int *)a - *(long long int *)b);
}


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

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

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

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = sub nsw i64 %4, %6
%8 = trunc i64 %7 to i32
ret i32 %8
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint32_t;

/* Variables and functions */
void bigendian_to_u24(uint32_t *dst, uint8_t *src) {
  *dst =
      (((uint32_t)src[0]) << 16) | (((uint32_t)src[1]) << 8) | (uint32_t)src[2];
}


x86 assembly (clang, -O0):
<bigendian_to_u24>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %eax,%ecx
shl    $0x10,%ecx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
shl    $0x8,%eax
or     %eax,%ecx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
or     %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bigendian_to_u24>:
mov    (%rsi),%eax
mov    0x8(%rsi),%ecx
shl    $0x10,%eax
shl    $0x8,%ecx
or     %eax,%ecx
or     0x10(%rsi),%ecx
mov    %ecx,(%rdi)
ret

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

LLVM IR (-O2):
define void @bigendian_to_u24(i32* nocapture writeonly %0, i64* nocapture %1) {
%3 = load i64, i64* %1
%4 = trunc i64 %3 to i32
%5 = shl i32 %4, 16
%6 = getelementptr inbounds i64, i64* %1, i64 1
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
%9 = shl i32 %8, 8
%10 = or i32 %9, %5
%11 = getelementptr inbounds i64, i64* %1, i64 2
%12 = load i64, i64* %11
%13 = trunc i64 %12 to i32
%14 = or i32 %10, %13
store i32 %14, i32* %0
ret void
}
int launchd_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @launchd_init() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void test_free_null_ptr(void) { free(NULL); }


x86 assembly (clang, -O0):
<test_free_null_ptr>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
mov    %eax,%edi
call   1030 <free@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_free_null_ptr>:
xor    %edi,%edi
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @test_free_null_ptr() {
%1 = call i32 @free(i32* null)
ret void
}

LLVM IR (-O2):
define void @test_free_null_ptr() {
%1 = tail call i32 @free(i32* null)
ret void
}
/* Variables and functions */
long double lgamma(long double);
long double imprecise_lgammal(long double v) { return lgamma(v); }


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

x86 assembly (clang, -O2):
<imprecise_lgammal>:
jmp    1030 <lgamma@plt>

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

LLVM IR (-O2):
define x86_fp80 @imprecise_lgammal(x86_fp80 %0) {
%2 = tail call x86_fp80 @lgamma(x86_fp80 %0)
ret x86_fp80 %2
}
void TestUnaryOperatorExpr(void) {
  char T1 = 1;
  int T2 = 1;
  T1++;
  T2++;
  -T1;
  -T2;
  ~T1;
  ~T2;
}


x86 assembly (clang, -O0):
<TestUnaryOperatorExpr>:
push   %rbp
mov    %rsp,%rbp
movb   $0x1,-0x1(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x1(%rbp),%al
add    $0x1,%al
mov    %al,-0x1(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @TestUnaryOperatorExpr() {
ret void
}
/* Type definitions */
struct sigaction {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
int sigaction(int signum, const struct sigaction *act,
              struct sigaction *oldact) {
  ;
  errno = ENOSYS;
  return -1;
  ;
}


x86 assembly (clang, -O0):
<sigaction>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2ed2(%rip),%rax
mov    (%rax),%ecx
mov    0x2eb9(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigaction>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
%struct.sigaction = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @sigaction(i32 %0, %struct.sigaction* %1, %struct.sigaction* %2) {
%4 = alloca i32
%5 = alloca %struct.sigaction*
%6 = alloca %struct.sigaction*
store i32 %0, i32* %4
store %struct.sigaction* %1, %struct.sigaction** %5
store %struct.sigaction* %2, %struct.sigaction** %6
%7 = load i32, i32* @ENOSYS
store i32 %7, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
%struct.sigaction = type { i32 }
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @sigaction(i32 %0, %struct.sigaction* nocapture readnone %1, %struct.sigaction* nocapture readnone %2) {
%4 = load i32, i32* @ENOSYS
store i32 %4, i32* @errno
ret i32 -1
}
const struct Chord *pgm_read_word(const struct Chord *const *chord) {
  return *chord;
}


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

x86 assembly (clang, -O2):
<pgm_read_word>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.Chord = type opaque
define %struct.Chord* @pgm_read_word(%struct.Chord** %0) {
%2 = alloca %struct.Chord**
store %struct.Chord** %0, %struct.Chord*** %2
%3 = load %struct.Chord**, %struct.Chord*** %2
%4 = load %struct.Chord*, %struct.Chord** %3
ret %struct.Chord* %4
}

LLVM IR (-O2):
%struct.Chord = type opaque
define %struct.Chord* @pgm_read_word(%struct.Chord** nocapture %0) {
%2 = load %struct.Chord*, %struct.Chord** %0
ret %struct.Chord* %2
}
/* Type definitions */
struct flashrom_flashctx {
  int dummy;
};
typedef int /*<<< orphan*/ cmd;

/* Variables and functions */
int spi_send_command(struct flashrom_flashctx *, int, int /*<<< orphan*/,
                     unsigned char *, int /*<<< orphan*/ *);
int edi_disable(struct flashrom_flashctx *flash) {
  unsigned char cmd = 0xf3;
  int rc;
  rc = spi_send_command(flash, sizeof(cmd), 0, &cmd, NULL);
  if (rc)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<edi_disable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movb   $0xf3,-0x11(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1,%esi
xor    %edx,%edx
lea    -0x11(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%r8d
call   1030 <spi_send_command@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1152 <edi_disable+0x42>
movl   $0xffffffff,-0x4(%rbp)
jmp    1159 <edi_disable+0x49>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<edi_disable>:
push   %rax
movb   $0xf3,0x7(%rsp)
lea    0x7(%rsp),%rcx
mov    $0x1,%esi
xor    %edx,%edx
xor    %r8d,%r8d
call   1030 <spi_send_command@plt>
neg    %eax
sbb    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.flashrom_flashctx = type { i32 }
define i32 @edi_disable(%struct.flashrom_flashctx* %0) {
%2 = alloca i8
store i8 -13, i8* %2
%3 = call i32 @spi_send_command(%struct.flashrom_flashctx* %0, i32 1, i32 0, i8* %2, i32* null)
%4 = icmp ne i32 %3, 0
%5 = sext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ emplace_trim(char *);
char *strdup(char const *);
char *trim(const char *str) {
  char *s = strdup(str);
  emplace_trim(s);
  return s;
}


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

x86 assembly (clang, -O2):
<trim>:
push   %rbx
call   1040 <strdup@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <emplace_trim@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @trim(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 = call i32 @emplace_trim(i8* %6)
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
define i8* @trim(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = tail call i32 @emplace_trim(i8* %2)
ret i8* %2
}