xunge/DecIR huggingface dataset:
int __sprintf(char *s, ...) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @__sprintf(i8* nocapture readnone %0, ...) {
ret i32 0
}
/* Type definitions */
struct stat {
  size_t st_size;
};

/* Variables and functions */
scalar_t__ fstat(int, struct stat *);
size_t file_size(int fd) {
  struct stat stbuf;
  if (fstat(fd, &stbuf) != 0) {
    return ((size_t)-1);
  }
  return stbuf.st_size;
}


x86 assembly (clang, -O0):
<file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1030 <fstat@plt>
cmp    $0x0,%rax
je     113e <file_size+0x2e>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1146 <file_size+0x36>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_size>:
push   %rax
mov    %rsp,%rsi
call   1030 <fstat@plt>
neg    %rax
sbb    %rax,%rax
or     (%rsp),%rax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.stat = type { i64 }
define i64 @file_size(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @fstat(i32 %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i64, i64* %6
%8 = select i1 %5, i64 %7, i64 -1
ret i64 %8
}
/* Type definitions */
struct wpa_ssid {
  int dummy;
};

/* Variables and functions */
struct wpa_ssid *wpa_supplicant_get_ssid(void *);
struct wpa_ssid *_wpa_supplicant_get_ssid(void *wpa_s) {
  return wpa_supplicant_get_ssid(wpa_s);
}


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

x86 assembly (clang, -O2):
<_wpa_supplicant_get_ssid>:
jmp    1030 <wpa_supplicant_get_ssid@plt>

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

LLVM IR (-O2):
%struct.wpa_ssid = type { i32 }
define %struct.wpa_ssid* @_wpa_supplicant_get_ssid(i8* %0) {
%2 = tail call %struct.wpa_ssid* @wpa_supplicant_get_ssid(i8* %0)
ret %struct.wpa_ssid* %2
}
/* Variables and functions */
int strcmp(char const *, char const *);
int strcmp2(const char *s1, const char *s2) {
  if (s1 == NULL || s2 == NULL) {
    if (s1 == NULL && s2 == NULL) {
      return 0;
    } else if (s1 == NULL) {
      return -1;
    } else {
      return 1;
    }
  } else {
    return strcmp(s1, s2);
  }
}


x86 assembly (clang, -O0):
<strcmp2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1136 <strcmp2+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    117b <strcmp2+0x6b>
cmpq   $0x0,-0x10(%rbp)
jne    1158 <strcmp2+0x48>
cmpq   $0x0,-0x18(%rbp)
jne    1158 <strcmp2+0x48>
movl   $0x0,-0x4(%rbp)
jmp    118b <strcmp2+0x7b>
cmpq   $0x0,-0x10(%rbp)
jne    116f <strcmp2+0x5f>
movl   $0xffffffff,-0x4(%rbp)
jmp    118b <strcmp2+0x7b>
movl   $0x1,-0x4(%rbp)
jmp    118b <strcmp2+0x7b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp2>:
test   %rdi,%rdi
je     111f <strcmp2+0xf>
test   %rsi,%rsi
je     111f <strcmp2+0xf>
jmp    1030 <strcmp@plt>
cmp    $0x1,%rdi
sbb    %ecx,%ecx
or     $0x1,%ecx
xor    %eax,%eax
or     %rdi,%rsi
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @strcmp2(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = or i1 %3, %4
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = and i1 %3, %4
%8 = select i1 %3, i32 -1, i32 1
%9 = select i1 %7, i32 0, i32 %8
br label %12
10: ; preds = %2
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
br label %12
12: ; preds = %6, %10
%13 = phi i32 [ %11, %10 ], [ %9, %6 ]
ret i32 %13
}
void set_bit(unsigned char *c, int i) { c[i / 8] |= 128 >> (i % 8); }


x86 assembly (clang, -O0):
<set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    $0x80,%esi
sar    %cl,%esi
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%edx
or     %esi,%edx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_bit>:
mov    %esi,%ecx
and    $0x7,%cl
mov    $0x80,%eax
shr    %cl,%eax
lea    0x7(%rsi),%ecx
test   %esi,%esi
cmovns %esi,%ecx
sar    $0x3,%ecx
movslq %ecx,%rcx
or     %al,(%rdi,%rcx,1)
ret

LLVM IR (-O0):
define void @set_bit(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 = srem i32 %5, 8
%7 = ashr i32 128, %6
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = sdiv i32 %9, 8
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %8, i64 %11
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
%15 = or i32 %14, %7
%16 = trunc i32 %15 to i8
store i8 %16, i8* %12
ret void
}

LLVM IR (-O2):
define void @set_bit(i8* nocapture %0, i32 %1) {
%3 = and i32 %1, 7
%4 = lshr i32 128, %3
%5 = sdiv i32 %1, 8
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = trunc i32 %4 to i8
%10 = or i8 %8, %9
store i8 %10, i8* %7
ret void
}
void glIsShader(void) { return; }


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

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

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

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

/* Variables and functions */
int int_vasprintf(char **, char const *, int /*<<< orphan*/ *);
int vasprintf(char **result, const char *format, va_list args) {
  return int_vasprintf(result, format, &args);
}


x86 assembly (clang, -O0):
<vasprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <int_vasprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vasprintf>:
push   %rax
mov    %edx,0x4(%rsp)
lea    0x4(%rsp),%rdx
call   1030 <int_vasprintf@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @vasprintf(i8** %0, i8* %1, i32 %2) {
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i32
store i8** %0, i8*** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8**, i8*** %4
%8 = load i8*, i8** %5
%9 = call i32 @int_vasprintf(i8** %7, i8* %8, i32* %6)
ret i32 %9
}

LLVM IR (-O2):
define i32 @vasprintf(i8** %0, i8* %1, i32 %2) {
%4 = alloca i32
store i32 %2, i32* %4
%5 = call i32 @int_vasprintf(i8** %0, i8* %1, i32* %4)
ret i32 %5
}
void I_FinishUpdate(void) {}


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

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

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

LLVM IR (-O2):
define void @I_FinishUpdate() {
ret void
}
/* Variables and functions */
long strcmp(void const *, void *);
long compare_names(const void *key, void *value) { return strcmp(key, value); }


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

x86 assembly (clang, -O2):
<compare_names>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i64 @compare_names(i8* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* %1)
ret i64 %3
}
/* Variables and functions */
int __builtin_clz(unsigned int);
int /*<<< orphan*/ assert(int);
unsigned log2u(unsigned x) {
  assert(x > 0);
  return sizeof(unsigned) * 8 - __builtin_clz(x) - 1;
}


x86 assembly (clang, -O0):
<log2u>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
seta   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
bsr    %eax,%eax
xor    $0x1f,%eax
movslq %eax,%rcx
mov    $0x20,%eax
sub    %rcx,%rax
sub    $0x1,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2u>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
test   %ebx,%ebx
setne  %dil
call   1030 <assert@plt>
bsr    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @log2u(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ugt i32 %3, 0
%5 = zext i1 %4 to i32
%6 = call i32 @assert(i32 %5)
%7 = load i32, i32* %2
%8 = call i32 @llvm.ctlz.i32(i32 %7, i1 true)
%9 = sext i32 %8 to i64
%10 = sub i64 32, %9
%11 = sub i64 %10, 1
%12 = trunc i64 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @log2u(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 @llvm.ctlz.i32(i32 %0, i1 true)
%6 = xor i32 %5, 31
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ _PROCEDURE_LINKAGE_TABLE_();
void strncpy() {
  _PROCEDURE_LINKAGE_TABLE_();
  return;
}


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

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

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

LLVM IR (-O2):
define void @strncpy() {
%1 = tail call i32 (...) @_PROCEDURE_LINKAGE_TABLE_()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void lastrow(int j, int i, int n) {
  j = 2 * n - 1;
  for (i = 0; i < j; i++)
    printf("*");
  printf("\n");
}


x86 assembly (clang, -O0):
<lastrow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115a <lastrow+0x4a>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1134 <lastrow+0x24>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lastrow>:
push   %rbx
test   %edx,%edx
jle    113f <lastrow+0x2f>
lea    (%rdx,%rdx,1),%eax
add    $0xffffffff,%eax
cmp    $0x2,%eax
mov    $0x1,%ebx
cmovge %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    $0x2a,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1130 <lastrow+0x20>
mov    $0xa,%edi
pop    %rbx
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @lastrow(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %14
5: ; preds = %3
%6 = shl nuw nsw i32 %2, 1
%7 = add i32 %6, -1
%8 = call i32 @llvm.smax.i32(i32 %7, i32 1)
br label %9
9: ; preds = %5, %9
%10 = phi i32 [ %12, %9 ], [ 0, %5 ]
%11 = tail call i32 @putchar(i32 42)
%12 = add nuw nsw i32 %10, 1
%13 = icmp eq i32 %12, %8
br i1 %13, label %14, label %9
14: ; preds = %9, %3
%15 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ register_bga_function_list();
void bga_init() { register_bga_function_list(); }


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

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

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

LLVM IR (-O2):
define void @bga_init() {
%1 = tail call i32 (...) @register_bga_function_list()
ret void
}
void f3() {
  extern void f4();
  void (*_dummy0)() = &****f4;
}


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

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

LLVM IR (-O0):
define void @f3() {
%1 = alloca void (...)*
store void (...)* @f4, void (...)** %1
ret void
}

LLVM IR (-O2):
define void @f3() {
ret void
}
void __hv_mul_f(float bIn0, float bIn1, float *bOut) { *bOut = bIn0 * bIn1; }


x86 assembly (clang, -O0):
<__hv_mul_f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__hv_mul_f>:
mulss  %xmm1,%xmm0
movss  %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @__hv_mul_f(float %0, float %1, float* %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float*
store float %0, float* %4
store float %1, float* %5
store float* %2, float** %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = fmul float %7, %8
%10 = load float*, float** %6
store float %9, float* %10
ret void
}

LLVM IR (-O2):
define void @__hv_mul_f(float %0, float %1, float* nocapture writeonly %2) {
%4 = fmul float %0, %1
store float %4, float* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void clean() { printf("\033[H\033[J"); }


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

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

LLVM IR (-O0):
@.str = [7 x i8] c"\1B[H\1B[J\00"
define void @clean() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"\1B[H\1B[J\00"
define void @clean() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ BlinkC__Timer0__startPeriodic(int);
int /*<<< orphan*/ BlinkC__Timer1__startPeriodic(int);
int /*<<< orphan*/ BlinkC__Timer2__startPeriodic(int);
void BlinkC__Boot__booted(void) {
  BlinkC__Timer0__startPeriodic(250);
  BlinkC__Timer1__startPeriodic(500);
  BlinkC__Timer2__startPeriodic(1000);
}


x86 assembly (clang, -O0):
<BlinkC__Boot__booted>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfa,%edi
call   1040 <BlinkC__Timer0__startPeriodic@plt>
mov    $0x1f4,%edi
call   1050 <BlinkC__Timer1__startPeriodic@plt>
mov    $0x3e8,%edi
call   1030 <BlinkC__Timer2__startPeriodic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<BlinkC__Boot__booted>:
push   %rax
mov    $0xfa,%edi
call   1040 <BlinkC__Timer0__startPeriodic@plt>
mov    $0x1f4,%edi
call   1050 <BlinkC__Timer1__startPeriodic@plt>
mov    $0x3e8,%edi
pop    %rax
jmp    1030 <BlinkC__Timer2__startPeriodic@plt>

LLVM IR (-O0):
define void @BlinkC__Boot__booted() {
%1 = call i32 @BlinkC__Timer0__startPeriodic(i32 250)
%2 = call i32 @BlinkC__Timer1__startPeriodic(i32 500)
%3 = call i32 @BlinkC__Timer2__startPeriodic(i32 1000)
ret void
}

LLVM IR (-O2):
define void @BlinkC__Boot__booted() {
%1 = tail call i32 @BlinkC__Timer0__startPeriodic(i32 250)
%2 = tail call i32 @BlinkC__Timer1__startPeriodic(i32 500)
%3 = tail call i32 @BlinkC__Timer2__startPeriodic(i32 1000)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ getUserPath(char **);
char *getenv(char *);
int /*<<< orphan*/ strmcat(char **, char *);
void getConfigHome(char **path) {
  char *configHome = getenv("XDG_CONFIG_HOME");
  if (configHome)
    strmcat(path, configHome);
  else {
    getUserPath(path);
    strmcat(path, "/.config");
  }
}


x86 assembly (clang, -O0):
<getConfigHome>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1169 <getConfigHome+0x39>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strmcat@plt>
jmp    1182 <getConfigHome+0x52>
mov    -0x8(%rbp),%rdi
call   1040 <getUserPath@plt>
mov    -0x8(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1050 <strmcat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getConfigHome>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1151 <getConfigHome+0x21>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1050 <strmcat@plt>
mov    %rbx,%rdi
call   1040 <getUserPath@plt>
lea    0xeb0(%rip),%rsi
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <strmcat@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"XDG_CONFIG_HOME\00"
@.str.1 = [9 x i8] c"/.config\00"
define void @getConfigHome(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
store i8** %0, i8*** %2
%4 = call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8**, i8*** %2
%9 = load i8*, i8** %3
%10 = call i32 @strmcat(i8** %8, i8* %9)
br label %16
11: ; preds = %1
%12 = load i8**, i8*** %2
%13 = call i32 @getUserPath(i8** %12)
%14 = load i8**, i8*** %2
%15 = call i32 @strmcat(i8** %14, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %11, %7
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"XDG_CONFIG_HOME\00"
@.str.1 = [9 x i8] c"/.config\00"
define void @getConfigHome(i8** %0) {
%2 = tail call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @strmcat(i8** %0, i8* %2)
br label %9
6: ; preds = %1
%7 = tail call i32 @getUserPath(i8** %0)
%8 = tail call i32 @strmcat(i8** %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %6, %4
ret void
}
int main() {
  int arr[] = {2, 4, 7, 9};
  int *ptr = arr + 2;
  return *ptr;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 7
}
/* Variables and functions */
int /*<<< orphan*/ grid_ins_init();
void grid_inproc_init(void) { grid_ins_init(); }


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

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

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

LLVM IR (-O2):
define void @grid_inproc_init() {
%1 = tail call i32 (...) @grid_ins_init()
ret void
}
void dummy_callback(void) { return; }


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

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

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

LLVM IR (-O2):
define void @dummy_callback() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void display_usage() {
  printf(""
         "lictool - PS1 license file manipulation tool\n"
         "usage: lictool <input> <output> <options>\n"
         "\n"
         "Options:\n"
         " -tmd=<file>      TMD file for boot logo\n"
         " -removelogo      Remove logo from license file\n");
}


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

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

LLVM IR (-O0):
@.str = [187 x i8] c"lictool - PS1 license file manipulation tool\0Ausage: lictool <input> <output> <options>\0A\0AOptions:\0A -tmd=<file> TMD file for boot logo\0A -removelogo Remove logo from license file\0A\00"
define void @display_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([187 x i8], [187 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [186 x i8] c"lictool - PS1 license file manipulation tool\0Ausage: lictool <input> <output> <options>\0A\0AOptions:\0A -tmd=<file> TMD file for boot logo\0A -removelogo Remove logo from license file\00"
define void @display_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([186 x i8], [186 x i8]* @str, i64 0, i64 0))
ret void
}
int C_Utils_compare_ulonglong(const unsigned long long item1,
                              const unsigned long long item2) {
  if (item1 == item2)
    return 0;
  return item1 < item2 ? -1 : 1;
}


x86 assembly (clang, -O0):
<C_Utils_compare_ulonglong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1126 <C_Utils_compare_ulonglong+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1141 <C_Utils_compare_ulonglong+0x41>
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rsi
mov    $0x1,%eax
mov    $0xffffffff,%ecx
cmp    %rsi,%rdx
cmovb  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_Utils_compare_ulonglong>:
xor    %ecx,%ecx
xor    %eax,%eax
cmp    %rsi,%rdi
setae  %al
lea    -0x1(%rax,%rax,1),%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @C_Utils_compare_ulonglong(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, %1
%4 = icmp ult i64 %0, %1
%5 = select i1 %4, i32 -1, i32 1
%6 = select i1 %3, i32 0, i32 %5
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void fmm_print(uint32_t gpu_id) {}


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

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

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

LLVM IR (-O2):
define void @fmm_print(i32 %0) {
ret void
}
unsigned long str_hash_2(const void *key) {
  do {
    unsigned long _result_ = 0;
    do {
      unsigned char const *_key_ =
          (unsigned char const *)(((const char *)key)) - 1;
      while (*++_key_)
        (_result_) += (*_key_ << (_key_[1] & 0x7));
    } while (0);
    return _result_;
  } while (0);
}


x86 assembly (clang, -O0):
<str_hash_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
cmpb   $0x0,0x1(%rax)
je     1158 <str_hash_2+0x58>
mov    -0x18(%rbp),%rax
movzbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
and    $0x7,%ecx
shl    %cl,%eax
cltq
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    111c <str_hash_2+0x1c>
jmp    115d <str_hash_2+0x5d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_hash_2>:
mov    (%rdi),%cl
test   %cl,%cl
je     112d <str_hash_2+0x2d>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movzbl %cl,%edx
movzbl (%rdi),%esi
mov    %esi,%ecx
and    $0x7,%cl
shl    %cl,%rdx
add    %rdx,%rax
add    $0x1,%rdi
mov    %esi,%ecx
test   %sil,%sil
jne    1110 <str_hash_2+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @str_hash_2(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
br label %5
5: ; preds = %1
store i64 0, i64* %3
br label %6
6: ; preds = %5
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 -1
store i8* %8, i8** %4
br label %9
9: ; preds = %14, %6
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i32 1
store i8* %11, i8** %4
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %27
14: ; preds = %9
%15 = load i8*, i8** %4
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = and i32 %21, 7
%23 = shl i32 %17, %22
%24 = sext i32 %23 to i64
%25 = load i64, i64* %3
%26 = add i64 %25, %24
store i64 %26, i64* %3
br label %9
27: ; preds = %9
br label %28
28: ; preds = %27
%29 = load i64, i64* %3
br label %30
30: ; preds = %28
ret i64 %29
}

LLVM IR (-O2):
define i64 @str_hash_2(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %22, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 -1
br label %6
6: ; preds = %4, %6
%7 = phi i8 [ %20, %6 ], [ %2, %4 ]
%8 = phi i8* [ %19, %6 ], [ %0, %4 ]
%9 = phi i8* [ %8, %6 ], [ %5, %4 ]
%10 = phi i64 [ %18, %6 ], [ 0, %4 ]
%11 = zext i8 %7 to i32
%12 = getelementptr inbounds i8, i8* %9, i64 2
%13 = load i8, i8* %12
%14 = and i8 %13, 7
%15 = zext i8 %14 to i32
%16 = shl nuw nsw i32 %11, %15
%17 = zext i32 %16 to i64
%18 = add i64 %10, %17
%19 = getelementptr inbounds i8, i8* %8, i64 1
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %22, label %6
22: ; preds = %6, %1
%23 = phi i64 [ 0, %1 ], [ %18, %6 ]
ret i64 %23
}
/* Variables and functions */
long atol(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ syscall(int, long);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("Pass Process ID as command line argument\n");
    return 0;
  }
  long pid = atol(argv[1]);
  syscall(290, pid);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1168 <main+0x38>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    118e <main+0x5e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x122,%edi
call   1040 <syscall@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    114e <main+0x1e>
mov    0x8(%rsi),%rdi
call   1050 <atol@plt>
mov    $0x122,%edi
mov    %rax,%rsi
call   1040 <syscall@plt>
jmp    115a <main+0x2a>
lea    0xeab(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Pass Process ID as command line argument\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %18
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i64 @atol(i8* %14)
store i64 %15, i64* %6
%16 = load i64, i64* %6
%17 = call i32 @syscall(i32 290, i64 %16)
store i32 0, i32* %3
br label %18
18: ; preds = %11, %9
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@str = [41 x i8] c"Pass Process ID as command line argument\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
br label %11
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @atol(i8* %8)
%10 = tail call i32 @syscall(i32 290, i64 %9)
br label %11
11: ; preds = %6, %4
ret i32 0
}
signed char convert_unsigned_char_to_signed_char(unsigned char x) { return x; }


x86 assembly (clang, -O0):
<convert_unsigned_char_to_signed_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_unsigned_char_to_signed_char>:
mov    %edi,%eax
ret

LLVM IR (-O0):
define signext i8 @convert_unsigned_char_to_signed_char(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
ret i8 %3
}

LLVM IR (-O2):
define signext i8 @convert_unsigned_char_to_signed_char(i8 returned zeroext %0) {
ret i8 %0
}
/* Variables and functions */
int relbranch(int, char *, char *, char *);
int searchcond(int, char *, char **);
int jr(int code, char *label, char *mnemo, char *oper) {
  char *operand2;
  code = 0x20 + (searchcond(4, oper, &operand2) << 3);
  return relbranch(code, label, mnemo, operand2);
}


x86 assembly (clang, -O0):
<jr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
mov    $0x4,%edi
lea    -0x28(%rbp),%rdx
call   1040 <searchcond@plt>
shl    $0x3,%eax
add    $0x20,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x28(%rbp),%rcx
call   1030 <relbranch@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jr>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rsp,%rdx
mov    $0x4,%edi
mov    %rcx,%rsi
call   1040 <searchcond@plt>
lea    0x20(,%rax,8),%edi
mov    (%rsp),%rcx
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <relbranch@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @jr(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %8
%11 = call i32 @searchcond(i32 4, i8* %10, i8** %9)
%12 = shl i32 %11, 3
%13 = add nsw i32 32, %12
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = load i8*, i8** %6
%16 = load i8*, i8** %7
%17 = load i8*, i8** %9
%18 = call i32 @relbranch(i32 %14, i8* %15, i8* %16, i8* %17)
ret i32 %18
}

LLVM IR (-O2):
define i32 @jr(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = bitcast i8** %5 to i8*
%7 = call i32 @searchcond(i32 4, i8* %3, i8** %5)
%8 = shl i32 %7, 3
%9 = add nsw i32 %8, 32
%10 = load i8*, i8** %5
%11 = call i32 @relbranch(i32 %9, i8* %1, i8* %2, i8* %10)
ret i32 %11
}
unsigned long memory_study_next_id() {
  ;
  static unsigned long long id = 0;
  id++;
  return id;
}


x86 assembly (clang, -O0):
<memory_study_next_id>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1d(%rip),%rax
add    $0x1,%rax
mov    %rax,0x2f12(%rip)
mov    0x2f0b(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memory_study_next_id>:
mov    0x2f21(%rip),%rax
add    $0x1,%rax
mov    %rax,0x2f16(%rip)
ret

LLVM IR (-O0):
@memory_study_next_id.id = internal global i64 0
define i64 @memory_study_next_id() {
%1 = load i64, i64* @memory_study_next_id.id
%2 = add i64 %1, 1
store i64 %2, i64* @memory_study_next_id.id
%3 = load i64, i64* @memory_study_next_id.id
ret i64 %3
}

LLVM IR (-O2):
@memory_study_next_id.id = internal unnamed_addr global i64 0
define i64 @memory_study_next_id() {
%1 = load i64, i64* @memory_study_next_id.id
%2 = add i64 %1, 1
store i64 %2, i64* @memory_study_next_id.id
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
void system_error(char *errmsg) {
  fprintf(stderr, "[Error] %s\n", errmsg);
  perror("[Error] Reason");
  exit(1);
}


x86 assembly (clang, -O0):
<system_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeb0(%rip),%rsi
call   1030 <fprintf@plt>
lea    0xeb0(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<system_error>:
push   %rax
mov    %rdi,%rdx
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rsi
call   1030 <fprintf@plt>
lea    0xebc(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"[Error] %s\0A\00"
@.str.1 = [15 x i8] c"[Error] Reason\00"
define void @system_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"[Error] %s\0A\00"
@.str.1 = [15 x i8] c"[Error] Reason\00"
define void @system_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ call(char *);
div() { call("ccdiv"); }


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"ccdiv\00"
define i32 @div() {
%1 = alloca i32
%2 = call i32 @call(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [6 x i8] c"ccdiv\00"
define i32 @div() {
%1 = tail call i32 @call(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int snprintf(char *, int, char *, char const *);
int json_emit_raw_str(char *buf, int buf_len, const char *str) {
  return buf_len <= 0 ? 0 : snprintf(buf, buf_len, "%s", str);
}


x86 assembly (clang, -O0):
<json_emit_raw_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     1137 <json_emit_raw_str+0x27>
xor    %eax,%eax
mov    %eax,-0x1c(%rbp)
jmp    1151 <json_emit_raw_str+0x41>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rcx
lea    0xeb7(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<json_emit_raw_str>:
test   %esi,%esi
jle    1123 <json_emit_raw_str+0x13>
mov    %rdx,%rcx
lea    0xee2(%rip),%rdx
jmp    1030 <snprintf@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @json_emit_raw_str(i8* %0, i32 %1, i8* %2) {
%4 = icmp slt i32 %1, 1
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @snprintf(i8* %0, i32 %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %7
7: ; preds = %3, %5
%8 = phi i32 [ %6, %5 ], [ 0, %3 ]
ret i32 %8
}
/* Variables and functions */
char *rindex(char const *, char);
const char *filename_to_classname(const char *filename) {
  const char *ret;
  ret = rindex(filename, '/');
  if (ret)
    return ret + 1;
  return filename;
}


x86 assembly (clang, -O0):
<filename_to_classname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <rindex@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     114a <filename_to_classname+0x3a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1152 <filename_to_classname+0x42>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filename_to_classname>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <rindex@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @filename_to_classname(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @rindex(i8* %5, i8 signext 47)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 1
store i8* %11, i8** %2
br label %14
12: ; preds = %1
%13 = load i8*, i8** %3
store i8* %13, i8** %2
br label %14
14: ; preds = %12, %9
%15 = load i8*, i8** %2
ret i8* %15
}

LLVM IR (-O2):
define i8* @filename_to_classname(i8* %0) {
%2 = tail call i8* @rindex(i8* %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void EMACTimestampAddendSet(uint32_t ui32Base, uint32_t ui32Increment) {
  ;
  (*((volatile uint32_t *)(ui32Base + 0x00000718))) = ui32Increment;
  while ((*((volatile uint32_t *)(ui32Base + 0x00000700))) & 0x00000020) {
  }
  (*((volatile uint32_t *)(ui32Base + 0x00000700))) |= 0x00000020;
}


x86 assembly (clang, -O0):
<EMACTimestampAddendSet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
add    $0x718,%eax
cltq
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x700,%eax
cltq
mov    (%rax),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1136 <EMACTimestampAddendSet+0x36>
jmp    1119 <EMACTimestampAddendSet+0x19>
mov    -0x4(%rbp),%eax
add    $0x700,%eax
cltq
mov    (%rax),%ecx
or     $0x20,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<EMACTimestampAddendSet>:
movslq %edi,%rax
mov    %esi,0x718(%rax)
nopl   0x0(%rax)
testl  $0x20,0x700(%rax)
jne    1110 <EMACTimestampAddendSet+0x10>
orl    $0x20,0x700(%rax)
ret

LLVM IR (-O0):
define void @EMACTimestampAddendSet(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32, i32* %3
%7 = add nsw i32 %6, 1816
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
store volatile i32 %5, i32* %9
br label %10
10: ; preds = %18, %2
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1792
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
%15 = load volatile i32, i32* %14
%16 = and i32 %15, 32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %10
br label %10
19: ; preds = %10
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1792
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i32*
%24 = load volatile i32, i32* %23
%25 = or i32 %24, 32
store volatile i32 %25, i32* %23
ret void
}

LLVM IR (-O2):
define void @EMACTimestampAddendSet(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 1816
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
store volatile i32 %1, i32* %5
%6 = add nsw i32 %0, 1792
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
br label %9
9: ; preds = %9, %2
%10 = load volatile i32, i32* %8
%11 = and i32 %10, 32
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %9
13: ; preds = %9
%14 = load volatile i32, i32* %8
%15 = or i32 %14, 32
store volatile i32 %15, i32* %8
ret void
}
void catch_hup(int signo) {}


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

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

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

LLVM IR (-O2):
define void @catch_hup(i32 %0) {
ret void
}
void BN_mod_sqrt(void) {}


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

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

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

LLVM IR (-O2):
define void @BN_mod_sqrt() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ unlink(char const *);
void sdb_unlock(const char *s) { unlink(s); }


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

x86 assembly (clang, -O2):
<sdb_unlock>:
jmp    1030 <unlink@plt>

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

LLVM IR (-O2):
define void @sdb_unlock(i8* nocapture %0) {
%2 = tail call i32 @unlink(i8* %0)
ret void
}
int portaudio_is_eof(struct audiotap *audiotap) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.audiotap = type opaque
define i32 @portaudio_is_eof(%struct.audiotap* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
struct msghdr {
  int dummy;
};
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/
socketcall_cp(int /*<<< orphan*/ (*)(int, struct msghdr const *, int), int,
              struct msghdr const *, int, int /*<<< orphan*/,
              int /*<<< orphan*/, int /*<<< orphan*/);
ssize_t sendmsg(int fd, const struct msghdr *msg, int flags) {
  return socketcall_cp(sendmsg, fd, msg, flags, 0, 0, 0);
}


x86 assembly (clang, -O0):
<sendmsg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    0x2eb5(%rip),%rdi
xor    %r9d,%r9d
mov    %r9d,%r8d
movl   $0x0,(%rsp)
call   1030 <socketcall_cp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendmsg>:
push   %rax
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %edi,%esi
movl   $0x0,(%rsp)
mov    0x2ec2(%rip),%rdi
xor    %r8d,%r8d
xor    %r9d,%r9d
call   1030 <socketcall_cp@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.msghdr = type { i32 }
define i32 @sendmsg(i32 %0, %struct.msghdr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.msghdr*
%6 = alloca i32
store i32 %0, i32* %4
store %struct.msghdr* %1, %struct.msghdr** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load %struct.msghdr*, %struct.msghdr** %5
%9 = load i32, i32* %6
%10 = call i32 @socketcall_cp(i32 (i32, %struct.msghdr*, i32)* @sendmsg, i32 %7, %struct.msghdr* %8, i32 %9, i32 0, i32 0, i32 0)
ret i32 %10
}

LLVM IR (-O2):
%struct.msghdr = type { i32 }
define i32 @sendmsg(i32 %0, %struct.msghdr* %1, i32 %2) {
%4 = tail call i32 @socketcall_cp(i32 (i32, %struct.msghdr*, i32)* @sendmsg, i32 %0, %struct.msghdr* %1, i32 %2, i32 0, i32 0, i32 0)
ret i32 %4
}
/* Type definitions */
typedef int int8_t;

/* Variables and functions */
int8_t min_8(int8_t a, int8_t b) { return b + ((a - b) & ((a - b) >> 7)); }


x86 assembly (clang, -O0):
<min_8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%edx
sub    -0x8(%rbp),%edx
sar    $0x7,%edx
and    %edx,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min_8>:
sub    %esi,%edi
mov    %edi,%eax
sar    $0x7,%eax
and    %edi,%eax
add    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @min_8(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
%4 = ashr i32 %3, 7
%5 = and i32 %4, %3
%6 = add nsw i32 %5, %1
ret i32 %6
}