xunge/DecIR huggingface dataset:
/* Type definitions */
struct cmus_opt {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ error_msg(char *, char const *);
struct cmus_opt *option_find_silent(char const *);
struct cmus_opt *option_find(const char *name) {
  struct cmus_opt *opt = option_find_silent(name);
  if (opt == NULL)
    error_msg("no such option %s", name);
  return opt;
}


x86 assembly (clang, -O0):
<option_find>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <option_find_silent@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1154 <option_find+0x34>
mov    -0x8(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1030 <error_msg@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<option_find>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <option_find_silent@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1143 <option_find+0x23>
lea    0xec5(%rip),%rdi
mov    %r14,%rsi
call   1030 <error_msg@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.cmus_opt = type { i32 }
@.str = [18 x i8] c"no such option %s\00"
define %struct.cmus_opt* @option_find(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.cmus_opt*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call %struct.cmus_opt* @option_find_silent(i8* %4)
store %struct.cmus_opt* %5, %struct.cmus_opt** %3
%6 = load %struct.cmus_opt*, %struct.cmus_opt** %3
%7 = icmp eq %struct.cmus_opt* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = call i32 @error_msg(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %1
%12 = load %struct.cmus_opt*, %struct.cmus_opt** %3
ret %struct.cmus_opt* %12
}

LLVM IR (-O2):
%struct.cmus_opt = type { i32 }
@.str = [18 x i8] c"no such option %s\00"
define %struct.cmus_opt* @option_find(i8* %0) {
%2 = tail call %struct.cmus_opt* @option_find_silent(i8* %0)
%3 = icmp eq %struct.cmus_opt* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @error_msg(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %4, %1
ret %struct.cmus_opt* %2
}
int main() {
  2 + 3;
  return 4;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 4
}
void swapshort(unsigned short *s) {
  *s = ((*s >> 8) & 0xff) | ((*s & 0xff) << 8);
}


x86 assembly (clang, -O0):
<swapshort>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    -0x8(%rbp),%rcx
movzwl (%rcx),%ecx
and    $0xff,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    %ax,%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapshort>:
rolw   $0x8,(%rdi)
ret

LLVM IR (-O0):
define void @swapshort(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = ashr i32 %5, 8
%7 = and i32 %6, 255
%8 = load i16*, i16** %2
%9 = load i16, i16* %8
%10 = zext i16 %9 to i32
%11 = and i32 %10, 255
%12 = shl i32 %11, 8
%13 = or i32 %7, %12
%14 = trunc i32 %13 to i16
%15 = load i16*, i16** %2
store i16 %14, i16* %15
ret void
}

LLVM IR (-O2):
define void @swapshort(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = tail call i16 @llvm.bswap.i16(i16 %2)
store i16 %3, i16* %0
ret void
}
/* Variables and functions */
int PAPI_stop(int, long long *);
void papif_stop_(int *EventSet, long long *values, int *check) {
  *check = PAPI_stop(*EventSet, values);
}


x86 assembly (clang, -O0):
<papif_stop_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
call   1030 <PAPI_stop@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @papif_stop_(i32* %0, i64* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i64*
%6 = alloca i32*
store i32* %0, i32** %4
store i64* %1, i64** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %7
%9 = load i64*, i64** %5
%10 = call i32 @PAPI_stop(i32 %8, i64* %9)
%11 = load i32*, i32** %6
store i32 %10, i32* %11
ret void
}

LLVM IR (-O2):
define void @papif_stop_(i32* nocapture %0, i64* %1, i32* nocapture writeonly %2) {
%4 = load i32, i32* %0
%5 = tail call i32 @PAPI_stop(i32 %4, i64* %1)
store i32 %5, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern void hello() { printf("Hello, CRake World!\n"); }


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"Hello, CRake World!\0A\00"
define void @hello() {
%1 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [20 x i8] c"Hello, CRake World!\00"
define void @hello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
__attribute__((visibility("default"))) int get_stnodep_value(void) { return 2; }


x86 assembly (clang, -O0):
<get_stnodep_value>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @get_stnodep_value() {
ret i32 2
}

LLVM IR (-O2):
define i32 @get_stnodep_value() {
ret i32 2
}
unsigned index_select(void *context, unsigned idx) {
  return ((unsigned *)context)[idx];
}


x86 assembly (clang, -O0):
<index_select>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<index_select>:
mov    %esi,%eax
mov    (%rdi,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @index_select(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %4
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %6, i64 %8
%10 = load i32, i32* %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @index_select(i8* nocapture %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
%4 = zext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %3, i64 %4
%6 = load i32, i32* %5
ret i32 %6
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ ssd1306_write_command(int);
void ssd1306_set_display_start_line_address(uint8_t address) {
  address &= 0x3F;
  ssd1306_write_command((0x40 | (address)));
}


x86 assembly (clang, -O0):
<ssd1306_set_display_start_line_address>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x3f,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
or     $0x40,%edi
call   1030 <ssd1306_write_command@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssd1306_set_display_start_line_address>:
and    $0x3f,%edi
or     $0x40,%edi
jmp    1030 <ssd1306_write_command@plt>

LLVM IR (-O0):
define void @ssd1306_set_display_start_line_address(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 63
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = or i32 64, %5
%7 = call i32 @ssd1306_write_command(i32 %6)
ret void
}

LLVM IR (-O2):
define void @ssd1306_set_display_start_line_address(i32 %0) {
%2 = and i32 %0, 63
%3 = or i32 %2, 64
%4 = tail call i32 @ssd1306_write_command(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Msp430GpioC__7__GeneralIO__makeOutput();
void CC2420ControlP__RSTN__makeOutput(void) {
  Msp430GpioC__7__GeneralIO__makeOutput();
}


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

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

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

LLVM IR (-O2):
define void @CC2420ControlP__RSTN__makeOutput() {
%1 = tail call i32 (...) @Msp430GpioC__7__GeneralIO__makeOutput()
ret void
}
/* Variables and functions */
int v4l1_close(int);
__attribute__((visibility("default"))) int close(int fd) {
  return v4l1_close(fd);
}


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

x86 assembly (clang, -O2):
<close>:
jmp    1030 <v4l1_close@plt>

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

LLVM IR (-O2):
define i32 @close(i32 %0) {
%2 = tail call i32 @v4l1_close(i32 %0)
ret i32 %2
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int send_event;
};
typedef TYPE_1__ XFocusOutEvent;

/* Variables and functions */
void set_XFocusOutEvent_send_event(void *_p, int _v) {
  ((XFocusOutEvent *)_p)->send_event = (int)_v;
}


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

x86 assembly (clang, -O2):
<set_XFocusOutEvent_send_event>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define void @set_XFocusOutEvent_send_event(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 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @set_XFocusOutEvent_send_event(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
void autoStructTest() {
  struct s1 {
    char a;
    char b;
  } t1;
  struct s2 {
    struct s1 c;
  } t2 = {t1};
  struct s1 t3[] = {t1, t1, "abc", 0};
  int t4[sizeof t3 == 6 ? 1 : -1];
}


x86 assembly (clang, -O0):
<autoStructTest>:
push   %rbp
mov    %rsp,%rbp
mov    -0x8(%rbp),%ax
mov    %ax,-0x10(%rbp)
mov    -0x8(%rbp),%ax
mov    %ax,-0x18(%rbp)
mov    -0x8(%rbp),%ax
mov    %ax,-0x16(%rbp)
lea    0xedd(%rip),%rax
mov    %al,-0x14(%rbp)
movb   $0x0,-0x13(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.s1 = type { i8, i8 }
%struct.s2 = type { %struct.s1 }
@.str = [4 x i8] c"abc\00"
define void @autoStructTest() {
%1 = alloca %struct.s1
%2 = alloca %struct.s2
%3 = alloca [3 x %struct.s1]
%4 = alloca [1 x i32]
%5 = getelementptr inbounds %struct.s2, %struct.s2* %2, i32 0, i32 0
%6 = bitcast %struct.s1* %5 to i8*
%7 = bitcast %struct.s1* %1 to i8*
%8 = getelementptr inbounds [3 x %struct.s1], [3 x %struct.s1]* %3, i64 0, i64 0
%9 = bitcast %struct.s1* %8 to i8*
%10 = bitcast %struct.s1* %1 to i8*
%11 = getelementptr inbounds %struct.s1, %struct.s1* %8, i64 1
%12 = bitcast %struct.s1* %11 to i8*
%13 = bitcast %struct.s1* %1 to i8*
%14 = getelementptr inbounds %struct.s1, %struct.s1* %11, i64 1
%15 = getelementptr inbounds %struct.s1, %struct.s1* %14, i32 0, i32 0
store i8 ptrtoint ([4 x i8]* @.str to i8), i8* %15
%16 = getelementptr inbounds %struct.s1, %struct.s1* %14, i32 0, i32 1
store i8 0, i8* %16
ret void
}

LLVM IR (-O2):
%struct.s1 = type { i8, i8 }
define void @autoStructTest() {
ret void
}
unsigned long __readq(void *addr) { return *(volatile unsigned long *)addr; }


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

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

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

LLVM IR (-O2):
define i64 @__readq(i8* %0) {
%2 = bitcast i8* %0 to i64*
%3 = load volatile i64, i64* %2
ret i64 %3
}
/* Variables and functions */
unsigned long ULONG_MAX;
int /*<<< orphan*/ printf(char *, unsigned long);
int main() {
  unsigned long ul = (unsigned long)-1L;
  printf("%lu\n", ul);
  printf("%lu\n", ULONG_MAX);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xffffffffffffffff,%rsi
call   1030 <printf@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lu\0A\00"
@ULONG_MAX = global i64 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
store i64 -1, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %3)
%5 = load i64, i64* @ULONG_MAX
%6 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lu\0A\00"
@ULONG_MAX = global i64 0
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 -1)
%2 = load i64, i64* @ULONG_MAX
%3 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %2)
ret i32 0
}
void nd_dump_stack(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int fileExists(const char *path) {
  FILE *fd = fopen(path, "r");
  if (fd) {
    fclose(fd);
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<fileExists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1160 <fileExists+0x40>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x1,-0x4(%rbp)
jmp    1167 <fileExists+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileExists>:
push   %rax
lea    0xed8(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1141 <fileExists+0x21>
mov    %rax,%rdi
call   1030 <fclose@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32 @fileExists(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @fclose(i32* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char const *, char const *);
int fopen_s(FILE **pFile, const char *filename, const char *mode) {
  *pFile = fopen(filename, mode);
  return 0;
}


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

x86 assembly (clang, -O2):
<fopen_s>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1030 <fopen@plt>
mov    %rax,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @fopen_s(i32** nocapture writeonly %0, i8* nocapture %1, i8* nocapture %2) {
%4 = tail call i32* @fopen(i8* %1, i8* %2)
store i32* %4, i32** %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ getop(char const *);
void add_unique_operator_name(const char *name) { getop(name); }


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

x86 assembly (clang, -O2):
<add_unique_operator_name>:
jmp    1030 <getop@plt>

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

LLVM IR (-O2):
define void @add_unique_operator_name(i8* %0) {
%2 = tail call i32 @getop(i8* %0)
ret void
}
int i(int x) {
  int y;
  y = 10;
  while (x < 10) {
    while (x + y > 15) {
      if (x < 3) {
        break;
      }
      y = y - 2;
    }
    if (x < 3) {
      continue;
    }
  }
}


x86 assembly (clang, -O0):
<i>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    115d <i+0x5d>
jmp    111d <i+0x1d>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0xf,%eax
jle    1149 <i+0x49>
cmpl   $0x3,-0x8(%rbp)
jge    113b <i+0x3b>
jmp    1149 <i+0x49>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    111d <i+0x1d>
cmpl   $0x3,-0x8(%rbp)
jge    1158 <i+0x58>
jmp    110e <i+0xe>
jmp    110e <i+0xe>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @i(i32 %0) {
ret i32 undef
}
/* Variables and functions */
int hash(char *);
int getHash(char *str, int tableSize) { return (hash(str) % tableSize) + 1; }


x86 assembly (clang, -O0):
<getHash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <hash@plt>
cltd
idivl  -0xc(%rbp)
mov    %edx,%eax
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getHash>:
push   %rbx
mov    %esi,%ebx
call   1030 <hash@plt>
cltd
idiv   %ebx
lea    0x1(%rdx),%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @getHash(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = call i32 @hash(i8* %5)
%7 = load i32, i32* %4
%8 = srem i32 %6, %7
%9 = add nsw i32 %8, 1
ret i32 %9
}

LLVM IR (-O2):
define i32 @getHash(i8* %0, i32 %1) {
%3 = tail call i32 @hash(i8* %0)
%4 = srem i32 %3, %1
%5 = add nsw i32 %4, 1
ret i32 %5
}
/* Type definitions */
struct sockaddr_in {
  int dummy;
};
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void Bind(int listenfd, struct sockaddr_in *servaddr) {
  if (bind(listenfd, (struct sockaddr *)servaddr, sizeof(*servaddr)) == -1) {
    perror("bind");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<Bind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x4,%edx
call   1030 <bind@plt>
cmp    $0xffffffff,%eax
jne    116f <Bind+0x3f>
lea    0xea0(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Bind>:
push   %rax
mov    $0x4,%edx
call   1030 <bind@plt>
cmp    $0xffffffff,%eax
je     1142 <Bind+0x12>
pop    %rax
ret
lea    0xeb7(%rip),%rdi
call   1040 <perror@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [5 x i8] c"bind\00"
define void @Bind(i32 %0, %struct.sockaddr_in* %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in*
store i32 %0, i32* %3
store %struct.sockaddr_in* %1, %struct.sockaddr_in** %4
%5 = load i32, i32* %3
%6 = load %struct.sockaddr_in*, %struct.sockaddr_in** %4
%7 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%8 = call i32 @bind(i32 %5, %struct.sockaddr* %7, i32 4)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [5 x i8] c"bind\00"
define void @Bind(i32 %0, %struct.sockaddr_in* %1) {
%3 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%4 = tail call i32 @bind(i32 %0, %struct.sockaddr* %3, i32 4)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
ret void
}
int screen_reinit(void) { return 1; }


x86 assembly (clang, -O0):
<screen_reinit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @screen_reinit() {
ret i32 1
}

LLVM IR (-O2):
define i32 @screen_reinit() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
void scanfSample() {
  char str[100];
  scanf("%s", str);
  puts(str);
}


x86 assembly (clang, -O0):
<scanfSample>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    -0x70(%rbp),%rsi
lea    0xecd(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <puts@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scanfSample>:
push   %rbx
sub    $0x70,%rsp
lea    0xed4(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @scanfSample() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = call i32 @puts(i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @scanfSample() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @puts(i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clamp25519(unsigned char *);
void ecc_clamp(unsigned char *k) { clamp25519(k); }


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

x86 assembly (clang, -O2):
<ecc_clamp>:
jmp    1030 <clamp25519@plt>

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

LLVM IR (-O2):
define void @ecc_clamp(i8* %0) {
%2 = tail call i32 @clamp25519(i8* %0)
ret void
}
int test_imm_79uint16_mem(unsigned short *val) {
  return ((*val) & (-0x79 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_79uint16_mem>:
movzwl (%rdi),%eax
test   $0xff87,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_79uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -121
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
__attribute__((unused)) char *strchr(const char *s, int c) {
  while (*s) {
    if (*s == (char)c)
      return (char *)s;
    s++;
  }
  return ((void *)0);
}


x86 assembly (clang, -O0):
<strchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <strchr+0x4b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x14(%rbp),%ecx
movsbl %cl,%ecx
cmp    %ecx,%eax
jne    113a <strchr+0x3a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <strchr+0x53>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110b <strchr+0xb>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strchr>:
mov    (%rdi),%cl
test   %cl,%cl
je     1123 <strchr+0x23>
mov    %rdi,%rax
movsbl %sil,%edx
nopl   (%rax)
movsbl %cl,%ecx
cmp    %ecx,%edx
je     1125 <strchr+0x25>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <strchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @strchr(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2
%6 = shl i32 %1, 24
%7 = ashr exact i32 %6, 24
br label %8
8: ; preds = %5, %13
%9 = phi i8 [ %3, %5 ], [ %15, %13 ]
%10 = phi i8* [ %0, %5 ], [ %14, %13 ]
%11 = sext i8 %9 to i32
%12 = icmp eq i32 %7, %11
br i1 %12, label %17, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %8
17: ; preds = %8, %13, %2
%18 = phi i8* [ null, %2 ], [ null, %13 ], [ %10, %8 ]
ret i8* %18
}
/* Variables and functions */
scalar_t__ isalnum(int);
int is_ident_char(int c) { return isalnum(c) || c == '_'; }


x86 assembly (clang, -O0):
<is_ident_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    113f <is_ident_char+0x2f>
cmpl   $0x5f,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_ident_char>:
push   %rbx
mov    %edi,%ebx
call   1030 <isalnum@plt>
test   %rax,%rax
setne  %al
cmp    $0x5f,%ebx
sete   %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_ident_char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isalnum(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 95
br label %9
9: ; preds = %6, %1
%10 = phi i1 [ true, %1 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @is_ident_char(i32 %0) {
%2 = tail call i64 @isalnum(i32 %0)
%3 = icmp ne i64 %2, 0
%4 = icmp eq i32 %0, 95
%5 = or i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ alarm(int);
int /*<<< orphan*/ pause();
int main(void) {
  alarm(120);
  while (1)
    pause();
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x78,%edi
call   1030 <alarm@plt>
mov    $0x0,%al
call   1040 <pause@plt>
jmp    1139 <main+0x19>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x78,%edi
call   1030 <alarm@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <pause@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @alarm(i32 120)
br label %3
3: ; preds = %0, %3
%4 = call i32 (...) @pause()
br label %3
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @alarm(i32 120)
br label %2
2: ; preds = %0, %2
%3 = tail call i32 (...) @pause()
br label %2
}
int getXNr(char c) { return 8 - (c - 'A'); }


x86 assembly (clang, -O0):
<getXNr>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
sub    $0x41,%ecx
mov    $0x8,%eax
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getXNr>:
mov    $0x49,%eax
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @getXNr(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sub nsw i32 %4, 65
%6 = sub nsw i32 8, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @getXNr(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = sub nsw i32 73, %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ quick_sort_h(int *, int /*<<< orphan*/, int);
void quick_sort_hoare(register int a[], register int length) {
  quick_sort_h(a, 0, length - 1);
}


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

x86 assembly (clang, -O2):
<quick_sort_hoare>:
lea    -0x1(%rsi),%edx
xor    %esi,%esi
jmp    1030 <quick_sort_h@plt>

LLVM IR (-O0):
define void @quick_sort_hoare(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %6, 1
%8 = call i32 @quick_sort_h(i32* %5, i32 0, i32 %7)
ret void
}

LLVM IR (-O2):
define void @quick_sort_hoare(i32* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call i32 @quick_sort_h(i32* %0, i32 0, i32 %3)
ret void
}
/* Variables and functions */
size_t strlen(const char *s) {
  const char *sc = s;
  while (*sc != '\0') {
    sc++;
  }
  return sc - s;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1131 <strlen+0x31>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

LLVM IR (-O0):
define i64 @strlen(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
store i8* %4, i8** %3
br label %5
5: ; preds = %10, %1
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
br label %5
13: ; preds = %5
%14 = load i8*, i8** %3
%15 = load i8*, i8** %2
%16 = ptrtoint i8* %14 to i64
%17 = ptrtoint i8* %15 to i64
%18 = sub i64 %16, %17
ret i64 %18
}

LLVM IR (-O2):
define i64 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
ret i64 %10
}
/* Variables and functions */
bool is_comment(int chr) { return chr != '\0' && chr != '\n'; }


x86 assembly (clang, -O0):
<is_comment>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1120 <is_comment+0x20>
cmpl   $0xa,-0x4(%rbp)
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_comment>:
test   %edi,%edi
setne  %al
cmp    $0xa,%edi
setne  %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @is_comment(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = icmp ne i32 %0, 10
%4 = and i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ RamWrite32A(int, unsigned long);
void SetWaitTime(unsigned short UsWaitTime) {
  RamWrite32A(0x0000 + 0x0468, 0);
  RamWrite32A(0x0004 + 0x0000 + 0x0468, (unsigned long)(20 * UsWaitTime));
}


x86 assembly (clang, -O0):
<SetWaitTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    $0x468,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <RamWrite32A@plt>
movzwl -0x2(%rbp),%eax
imul   $0x14,%eax,%eax
movslq %eax,%rsi
mov    $0x46c,%edi
call   1030 <RamWrite32A@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetWaitTime>:
push   %rbx
mov    %edi,%ebx
mov    $0x468,%edi
xor    %esi,%esi
call   1030 <RamWrite32A@plt>
mov    %ebx,%eax
shl    $0x2,%rax
lea    (%rax,%rax,4),%rsi
mov    $0x46c,%edi
pop    %rbx
jmp    1030 <RamWrite32A@plt>

LLVM IR (-O0):
define void @SetWaitTime(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = call i32 @RamWrite32A(i32 1128, i64 0)
%4 = load i16, i16* %2
%5 = zext i16 %4 to i32
%6 = mul nsw i32 20, %5
%7 = sext i32 %6 to i64
%8 = call i32 @RamWrite32A(i32 1132, i64 %7)
ret void
}

LLVM IR (-O2):
define void @SetWaitTime(i16 zeroext %0) {
%2 = tail call i32 @RamWrite32A(i32 1128, i64 0)
%3 = zext i16 %0 to i64
%4 = mul nuw nsw i64 %3, 20
%5 = tail call i32 @RamWrite32A(i32 1132, i64 %4)
ret void
}
/* Type definitions */
struct hasht {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
void *hasht_insert(struct hasht *, char *, char *);
void test_hasht_insert_duplicate(struct hasht *t, char *k, char *v) {
  hasht_insert(t, k, v);
  void *test_v = hasht_insert(t, k, v);
  assert(test_v == NULL);
}


x86 assembly (clang, -O0):
<test_hasht_insert_duplicate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <hasht_insert@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <hasht_insert@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_hasht_insert_duplicate>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
call   1040 <hasht_insert@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1040 <hasht_insert@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <assert@plt>

LLVM IR (-O0):
%struct.hasht = type { i32 }
define void @test_hasht_insert_duplicate(%struct.hasht* %0, i8* %1, i8* %2) {
%4 = alloca %struct.hasht*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store %struct.hasht* %0, %struct.hasht** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load %struct.hasht*, %struct.hasht** %4
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = call i8* @hasht_insert(%struct.hasht* %8, i8* %9, i8* %10)
%12 = load %struct.hasht*, %struct.hasht** %4
%13 = load i8*, i8** %5
%14 = load i8*, i8** %6
%15 = call i8* @hasht_insert(%struct.hasht* %12, i8* %13, i8* %14)
store i8* %15, i8** %7
%16 = load i8*, i8** %7
%17 = icmp eq i8* %16, null
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
ret void
}

LLVM IR (-O2):
%struct.hasht = type { i32 }
define void @test_hasht_insert_duplicate(%struct.hasht* %0, i8* %1, i8* %2) {
%4 = tail call i8* @hasht_insert(%struct.hasht* %0, i8* %1, i8* %2)
%5 = tail call i8* @hasht_insert(%struct.hasht* %0, i8* %1, i8* %2)
%6 = icmp eq i8* %5, null
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
ret void
}
void userlock_wait(volatile const int *userlock) {
  while (1 == *userlock)
    ;
}


x86 assembly (clang, -O0):
<userlock_wait>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jne    1120 <userlock_wait+0x20>
jmp    1108 <userlock_wait+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<userlock_wait>:
mov    (%rdi),%eax
cmp    $0x1,%eax
je     1100 <userlock_wait>
ret

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

LLVM IR (-O2):
define void @userlock_wait(i32* %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i32, i32* %0
%4 = icmp eq i32 %3, 1
br i1 %4, label %2, label %5
5: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void displayHelp() {
  printf("StringLearn documentation\nStringLearn usage: StringLearn <string> "
         "-r <rating> -s <stlfile>\n");
}


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

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

LLVM IR (-O0):
@.str = [92 x i8] c"StringLearn documentation\0AStringLearn usage: StringLearn <string> -r <rating> -s <stlfile>\0A\00"
define void @displayHelp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [91 x i8] c"StringLearn documentation\0AStringLearn usage: StringLearn <string> -r <rating> -s <stlfile>\00"
define void @displayHelp() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([91 x i8], [91 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("\n\nHello World\n");
  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>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [14 x i8] c"\0A\0AHello World\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int ran(range)
int range;
{
  long i;
  i = rand() % range;
  return (i);
}


x86 assembly (clang, -O0):
<ran>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
cltd
idivl  -0x4(%rbp)
movslq %edx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ran>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
cltd
idiv   %ebx
mov    %edx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ran(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = call i32 (...) @rand()
%5 = load i32, i32* %2
%6 = srem i32 %4, %5
%7 = sext i32 %6 to i64
store i64 %7, i64* %3
%8 = load i64, i64* %3
%9 = trunc i64 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @ran(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, %0
ret i32 %3
}
/* Variables and functions */
int SubString(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int idx = SubString("Hello world, can you find me", "orl");
  printf("\n%d\n", idx);
  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)
lea    0xec3(%rip),%rdi
lea    0xed9(%rip),%rsi
call   1030 <SubString@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xeee(%rip),%rsi
call   1030 <SubString@plt>
lea    0xee6(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Hello world, can you find me\00"
@.str.1 = [4 x i8] c"orl\00"
@.str.2 = [5 x i8] c"\0A%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @SubString(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 %7, i32* %6
%8 = load i32, i32* %6
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Hello world, can you find me\00"
@.str.1 = [4 x i8] c"orl\00"
@.str.2 = [5 x i8] c"\0A%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @SubString(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %3)
ret i32 0
}
void agl_loaded(void) {}


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

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

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

LLVM IR (-O2):
define void @agl_loaded() {
ret void
}
/* Variables and functions */
int read_hex_nible(char *);
int read_hex_byte(char *s) {
  int a = read_hex_nible(s), b = read_hex_nible(s + 1);
  if (a < 0 || b < 0)
    return -1;
  return a << 4 | b;
}


x86 assembly (clang, -O0):
<read_hex_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <read_hex_nible@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
call   1030 <read_hex_nible@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     114c <read_hex_byte+0x3c>
cmpl   $0x0,-0x18(%rbp)
jge    1158 <read_hex_byte+0x48>
movl   $0xffffffff,-0x4(%rbp)
jmp    1164 <read_hex_byte+0x54>
mov    -0x14(%rbp),%eax
shl    $0x4,%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_hex_byte>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <read_hex_nible@plt>
mov    %eax,%ebp
add    $0x1,%rbx
mov    %rbx,%rdi
call   1030 <read_hex_nible@plt>
mov    %ebp,%ecx
shl    $0x4,%ecx
or     %eax,%ecx
or     %eax,%ebp
mov    $0xffffffff,%eax
cmovns %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @read_hex_byte(i8* %0) {
%2 = tail call i32 @read_hex_nible(i8* %0)
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = tail call i32 @read_hex_nible(i8* %3)
%5 = icmp slt i32 %2, 0
%6 = icmp slt i32 %4, 0
%7 = select i1 %5, i1 true, i1 %6
%8 = shl i32 %2, 4
%9 = or i32 %8, %4
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ ushort;

/* Variables and functions */
ushort **realloc_usmatrix(ushort **m, long nrl, long nrh, long ncl, long nch,
                          long nr) {
  return NULL;
}


x86 assembly (clang, -O0):
<realloc_usmatrix>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32** @realloc_usmatrix(i32** %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = alloca i32**
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
store i32** %0, i32*** %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store i64 %4, i64* %11
store i64 %5, i64* %12
ret i32** null
}

LLVM IR (-O2):
define noalias i32** @realloc_usmatrix(i32** nocapture readnone %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
ret i32** null
}