xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ __infer_set_flag(char *, char *);
void *memcpy(void *, void const *, size_t);
void *memmove(void *s1, const void *s2, size_t n) {
  __infer_set_flag("ignore_return", "");
  return memcpy(s1, s2, n);
}


x86 assembly (clang, -O0):
<memmove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xec5(%rip),%rdi
lea    0xecb(%rip),%rsi
call   1030 <__infer_set_flag@plt>
mov    -0x8(%rbp),%rdi
mov    %rdi,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memmove>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xecb(%rip),%rdi
lea    0xed1(%rip),%rsi
call   1030 <__infer_set_flag@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <memcpy@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"ignore_return\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @memmove(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = call i32 @__infer_set_flag(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
ret i8* %8
}

LLVM IR (-O2):
@.str = [14 x i8] c"ignore_return\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @memmove(i8* returned writeonly %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @__infer_set_flag(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 %0, i8* align 1 %1, i64 %2, i1 false)
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ foo(int, int, int, int, int);
__attribute__((no)) void bar(int r2, int r3, int r4, int r5, int r6) {
  foo(r2, r3, r4, r5, r6);
  if (r6 != 6)
    abort();
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
call   1040 <foo@plt>
cmpl   $0x6,-0x14(%rbp)
je     115e <bar+0x3e>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rbx
mov    %r8d,%ebx
call   1040 <foo@plt>
cmp    $0x6,%ebx
jne    1130 <bar+0x10>
pop    %rbx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @bar(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
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
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = call i32 @foo(i32 %11, i32 %12, i32 %13, i32 %14, i32 %15)
%17 = load i32, i32* %10
%18 = icmp ne i32 %17, 6
br i1 %18, label %19, label %21
19: ; preds = %5
%20 = call i32 (...) @abort()
unreachable
21: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @bar(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @foo(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4)
%7 = icmp eq i32 %4, 6
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %5
ret void
}
/* Variables and functions */
int subroutine();
int second() { return subroutine(); }


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

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

LLVM IR (-O0):
define i32 @second() {
%1 = call i32 (...) @subroutine()
ret i32 %1
}

LLVM IR (-O2):
define i32 @second() {
%1 = tail call i32 (...) @subroutine()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void ProgramUsage() {
  printf("usage: encode [options] <table filename> <original file> <input "
         "files wildcard> <output filename>\n");
  printf(
      "  Ex: encode -f table.tbl fnt_sys.bin script%%64.txt new-fntsys.bin\n");
  printf("options:\n"
         "\t-f\tAssume input file data is fnt_sys data that's normally in "
         "FNT_SYS.BIN(default)\n"
         "\t-s\tAssume input file data is syswin text data that's normally in "
         "SYSWIN.BIN\n");
  exit(1);
}


x86 assembly (clang, -O0):
<ProgramUsage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xf2c(%rip),%rdi
call   1030 <printf@plt>
lea    0xf65(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<ProgramUsage>:
push   %rax
lea    0xf0d(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
lea    0xf57(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [99 x i8] c"usage: encode [options] <table filename> <original file> <input files wildcard> <output filename>\0A\00"
@.str.1 = [69 x i8] c" Ex: encode -f table.tbl fnt_sys.bin script%%64.txt new-fntsys.bin\0A\00"
@.str.2 = [170 x i8] c"options:\0A\09-f\09Assume input file data is fnt_sys data that's normally in FNT_SYS.BIN(default)\0A\09-s\09Assume input file data is syswin text data that's normally in SYSWIN.BIN\0A\00"
define void @ProgramUsage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([170 x i8], [170 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str.1 = [69 x i8] c" Ex: encode -f table.tbl fnt_sys.bin script%%64.txt new-fntsys.bin\0A\00"
@str = [98 x i8] c"usage: encode [options] <table filename> <original file> <input files wildcard> <output filename>\00"
@str.3 = [169 x i8] c"options:\0A\09-f\09Assume input file data is fnt_sys data that's normally in FNT_SYS.BIN(default)\0A\09-s\09Assume input file data is syswin text data that's normally in SYSWIN.BIN\00"
define void @ProgramUsage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([98 x i8], [98 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([169 x i8], [169 x i8]* @str.3, i64 0, i64 0))
%4 = tail call i32 @exit(i32 1)
unreachable
}
int test(int x) { return 5 * x / 8; }


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
imul   $0x5,-0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
lea    (%rdi,%rdi,4),%ecx
lea    (%rdi,%rdi,4),%eax
add    $0x7,%eax
test   %ecx,%ecx
cmovns %ecx,%eax
sar    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @test(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 5, %3
%5 = sdiv i32 %4, 8
ret i32 %5
}

LLVM IR (-O2):
define i32 @test(i32 %0) {
%2 = mul nsw i32 %0, 5
%3 = sdiv i32 %2, 8
ret i32 %3
}
void energest_flush(void) {}


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

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

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

LLVM IR (-O2):
define void @energest_flush() {
ret void
}
/* Variables and functions */
int mprotect(void *addr, size_t len, int prot) { return 0; }


x86 assembly (clang, -O0):
<mprotect>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @mprotect(i8* %0, i64 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i32
store i8* %0, i8** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
define i32 @mprotect(i8* nocapture readnone %0, i64 %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_offset(int offset) {
  int i;
  for (i = 0; i < offset; ++i) {
    printf(" ");
  }
}


x86 assembly (clang, -O0):
<print_offset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1148 <print_offset+0x38>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <print_offset+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_offset>:
push   %rbx
test   %edi,%edi
jle    112f <print_offset+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <print_offset+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @print_offset(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @putchar(i32 32)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
int llib_lz_nbits(unsigned x) {
  int r;
  for (r = 0; x; x >>= 1)
    r += x & 1;
  return r;
}


x86 assembly (clang, -O0):
<llib_lz_nbits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1132 <llib_lz_nbits+0x32>
mov    -0x4(%rbp),%eax
and    $0x1,%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110e <llib_lz_nbits+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<llib_lz_nbits>:
xor    %eax,%eax
test   %edi,%edi
je     1120 <llib_lz_nbits+0x20>
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
mov    %edi,%edx
and    $0x1,%edx
add    %edx,%eax
shr    %ecx
cmp    $0x1,%edi
mov    %ecx,%edi
ja     1110 <llib_lz_nbits+0x10>
ret

LLVM IR (-O0):
define i32 @llib_lz_nbits(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i32, i32* %2
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* %2
%9 = and i32 %8, 1
%10 = load i32, i32* %3
%11 = add i32 %10, %9
store i32 %11, i32* %3
br label %12
12: ; preds = %7
%13 = load i32, i32* %2
%14 = lshr i32 %13, 1
store i32 %14, i32* %2
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @llib_lz_nbits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %8, %3 ], [ %0, %1 ]
%6 = and i32 %5, 1
%7 = add i32 %4, %6
%8 = lshr i32 %5, 1
%9 = icmp ult i32 %5, 2
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("helloworld\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 = [12 x i8] c"helloworld\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [11 x i8] c"helloworld\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ event_loopbreak();
void pubsubclient_termination_handler(int signum) { event_loopbreak(); }


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

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

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

LLVM IR (-O2):
define void @pubsubclient_termination_handler(i32 %0) {
%2 = tail call i32 (...) @event_loopbreak()
ret void
}
void RTDbgSymbolAlloc(void) {}


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

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

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

LLVM IR (-O2):
define void @RTDbgSymbolAlloc() {
ret void
}
void init_tables(void) {}


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

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

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

LLVM IR (-O2):
define void @init_tables() {
ret void
}
/* Variables and functions */
void *talloc_named_const(void const *, size_t, char const *);
void *_talloc_array(const void *ctx, size_t el_size, unsigned count,
                    const char *name) {
  if (count >= 0x10000000 / el_size) {
    return NULL;
  }
  return talloc_named_const(ctx, el_size * count, name);
}


x86 assembly (clang, -O0):
<_talloc_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
mov    %rax,-0x30(%rbp)
mov    $0x10000000,%eax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
mov    %rax,%rcx
mov    -0x30(%rbp),%rax
cmp    %rcx,%rax
jb     1158 <_talloc_array+0x48>
movq   $0x0,-0x8(%rbp)
jmp    1174 <_talloc_array+0x64>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%eax
imul   %rax,%rsi
mov    -0x28(%rbp),%rdx
call   1030 <talloc_named_const@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_talloc_array>:
mov    %edx,%r8d
cmp    $0x10000000,%rsi
ja     112d <_talloc_array+0x1d>
mov    $0x10000000,%eax
xor    %edx,%edx
div    %esi
cmp    %r8,%rax
ja     1134 <_talloc_array+0x24>
xor    %eax,%eax
ret
xor    %eax,%eax
cmp    %r8,%rax
jbe    112a <_talloc_array+0x1a>
imul   %rsi,%r8
mov    %r8,%rsi
mov    %rcx,%rdx
jmp    1030 <talloc_named_const@plt>

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

LLVM IR (-O2):
define i8* @_talloc_array(i8* %0, i64 %1, i32 %2, i8* %3) {
%5 = zext i32 %2 to i64
%6 = udiv i64 268435456, %1
%7 = icmp ugt i64 %6, %5
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = mul i64 %5, %1
%10 = tail call i8* @talloc_named_const(i8* %0, i64 %9, i8* %3)
br label %11
11: ; preds = %4, %8
%12 = phi i8* [ %10, %8 ], [ null, %4 ]
ret i8* %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void print(const char *c) { printf("%s\n", c); }


x86 assembly (clang, -O0):
<print>:
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):
<print>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @print(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ parse_args(int, char **);
int main(int argc, char **argv, char **envp) { parse_args(argc, argv); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1030 <parse_args@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(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 i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @parse_args(i32 %7, i8** %8)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1, i8** nocapture readnone %2) {
%4 = tail call i32 @parse_args(i32 %0, i8** %1)
ret i32 0
}
mfree(p, n) register char *p;
{ free(p); }


x86 assembly (clang, -O0):
<mfree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mfree>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define i32 @mfree(i8* nocapture %0, i32 %1) {
tail call void @free(i8* %0)
ret i32 undef
}
int isEndOfLine(char ent) {
  if (ent == 10 || ent == 13 || ent == 32)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isEndOfLine>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
je     1131 <isEndOfLine+0x31>
movsbl -0x5(%rbp),%eax
cmp    $0xd,%eax
je     1131 <isEndOfLine+0x31>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    113d <isEndOfLine+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1144 <isEndOfLine+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isEndOfLine>:
cmp    $0x20,%dil
ja     1120 <isEndOfLine+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x100002400,%rdx
bt     %rcx,%rdx
jae    1120 <isEndOfLine+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @isEndOfLine(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %3
i8 13, label %3
i8 10, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %2
%4 = phi i32 [ 0, %2 ], [ 1, %1 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %4
}
/* Variables and functions */
int free(void *ptr) {}


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

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

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

LLVM IR (-O2):
define i32 @free(i8* nocapture readnone %0) {
ret i32 undef
}
long long baddu4(long long a, long long b) { return (a + b) & 0xff; }


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

x86 assembly (clang, -O2):
<baddu4>:
add    %edi,%esi
movzbl %sil,%eax
ret

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

LLVM IR (-O2):
define i64 @baddu4(i64 %0, i64 %1) {
%3 = add nsw i64 %1, %0
%4 = and i64 %3, 255
ret i64 %4
}
/* Variables and functions */
int mystery(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int x, y;
  printf("Enter two integers: ");
  scanf("%d%d", &x, &y);
  printf("The result is %d\n", mystery(x, y));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <mystery@plt>
mov    %eax,%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1050 <mystery@plt>
lea    0xeb4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Enter two integers: \00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [18 x i8] c"The result is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i32 @mystery(i32 %6, i32 %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"Enter two integers: \00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [18 x i8] c"The result is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 @mystery(i32 %7, i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ LedsP__Leds__led0On();
void NodeApp__Leds__led0On(void) { LedsP__Leds__led0On(); }


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

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

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

LLVM IR (-O2):
define void @NodeApp__Leds__led0On() {
%1 = tail call i32 (...) @LedsP__Leds__led0On()
ret void
}
/* Variables and functions */
int foo(char *, char *, char *);
int main() { return foo("%s_%s", "one", "two"); }


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

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
lea    0xee8(%rip),%rsi
lea    0xee5(%rip),%rdx
jmp    1030 <foo@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s_%s\00"
@.str.1 = [4 x i8] c"one\00"
@.str.2 = [4 x i8] c"two\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @foo(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret i32 %2
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s_%s\00"
@.str.1 = [4 x i8] c"one\00"
@.str.2 = [4 x i8] c"two\00"
define i32 @main() {
%1 = tail call i32 @foo(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ abortmsgerrno(char *);
int /*<<< orphan*/ debugmsg(char *);
scalar_t__ execvp(int /*<<< orphan*/, char **);
int /*<<< orphan*/ gethgcmd();
void execoriginalhg(const char *argv[]) {
  debugmsg("execute original hg");
  if (execvp(gethgcmd(), (char **)argv) < 0)
    abortmsgerrno("failed to exec original hg");
}


x86 assembly (clang, -O0):
<execoriginalhg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xead(%rip),%rdi
call   1030 <debugmsg@plt>
mov    $0x0,%al
call   1050 <gethgcmd@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%rsi
call   1060 <execvp@plt>
cmp    $0x0,%rax
jge    1180 <execoriginalhg+0x40>
lea    0xe99(%rip),%rdi
call   1040 <abortmsgerrno@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execoriginalhg>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rdi
call   1030 <debugmsg@plt>
xor    %eax,%eax
call   1050 <gethgcmd@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <execvp@plt>
test   %rax,%rax
js     1168 <execoriginalhg+0x28>
pop    %rbx
ret
lea    0xea5(%rip),%rdi
pop    %rbx
jmp    1040 <abortmsgerrno@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"execute original hg\00"
@.str.1 = [27 x i8] c"failed to exec original hg\00"
define void @execoriginalhg(i8** %0) {
%2 = alloca i8**
store i8** %0, i8*** %2
%3 = call i32 @debugmsg(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @gethgcmd()
%5 = load i8**, i8*** %2
%6 = call i64 @execvp(i32 %4, i8** %5)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 @abortmsgerrno(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"execute original hg\00"
@.str.1 = [27 x i8] c"failed to exec original hg\00"
define void @execoriginalhg(i8** %0) {
%2 = tail call i32 @debugmsg(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (...) @gethgcmd()
%4 = tail call i64 @execvp(i32 %3, i8** %0)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @abortmsgerrno(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret void
}
/* Variables and functions */
scalar_t__ getbits(unsigned char const *, int, int);
double getbitu(unsigned char const *, int, int);
double getbits_38(const unsigned char *buff, int pos) {
  return (double)getbits(buff, pos, 32) * ((double)64.0L) +
         getbitu(buff, pos + 32, 6);
}


x86 assembly (clang, -O0):
<getbits_38>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x20,%edx
call   1030 <getbits@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x20,%esi
mov    $0x6,%edx
call   1040 <getbitu@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  0xe92(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getbits_38>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    $0x20,%edx
call   1030 <getbits@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,(%rsp)
add    $0x20,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x6,%edx
call   1040 <getbitu@plt>
movsd  (%rsp),%xmm1
mulsd  0xea4(%rip),%xmm1
addsd  %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @getbits_38(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 = load i32, i32* %4
%7 = call i64 @getbits(i8* %5, i32 %6, i32 32)
%8 = sitofp i64 %7 to double
%9 = load i8*, i8** %3
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 32
%12 = call double @getbitu(i8* %9, i32 %11, i32 6)
%13 = call double @llvm.fmuladd.f64(double %8, double 6.400000e+01, double %12)
ret double %13
}

LLVM IR (-O2):
define double @getbits_38(i8* %0, i32 %1) {
%3 = tail call i64 @getbits(i8* %0, i32 %1, i32 32)
%4 = sitofp i64 %3 to double
%5 = add nsw i32 %1, 32
%6 = tail call double @getbitu(i8* %0, i32 %5, i32 6)
%7 = tail call double @llvm.fmuladd.f64(double %4, double 6.400000e+01, double %6)
ret double %7
}
/* Variables and functions */
double mp_bswap_double(double);
char *mp_encode_double(char *data, double num) {
  *data = 0xcb;
  data++;
  *(double *)data = mp_bswap_double(num);
  return data + sizeof(double);
}


x86 assembly (clang, -O0):
<mp_encode_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movb   $0xcb,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <mp_bswap_double@plt>
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mp_encode_double>:
push   %rbx
mov    %rdi,%rbx
movb   $0xcb,(%rdi)
call   1030 <mp_bswap_double@plt>
movsd  %xmm0,0x1(%rbx)
add    $0x9,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @mp_encode_double(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
store i8* %0, i8** %3
store double %1, double* %4
%5 = load i8*, i8** %3
store i8 -53, i8* %5
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %3
%8 = load double, double* %4
%9 = call double @mp_bswap_double(double %8)
%10 = load i8*, i8** %3
%11 = bitcast i8* %10 to double*
store double %9, double* %11
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 8
ret i8* %13
}

LLVM IR (-O2):
define i8* @mp_encode_double(i8* writeonly %0, double %1) {
store i8 -53, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = tail call double @mp_bswap_double(double %1)
%5 = bitcast i8* %3 to double*
store double %4, double* %5
%6 = getelementptr inbounds i8, i8* %0, i64 9
ret i8* %6
}
int atoi(const char *string) {
  int num = 0;
  while (*string) {
    num *= 10;
    num += *string++ - '0';
  }
  return num;
}


x86 assembly (clang, -O0):
<atoi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1143 <atoi+0x43>
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
sub    $0x30,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110f <atoi+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<atoi>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <atoi+0x28>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
lea    (%rax,%rax,4),%eax
movsbl %cl,%ecx
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <atoi+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @atoi(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %13, %4 ], [ %2, %1 ]
%6 = phi i32 [ %12, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = mul nsw i32 %6, 10
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i32
%11 = add i32 %8, -48
%12 = add i32 %11, %10
%13 = load i8, i8* %9
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %1
%16 = phi i32 [ 0, %1 ], [ %12, %4 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ my_strcpy(char *, char *);
int my_strlen(char *);
void my_strcat(char *a, char *b) { my_strcpy(a + my_strlen(a), b); }


x86 assembly (clang, -O0):
<my_strcat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <my_strlen@plt>
mov    -0x18(%rbp),%rdi
cltq
add    %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1040 <my_strcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strcat>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <my_strlen@plt>
movslq %eax,%rdi
add    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <my_strcpy@plt>

LLVM IR (-O0):
define void @my_strcat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @my_strlen(i8* %6)
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
%10 = load i8*, i8** %4
%11 = call i32 @my_strcpy(i8* %9, i8* %10)
ret void
}

LLVM IR (-O2):
define void @my_strcat(i8* %0, i8* %1) {
%3 = tail call i32 @my_strlen(i8* %0)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = tail call i32 @my_strcpy(i8* %5, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ changeTexMode(int);
int getTexMode();
void CmdHfill(int code) {
  if (getTexMode() == 6)
    changeTexMode(2);
}


x86 assembly (clang, -O0):
<CmdHfill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getTexMode@plt>
cmp    $0x6,%eax
jne    1145 <CmdHfill+0x25>
mov    $0x2,%edi
call   1030 <changeTexMode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CmdHfill>:
push   %rax
xor    %eax,%eax
call   1040 <getTexMode@plt>
cmp    $0x6,%eax
jne    1138 <CmdHfill+0x18>
mov    $0x2,%edi
pop    %rax
jmp    1030 <changeTexMode@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @CmdHfill(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @getTexMode()
%4 = icmp eq i32 %3, 6
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @changeTexMode(i32 2)
br label %7
7: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
define void @CmdHfill(i32 %0) {
%2 = tail call i32 (...) @getTexMode()
%3 = icmp eq i32 %2, 6
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @changeTexMode(i32 2)
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
scalar_t__ round(double);
int cents2frac(double cents, int den) {
  return (int)round((cents / 100.0) * den);
}


x86 assembly (clang, -O0):
<cents2frac>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed3(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <round@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cents2frac>:
divsd  0xee8(%rip),%xmm0
cvtsi2sd %edi,%xmm1
mulsd  %xmm1,%xmm0
jmp    1030 <round@plt>

LLVM IR (-O0):
define i32 @cents2frac(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
%5 = load double, double* %3
%6 = fdiv double %5, 1.000000e+02
%7 = load i32, i32* %4
%8 = sitofp i32 %7 to double
%9 = fmul double %6, %8
%10 = call i64 @round(double %9)
%11 = trunc i64 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @cents2frac(double %0, i32 %1) {
%3 = fdiv double %0, 1.000000e+02
%4 = sitofp i32 %1 to double
%5 = fmul double %3, %4
%6 = tail call i64 @round(double %5)
%7 = trunc i64 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ DirectIndirectIndexedE0X1(int);
int /*<<< orphan*/ STA8(int /*<<< orphan*/);
void Op91E0M1X1(void) { STA8(DirectIndirectIndexedE0X1(2)); }


x86 assembly (clang, -O0):
<Op91E0M1X1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <DirectIndirectIndexedE0X1@plt>
mov    %eax,%edi
call   1040 <STA8@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op91E0M1X1>:
push   %rax
mov    $0x2,%edi
call   1030 <DirectIndirectIndexedE0X1@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <STA8@plt>

LLVM IR (-O0):
define void @Op91E0M1X1() {
%1 = call i32 @DirectIndirectIndexedE0X1(i32 2)
%2 = call i32 @STA8(i32 %1)
ret void
}

LLVM IR (-O2):
define void @Op91E0M1X1() {
%1 = tail call i32 @DirectIndirectIndexedE0X1(i32 2)
%2 = tail call i32 @STA8(i32 %1)
ret void
}
/* Variables and functions */
int get1();
int get2(void) {
  int x;
  x = get1() << 8;
  return x | get1();
}


x86 assembly (clang, -O0):
<get2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <get1@plt>
shl    $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <get1@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get2>:
push   %rbx
xor    %eax,%eax
call   1030 <get1@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
xor    %eax,%eax
call   1030 <get1@plt>
or     %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get2() {
%1 = alloca i32
%2 = call i32 (...) @get1()
%3 = shl i32 %2, 8
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = call i32 (...) @get1()
%6 = or i32 %4, %5
ret i32 %6
}

LLVM IR (-O2):
define i32 @get2() {
%1 = tail call i32 (...) @get1()
%2 = shl i32 %1, 8
%3 = tail call i32 (...) @get1()
%4 = or i32 %2, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ curses_end();
int /*<<< orphan*/ exit(int);
void die(int err) {
  curses_end();
  exit(err);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <curses_end@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <curses_end@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @die(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @curses_end()
%4 = load i32, i32* %2
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
define void @die(i32 %0) {
%2 = tail call i32 (...) @curses_end()
%3 = tail call i32 @exit(i32 %0)
unreachable
}
void clearGraph(int g[5][5]) {
  int i, j;
  for (i = 0; i < 5; i++) {
    for (j = 0; j < 5; j++) {
      g[i][j] = 0;
    }
  }
}


x86 assembly (clang, -O0):
<clearGraph>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    1165 <clearGraph+0x65>
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    1152 <clearGraph+0x52>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1120 <clearGraph+0x20>
jmp    1157 <clearGraph+0x57>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <clearGraph+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearGraph>:
xorps  %xmm0,%xmm0
movups %xmm0,0x50(%rdi)
movups %xmm0,0x40(%rdi)
movups %xmm0,0x30(%rdi)
movups %xmm0,0x20(%rdi)
movups %xmm0,0x10(%rdi)
movups %xmm0,(%rdi)
movl   $0x0,0x60(%rdi)
ret

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

LLVM IR (-O2):
define void @clearGraph([5 x i32]* nocapture writeonly %0) {
%2 = bitcast [5 x i32]* %0 to i8*
ret void
}
/* Type definitions */
struct sockaddr_in {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ free(struct sockaddr_in *);
void tear_down(int socket, int epollfd, struct sockaddr_in *s) {
  close(socket);
  close(epollfd);
  free(s);
}


x86 assembly (clang, -O0):
<tear_down>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <close@plt>
mov    -0x8(%rbp),%edi
call   1040 <close@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tear_down>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%ebp
call   1040 <close@plt>
mov    %ebp,%edi
call   1040 <close@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
define void @tear_down(i32 %0, i32 %1, %struct.sockaddr_in* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.sockaddr_in*
store i32 %0, i32* %4
store i32 %1, i32* %5
store %struct.sockaddr_in* %2, %struct.sockaddr_in** %6
%7 = load i32, i32* %4
%8 = call i32 @close(i32 %7)
%9 = load i32, i32* %5
%10 = call i32 @close(i32 %9)
%11 = load %struct.sockaddr_in*, %struct.sockaddr_in** %6
%12 = call i32 @free(%struct.sockaddr_in* %11)
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
define void @tear_down(i32 %0, i32 %1, %struct.sockaddr_in* nocapture %2) {
%4 = tail call i32 @close(i32 %0)
%5 = tail call i32 @close(i32 %1)
%6 = tail call i32 @free(%struct.sockaddr_in* %2)
ret void
}
/* Variables and functions */
char *calloc(size_t, int);
char *repchar(const char c, size_t n) {
  char *str = calloc(n + 1, sizeof(*str));
  while (n--)
    str[n] = c;
  return str;
}


x86 assembly (clang, -O0):
<repchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     1164 <repchar+0x54>
mov    -0x1(%rbp),%dl
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1138 <repchar+0x28>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<repchar>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x1(%rsi),%rdi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     114e <repchar+0x2e>
movzbl %bpl,%esi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @repchar(i8 signext %0, i64 %1) {
%3 = add i64 %1, 1
%4 = tail call i8* @calloc(i64 %3, i32 1)
%5 = icmp eq i64 %1, 0
br i1 %5, label %7, label %6
6: ; preds = %2
br label %7
7: ; preds = %6, %2
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ uninit0();
int main() { uninit0(); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <uninit0@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @uninit0()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @uninit0()
ret i32 0
}
int isspace(int c) { return c == ' ' || ((unsigned)c - '\t') < 5; }


x86 assembly (clang, -O0):
<isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1125 <isspace+0x25>
mov    -0x4(%rbp),%eax
sub    $0x9,%eax
cmp    $0x5,%eax
setb   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isspace>:
cmp    $0x20,%edi
sete   %al
add    $0xfffffff7,%edi
cmp    $0x5,%edi
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @isspace(i32 %0) {
%2 = icmp eq i32 %0, 32
%3 = add i32 %0, -9
%4 = icmp ult i32 %3, 5
%5 = or i1 %2, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
XFreeExtensionList() {}


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

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

LLVM IR (-O0):
define i32 @XFreeExtensionList() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @XFreeExtensionList() {
ret i32 undef
}