xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ write_flushed_data();
void *flusher(void *ignore) {
  while (1) {
    usleep(200000);
    write_flushed_data();
  }
  return NULL;
}


x86 assembly (clang, -O0):
<flusher>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x30d40,%edi
call   1040 <usleep@plt>
mov    $0x0,%al
call   1030 <write_flushed_data@plt>
jmp    112c <flusher+0xc>

x86 assembly (clang, -O2):
<flusher>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x30d40,%edi
call   1040 <usleep@plt>
xor    %eax,%eax
call   1030 <write_flushed_data@plt>
jmp    1130 <flusher+0x10>

LLVM IR (-O0):
define i8* @flusher(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %1, %3
%4 = call i32 @usleep(i32 200000)
%5 = call i32 (...) @write_flushed_data()
br label %3
}

LLVM IR (-O2):
define noalias i8* @flusher(i8* nocapture readnone %0) {
br label %2
2: ; preds = %1, %2
%3 = tail call i32 @usleep(i32 200000)
%4 = tail call i32 (...) @write_flushed_data()
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ empty_log(char *);
void d_io_enable() { empty_log("io_enable\n"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"io_enable\0A\00"
define void @d_io_enable() {
%1 = call i32 @empty_log(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"io_enable\0A\00"
define void @d_io_enable() {
%1 = tail call i32 @empty_log(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gen(char *);
void cgxor(void) { gen("xorl\t%ecx,%eax"); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"xorl\09%ecx,%eax\00"
define void @cgxor() {
%1 = call i32 @gen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"xorl\09%ecx,%eax\00"
define void @cgxor() {
%1 = tail call i32 @gen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int int_cmp(int *, int *);
int test_int_cmp(int _a, int _b) { return int_cmp(&_a, &_b); }


x86 assembly (clang, -O0):
<test_int_cmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <int_cmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_int_cmp>:
push   %rax
mov    %edi,0x4(%rsp)
mov    %esi,(%rsp)
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <int_cmp@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @test_int_cmp(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @int_cmp(i32* %3, i32* %4)
ret i32 %5
}
/* Variables and functions */
int INT_MAX;
int INT_MIN;
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("INT_MAX + 1  = %d\n", INT_MAX + 1);
  printf("INT_MIN * -1 = %d\n", INT_MIN * -1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%esi
add    $0x1,%esi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ead(%rip),%rax
imul   $0xffffffff,(%rax),%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
add    $0x1,%esi
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eb0(%rip),%rax
xor    %esi,%esi
sub    (%rax),%esi
lea    0xed8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"INT_MAX + 1 = %d\0A\00"
@INT_MAX = global i32 0
@.str.1 = [19 x i8] c"INT_MIN * -1 = %d\0A\00"
@INT_MIN = global i32 0
define i32 @main() {
%1 = load i32, i32* @INT_MAX
%2 = add nsw i32 %1, 1
%3 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = load i32, i32* @INT_MIN
%5 = mul nsw i32 %4, -1
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"INT_MAX + 1 = %d\0A\00"
@INT_MAX = global i32 0
@.str.1 = [19 x i8] c"INT_MIN * -1 = %d\0A\00"
@INT_MIN = global i32 0
define i32 @main() {
%1 = load i32, i32* @INT_MAX
%2 = add nsw i32 %1, 1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = load i32, i32* @INT_MIN
%5 = sub nsw i32 0, %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
int exactcmp(char a, char b) { return a == b; }


x86 assembly (clang, -O0):
<exactcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%eax
movsbl -0x2(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exactcmp>:
xor    %eax,%eax
cmp    %sil,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @exactcmp(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = sext i8 %5 to i32
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %6, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @exactcmp(i8 signext %0, i8 signext %1) {
%3 = icmp eq i8 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(char *s) {
  fprintf(stderr, "usage: gf_example_1 w - w must be between 1 and 32\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
lea    0xec4(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [52 x i8] c"usage: gf_example_1 w - w must be between 1 and 32\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [52 x i8] c"usage: gf_example_1 w - w must be between 1 and 32\0A\00"
define void @usage(i8* nocapture readnone %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ print_tap_result(char *, unsigned long, char const *,
                                    int /*<<< orphan*/);
int /*<<< orphan*/ safe_printf(char *);
void tap_not_ok_todo_va(unsigned long testnum, const char *msg, va_list ap) {
  print_tap_result("not ok", testnum, msg, ap);
  safe_printf(" # TODO \n");
}


x86 assembly (clang, -O0):
<tap_not_ok_todo_va>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
lea    0xebb(%rip),%rdi
call   1040 <print_tap_result@plt>
lea    0xeb6(%rip),%rdi
call   1030 <safe_printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tap_not_ok_todo_va>:
push   %rax
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xed0(%rip),%rdi
call   1040 <print_tap_result@plt>
lea    0xecb(%rip),%rdi
pop    %rax
jmp    1030 <safe_printf@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"not ok\00"
@.str.1 = [10 x i8] c" # TODO \0A\00"
define void @tap_not_ok_todo_va(i64 %0, i8* %1, i32 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
store i64 %0, i64* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i64, i64* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @print_tap_result(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %7, i8* %8, i32 %9)
%11 = call i32 @safe_printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"not ok\00"
@.str.1 = [10 x i8] c" # TODO \0A\00"
define void @tap_not_ok_todo_va(i64 %0, i8* %1, i32 %2) {
%4 = tail call i32 @print_tap_result(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %0, i8* %1, i32 %2)
%5 = tail call i32 @safe_printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
void machine_shutdown(void) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ POSIX_FADV_NOREUSE;
int posix_fadvise(int, int /*<<< orphan*/, int /*<<< orphan*/,
                  int /*<<< orphan*/);
int fadv_noreuse(int fd, off_t offset, off_t len) {
  return posix_fadvise(fd, offset, len, POSIX_FADV_NOREUSE);
}


x86 assembly (clang, -O0):
<fadv_noreuse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    0x2eaf(%rip),%rax
mov    (%rax),%ecx
call   1030 <posix_fadvise@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fadv_noreuse>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%ecx
jmp    1030 <posix_fadvise@plt>

LLVM IR (-O0):
@POSIX_FADV_NOREUSE = global i32 0
define i32 @fadv_noreuse(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* %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = load i32, i32* @POSIX_FADV_NOREUSE
%11 = call i32 @posix_fadvise(i32 %7, i32 %8, i32 %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
@POSIX_FADV_NOREUSE = global i32 0
define i32 @fadv_noreuse(i32 %0, i32 %1, i32 %2) {
%4 = load i32, i32* @POSIX_FADV_NOREUSE
%5 = tail call i32 @posix_fadvise(i32 %0, i32 %1, i32 %2, i32 %4)
ret i32 %5
}
void glTexParameteri(void) { return; }


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

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

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

LLVM IR (-O2):
define void @glTexParameteri() {
ret void
}
void tab2spc(char *p) {
  for (; *p; ++p)
    if (*p == '\t')
      *p = ' ';
}


x86 assembly (clang, -O0):
<tab2spc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1142 <tab2spc+0x42>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
jne    112c <tab2spc+0x2c>
mov    -0x8(%rbp),%rax
movb   $0x20,(%rax)
jmp    1131 <tab2spc+0x31>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <tab2spc+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<tab2spc>:
jmp    1117 <tab2spc+0x17>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x20,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x9,%al
je     1110 <tab2spc+0x10>
test   %al,%al
jne    1113 <tab2spc+0x13>
ret

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

LLVM IR (-O2):
define void @tab2spc(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
switch i8 %4, label %6 [
i8 0, label %8
i8 9, label %5
]
5: ; preds = %2
store i8 32, i8* %3
br label %6
6: ; preds = %2, %5
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memory_exhausted();
char *strdup(char const *);
char *jv_mem_strdup(const char *s) {
  char *p = strdup(s);
  if (!p) {
    memory_exhausted();
  }
  return p;
}


x86 assembly (clang, -O0):
<jv_mem_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    114b <jv_mem_strdup+0x2b>
mov    $0x0,%al
call   1030 <memory_exhausted@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jv_mem_strdup>:
push   %rbx
call   1040 <strdup@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <jv_mem_strdup+0x15>
xor    %eax,%eax
call   1030 <memory_exhausted@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define noalias i8* @jv_mem_strdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @memory_exhausted()
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ checkTainted1(char **);
int /*<<< orphan*/ checkUntainted1(char **);
void test(char *def2) {
  checkUntainted1(&def2);
  checkTainted1(&def2);
}


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

x86 assembly (clang, -O2):
<test>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <checkUntainted1@plt>
mov    %rbx,%rdi
call   1040 <checkTainted1@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @test(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @checkUntainted1(i8** %2)
%4 = call i32 @checkTainted1(i8** %2)
ret void
}
int *sub_40128A(int a, int b, int c, int d, int *results) {
  int x, y, ans1, ans2;
  x = a * c;
  y = b * d;
  ans1 = x - y;
  x = a * d;
  y = b * c;
  ans2 = x + y;
  results[1] = ans1;
  results[2] = ans2;
  return results;
}


x86 assembly (clang, -O0):
<sub_40128A>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    -0x4(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x28(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub_40128A>:
mov    %r8,%rax
mov    %edx,%r8d
imul   %edi,%r8d
mov    %ecx,%r9d
imul   %esi,%r9d
sub    %r9d,%r8d
imul   %edi,%ecx
imul   %esi,%edx
add    %ecx,%edx
mov    %r8d,0x4(%rax)
mov    %edx,0x8(%rax)
ret

LLVM IR (-O0):
define i32* @sub_40128A(i32 %0, i32 %1, i32 %2, i32 %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32* %4, i32** %10
%15 = load i32, i32* %6
%16 = load i32, i32* %8
%17 = mul nsw i32 %15, %16
store i32 %17, i32* %11
%18 = load i32, i32* %7
%19 = load i32, i32* %9
%20 = mul nsw i32 %18, %19
store i32 %20, i32* %12
%21 = load i32, i32* %11
%22 = load i32, i32* %12
%23 = sub nsw i32 %21, %22
store i32 %23, i32* %13
%24 = load i32, i32* %6
%25 = load i32, i32* %9
%26 = mul nsw i32 %24, %25
store i32 %26, i32* %11
%27 = load i32, i32* %7
%28 = load i32, i32* %8
%29 = mul nsw i32 %27, %28
store i32 %29, i32* %12
%30 = load i32, i32* %11
%31 = load i32, i32* %12
%32 = add nsw i32 %30, %31
store i32 %32, i32* %14
%33 = load i32, i32* %13
%34 = load i32*, i32** %10
%35 = getelementptr inbounds i32, i32* %34, i64 1
store i32 %33, i32* %35
%36 = load i32, i32* %14
%37 = load i32*, i32** %10
%38 = getelementptr inbounds i32, i32* %37, i64 2
store i32 %36, i32* %38
%39 = load i32*, i32** %10
ret i32* %39
}

LLVM IR (-O2):
define i32* @sub_40128A(i32 %0, i32 %1, i32 %2, i32 %3, i32* returned writeonly %4) {
%6 = mul nsw i32 %2, %0
%7 = mul nsw i32 %3, %1
%8 = sub nsw i32 %6, %7
%9 = mul nsw i32 %3, %0
%10 = mul nsw i32 %2, %1
%11 = add nsw i32 %9, %10
%12 = getelementptr inbounds i32, i32* %4, i64 1
store i32 %8, i32* %12
%13 = getelementptr inbounds i32, i32* %4, i64 2
store i32 %11, i32* %13
ret i32* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ fgets(char *, size_t, int /*<<< orphan*/ *);
char *strchr(char *, int);
char *get_line(FILE *f, char *buf, size_t len) {
  if (fgets(buf, len, f)) {
    char *ptr = strchr(buf, 0x0a);
    if (ptr)
      *ptr = 0;
    return buf;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<get_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <fgets@plt>
cmp    $0x0,%rax
je     1180 <get_line+0x60>
mov    -0x18(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1173 <get_line+0x53>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1188 <get_line+0x68>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_line>:
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rax,%rdx
call   1040 <fgets@plt>
test   %rax,%rax
je     1151 <get_line+0x31>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1153 <get_line+0x33>
movb   $0x0,(%rax)
jmp    1153 <get_line+0x33>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @get_line(i32* nocapture %0, i8* %1, i64 %2) {
%4 = tail call i64 @fgets(i8* %1, i64 %2, i32* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %3
%7 = tail call i8* @strchr(i8* dereferenceable(1) %1, i32 10)
%8 = icmp eq i8* %7, null
br i1 %8, label %10, label %9
9: ; preds = %6
store i8 0, i8* %7
br label %10
10: ; preds = %3, %6, %9
%11 = phi i8* [ %1, %9 ], [ %1, %6 ], [ null, %3 ]
ret i8* %11
}
int _is_upper(char c) { return (c >= 'A' && c <= 'Z'); }


x86 assembly (clang, -O0):
<_is_upper>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x41,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <_is_upper+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x5a,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_is_upper>:
add    $0xbf,%dil
xor    %eax,%eax
cmp    $0x1a,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @_is_upper(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 90
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @_is_upper(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
int blk_get_device_by_str(const char *ifname, const char *dev_str,
                          struct blk_desc **dev_desc) {
  return -1;
}


x86 assembly (clang, -O0):
<blk_get_device_by_str>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.blk_desc = type opaque
define i32 @blk_get_device_by_str(i8* %0, i8* %1, %struct.blk_desc** %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca %struct.blk_desc**
store i8* %0, i8** %4
store i8* %1, i8** %5
store %struct.blk_desc** %2, %struct.blk_desc*** %6
ret i32 -1
}

LLVM IR (-O2):
%struct.blk_desc = type opaque
define i32 @blk_get_device_by_str(i8* nocapture readnone %0, i8* nocapture readnone %1, %struct.blk_desc** nocapture readnone %2) {
ret i32 -1
}
void RTStrIStr(void) {}


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

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

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

LLVM IR (-O2):
define void @RTStrIStr() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ epicfail(char *);
int strlen(char *);
int write(int, char *, int);
void write_string(int fd, char *s) {
  int len = strlen(s);
  int bytes_written = write(fd, s, len);
  if (bytes_written != len)
    epicfail("write");
}


x86 assembly (clang, -O0):
<write_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1175 <write_string+0x45>
lea    0xe90(%rip),%rdi
call   1050 <epicfail@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_string>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%r14d
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
cmp    %ebp,%eax
jne    115a <write_string+0x2a>
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xe9f(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <epicfail@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"write\00"
define void @write_string(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @write(i32 %0, i8* %1, i32 %3)
%5 = icmp eq i32 %4, %3
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @epicfail(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
ret void
}
/* Variables and functions */
int modulo(int, int);
int modular_dist(int a, int b, int m) {
  int dist_a = modulo(a - b, m);
  int dist_b = modulo(b - a, m);
  return dist_a < dist_b ? dist_a : dist_b;
}


x86 assembly (clang, -O0):
<modular_dist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <modulo@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
sub    -0x4(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <modulo@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    115a <modular_dist+0x4a>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1160 <modular_dist+0x50>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modular_dist>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%ebx
sub    %esi,%edi
mov    %edx,%esi
call   1030 <modulo@plt>
mov    %eax,%r15d
sub    %ebx,%ebp
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <modulo@plt>
cmp    %eax,%r15d
cmovl  %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @modular_dist(i32 %0, i32 %1, i32 %2) {
%4 = sub nsw i32 %0, %1
%5 = tail call i32 @modulo(i32 %4, i32 %2)
%6 = sub nsw i32 %1, %0
%7 = tail call i32 @modulo(i32 %6, i32 %2)
%8 = icmp slt i32 %5, %7
%9 = select i1 %8, i32 %5, i32 %7
ret i32 %9
}
/* Variables and functions */
int fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int c_moved() { return fputs("D", stdout); }


x86 assembly (clang, -O0):
<c_moved>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_moved>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
lea    0xee0(%rip),%rdi
jmp    1030 <fputs@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"\1BD\00"
@stdout = global i32 0
define i32 @c_moved() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main() {
  int i = 0;
  do {
    puts("Hello World!");
    i++;
  } while (i < 5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jl     1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %7, %0
%4 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
store i32 %6, i32* %2
br label %7
7: ; preds = %3
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 5
br i1 %9, label %3, label %10
10: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello World!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void outw(short port, short val) {
  __asm__ volatile("outw %1, %0" : : "dN"(port), "a"(val));
}


x86 assembly (clang, -O0):
<outw>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    -0x2(%rbp),%dx
mov    -0x4(%rbp),%ax
out    %ax,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outw>:
mov    %esi,%eax
mov    %edi,%edx
out    %ax,(%dx)
ret

LLVM IR (-O0):
define void @outw(i16 signext %0, i16 signext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = load i16, i16* %4
ret void
}

LLVM IR (-O2):
define void @outw(i16 signext %0, i16 signext %1) {
tail call void asm sideeffect "outw $1, $0", "{dx}N,{ax},~{dirflag},~{fpsr},~{flags}"(i16 %0, i16 %1)
ret void
}
/* Variables and functions */
const char *udev_get_dev_path(void *udev) {
  if (!udev)
    return NULL;
  return "/dev";
}


x86 assembly (clang, -O0):
<udev_get_dev_path>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1120 <udev_get_dev_path+0x20>
movq   $0x0,-0x8(%rbp)
jmp    112b <udev_get_dev_path+0x2b>
lea    0xed9(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<udev_get_dev_path>:
test   %rdi,%rdi
lea    0xef6(%rip),%rax
cmove  %rdi,%rax
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"/dev\00"
define i8* @udev_get_dev_path(i8* readnone %0) {
%2 = icmp eq i8* %0, null
%3 = select i1 %2, i8* null, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
int toASCIILower(int c) { return c | ((c >= 'A' && c <= 'Z') << 5); }


x86 assembly (clang, -O0):
<toASCIILower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x41,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1126 <toASCIILower+0x26>
cmpl   $0x5a,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x5(%rbp),%cl
and    $0x1,%cl
movzbl %cl,%ecx
shl    $0x5,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toASCIILower>:
lea    -0x41(%rdi),%ecx
xor    %eax,%eax
cmp    $0x1a,%ecx
setb   %al
shl    $0x5,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @toASCIILower(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp sle i32 %7, 90
br label %9
9: ; preds = %6, %1
%10 = phi i1 [ false, %1 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
%12 = shl i32 %11, 5
%13 = or i32 %3, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @toASCIILower(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = select i1 %3, i32 32, i32 0
%5 = or i32 %4, %0
ret i32 %5
}
void media_ctrl_get_device_list() {}


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

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

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

LLVM IR (-O2):
define void @media_ctrl_get_device_list() {
ret void
}
char *langRomTypeSvi727col80() { return "SVI-727 80 Column Card"; }


x86 assembly (clang, -O0):
<langRomTypeSvi727col80>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<langRomTypeSvi727col80>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [23 x i8] c"SVI-727 80 Column Card\00"
define i8* @langRomTypeSvi727col80() {
ret i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [23 x i8] c"SVI-727 80 Column Card\00"
define i8* @langRomTypeSvi727col80() {
ret i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0)
}
int test_imm_A7int32_reg(int val) { return ((val) & (0xA7 << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_A7int32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xa7,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_A7int32_reg>:
test   $0xa7,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_A7int32_reg(i32 %0) {
%2 = and i32 %0, 167
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int request_module(char *name, ...) {
  int a;
  return a;
}


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

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

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

LLVM IR (-O2):
define i32 @request_module(i8* nocapture readnone %0, ...) {
ret i32 undef
}
void free_parameters(int num_parameters, char ***parameters) {
  int i = 0;
  for (i = 0; i < num_parameters; i++)
    Free((*parameters)[i]);
  Free((*parameters));
}


x86 assembly (clang, -O0):
<free_parameters>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115d <free_parameters+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x0,%al
call   1030 <Free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <free_parameters+0x1d>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x0,%al
call   1030 <Free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_parameters>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
test   %edi,%edi
jle    1147 <free_parameters+0x37>
mov    %edi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14),%rax
mov    (%rax,%rbx,8),%rdi
xor    %eax,%eax
call   1030 <Free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <free_parameters+0x20>
mov    (%r14),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <Free@plt>

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

LLVM IR (-O2):
define void @free_parameters(i32 %0, i8*** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = load i8**, i8*** %1
%9 = getelementptr inbounds i8*, i8** %8, i64 %7
%10 = load i8*, i8** %9
%11 = tail call i32 (i8*, ...) bitcast (i32 (...)* @Free to i32 (i8*, ...)*)(i8* %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
%15 = load i8**, i8*** %1
%16 = tail call i32 (i8**, ...) bitcast (i32 (...)* @Free to i32 (i8**, ...)*)(i8** %15)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void usage(char *me) { printf("usage: %s  in_filename out_filename\n", me); }


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

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

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

LLVM IR (-O2):
@.str = [37 x i8] c"usage: %s in_filename out_filename\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
float stdlib_base_invf(const float x) { return 1.0f / x; }


x86 assembly (clang, -O0):
<stdlib_base_invf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xeef(%rip),%xmm0
divss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdlib_base_invf>:
movss  0xef8(%rip),%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @stdlib_base_invf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fdiv float 1.000000e+00, %3
ret float %4
}

LLVM IR (-O2):
define float @stdlib_base_invf(float %0) {
%2 = fdiv float 1.000000e+00, %0
ret float %2
}
int picked4() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @picked4() {
ret i32 0
}
unsigned long get_intenb_reg(int port) { return port == 0 ? 0x32 : 0x34; }


x86 assembly (clang, -O0):
<get_intenb_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x34,%eax
mov    $0x32,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_intenb_reg>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
add    %rax,%rax
add    $0x32,%rax
ret

LLVM IR (-O0):
define i64 @get_intenb_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 50, i32 52
%7 = sext i32 %6 to i64
ret i64 %7
}

LLVM IR (-O2):
define i64 @get_intenb_reg(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i64 50, i64 52
ret i64 %3
}
void mystrcat(char *s, char *t) {
  while (*s != '\0')
    s++;
  s--;
  while ((*s = *t) != '\0') {
    s++;
    t++;
  }
}


x86 assembly (clang, -O0):
<mystrcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     112d <mystrcat+0x2d>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <mystrcat+0xc>
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     116e <mystrcat+0x6e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1139 <mystrcat+0x39>
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrcat>:
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1100 <mystrcat>
mov    (%rsi),%al
mov    %al,-0x2(%rdi)
test   %al,%al
je     1131 <mystrcat+0x31>
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x1(%rsi,%rax,1),%ecx
mov    %cl,-0x1(%rdi,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1120 <mystrcat+0x20>
ret

LLVM IR (-O0):
define void @mystrcat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %5
5: ; preds = %10, %2
%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 = getelementptr inbounds i8, i8* %14, i32 -1
store i8* %15, i8** %3
br label %16
16: ; preds = %22, %13
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = load i8*, i8** %3
store i8 %18, i8* %19
%20 = sext i8 %18 to i32
%21 = icmp ne i32 %20, 0
br i1 %21, label %22, label %27
22: ; preds = %16
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %3
%25 = load i8*, i8** %4
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %4
br label %16
27: ; preds = %16
ret void
}

LLVM IR (-O2):
define void @mystrcat(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 -1
%10 = load i8, i8* %1
store i8 %10, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %19, label %12
12: ; preds = %8, %12
%13 = phi i8* [ %16, %12 ], [ %1, %8 ]
%14 = phi i8* [ %15, %12 ], [ %9, %8 ]
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = getelementptr inbounds i8, i8* %13, i64 1
%17 = load i8, i8* %16
store i8 %17, i8* %15
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %12
19: ; preds = %12, %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ oosmos_DelayMS(int);
int /*<<< orphan*/ oosmos_RunStateMachines();
int /*<<< orphan*/ synctestNew();
extern int main(void) {
  for (int I = 1; I <= 1; I++)
    synctestNew();
  while (1) {
    oosmos_RunStateMachines();
    oosmos_DelayMS(25);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jg     1165 <main+0x35>
mov    $0x0,%al
call   1030 <synctestNew@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
jmp    116a <main+0x3a>
mov    $0x0,%al
call   1050 <oosmos_RunStateMachines@plt>
mov    $0x19,%edi
call   1040 <oosmos_DelayMS@plt>
jmp    116a <main+0x3a>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <synctestNew@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <oosmos_RunStateMachines@plt>
mov    $0x19,%edi
call   1040 <oosmos_DelayMS@plt>
jmp    1140 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
br label %3
3: ; preds = %8, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 1
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = call i32 (...) @synctestNew()
br label %8
8: ; preds = %6
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
br label %3
11: ; preds = %3
br label %12
12: ; preds = %11, %12
%13 = call i32 (...) @oosmos_RunStateMachines()
%14 = call i32 @oosmos_DelayMS(i32 25)
br label %12
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @synctestNew()
br label %2
2: ; preds = %0, %2
%3 = tail call i32 (...) @oosmos_RunStateMachines()
%4 = tail call i32 @oosmos_DelayMS(i32 25)
br label %2
}
int plat_midi_in_get_num_devs(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @plat_midi_in_get_num_devs() {
ret i32 0
}
void prs(s) register char *s;
{
  if (*s)
    write(2, s, strlen(s));
}


x86 assembly (clang, -O0):
<prs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     115d <prs+0x3d>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %rax,%rdx
mov    $0x2,%edi
mov    $0x0,%al
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prs>:
push   %rbx
cmpb   $0x0,(%rdi)
je     1141 <prs+0x21>
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
xor    %eax,%eax
pop    %rbx
jmp    1030 <write@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @prs(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = icmp ne i8 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = load i8*, i8** %2
%9 = call i64 @strlen(i8* %8)
%10 = call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 2, i8* %7, i64 %9)
br label %11
11: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @prs(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i64 @strlen(i8* %0)
%6 = tail call i32 (i32, i8*, i64, ...) bitcast (i32 (...)* @write to i32 (i32, i8*, i64, ...)*)(i32 2, i8* %0, i64 %5)
br label %7
7: ; preds = %4, %1
ret void
}