xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ recoverableError(char *);
int /*<<< orphan*/ stderr;
void sourceSizeLineError() {
  recoverableError("Maximun size of opcodes in a line, is too big");
  fprintf(stderr, "     The maximun size in opcodes per line is %d\n", 32500);
  exit(1);
}


x86 assembly (clang, -O0):
<sourceSizeLineError>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1030 <recoverableError@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rsi
mov    $0x7ef4,%edx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<sourceSizeLineError>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <recoverableError@plt>
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xee1(%rip),%rsi
mov    $0x7ef4,%edx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"Maximun size of opcodes in a line, is too big\00"
@stderr = global i32 0
@.str.1 = [49 x i8] c" The maximun size in opcodes per line is %d\0A\00"
define void @sourceSizeLineError() {
%1 = call i32 @recoverableError(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stderr
%3 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i32 32500)
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [46 x i8] c"Maximun size of opcodes in a line, is too big\00"
@stderr = global i32 0
@.str.1 = [49 x i8] c" The maximun size in opcodes per line is %d\0A\00"
define void @sourceSizeLineError() {
%1 = tail call i32 @recoverableError(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i32 32500)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ opch32(char);
void spc(void) { opch32(' '); }


x86 assembly (clang, -O0):
<spc>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20,%edi
call   1030 <opch32@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<spc>:
mov    $0x20,%edi
jmp    1030 <opch32@plt>

LLVM IR (-O0):
define void @spc() {
%1 = call i32 @opch32(i8 signext 32)
ret void
}

LLVM IR (-O2):
define void @spc() {
%1 = tail call i32 @opch32(i8 signext 32)
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long event;
};
typedef TYPE_1__ XUnmapEvent;

/* Variables and functions */
void set_XUnmapEvent_event(void *_p, unsigned long _v) {
  ((XUnmapEvent *)_p)->event = (unsigned long)_v;
}


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

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

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define void @set_XUnmapEvent_event(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_2__*
%8 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %7, i32 0, i32 0
store i64 %5, i64* %8
ret void
}

LLVM IR (-O2):
define void @set_XUnmapEvent_event(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gen_the_switch(int, int);
int the_switch(int);
void test_the_switch() {
  int key = 1;
  int res = the_switch(key);
  gen_the_switch(key, res);
}


x86 assembly (clang, -O0):
<test_the_switch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <the_switch@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <gen_the_switch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_the_switch>:
push   %rax
mov    $0x1,%edi
call   1040 <the_switch@plt>
mov    $0x1,%edi
mov    %eax,%esi
pop    %rax
jmp    1030 <gen_the_switch@plt>

LLVM IR (-O0):
define void @test_the_switch() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @the_switch(i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = call i32 @gen_the_switch(i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @test_the_switch() {
%1 = tail call i32 @the_switch(i32 1)
%2 = tail call i32 @gen_the_switch(i32 1, i32 %1)
ret void
}
void fooWithEmptyReturn(int x) {
  if (x)
    return;
  x++;
  return;
}


x86 assembly (clang, -O0):
<fooWithEmptyReturn>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1116 <fooWithEmptyReturn+0x16>
jmp    111f <fooWithEmptyReturn+0x1f>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @fooWithEmptyReturn(i32 %0) {
ret void
}
char *failed() {
  return "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/tests/"
         "test_json.c"
         ":"
         "37"
         ": "
         "fail_msg";
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [156 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/tests/test_json.c:37: fail_msg\00"
define i8* @failed() {
ret i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [156 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/marshall/mintest/refs/heads/master/tests/test_json.c:37: fail_msg\00"
define i8* @failed() {
ret i8* getelementptr inbounds ([156 x i8], [156 x i8]* @.str, i64 0, i64 0)
}
int fs_http_opendir(struct fs_dir *d, const char *url) { return 0; }


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

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

LLVM IR (-O0):
%struct.fs_dir = type opaque
define i32 @fs_http_opendir(%struct.fs_dir* %0, i8* %1) {
%3 = alloca %struct.fs_dir*
%4 = alloca i8*
store %struct.fs_dir* %0, %struct.fs_dir** %3
store i8* %1, i8** %4
ret i32 0
}

LLVM IR (-O2):
%struct.fs_dir = type opaque
define i32 @fs_http_opendir(%struct.fs_dir* nocapture readnone %0, i8* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ core9_swap(char *, int);
void U_EMRARCTO_swap(char *record, int torev) { core9_swap(record, torev); }


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

x86 assembly (clang, -O2):
<U_EMRARCTO_swap>:
jmp    1030 <core9_swap@plt>

LLVM IR (-O0):
define void @U_EMRARCTO_swap(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 i32 @core9_swap(i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @U_EMRARCTO_swap(i8* %0, i32 %1) {
%3 = tail call i32 @core9_swap(i8* %0, i32 %1)
ret void
}
void clearPin(const unsigned int port, const unsigned int pin) {
  const unsigned int bits = 0x00010000 << pin;
  switch (port) {
  case 0:
    (*((volatile unsigned int *const)(0x40040000 + 0x0004))) = bits;
    break;
  case 1:
    (*((volatile unsigned int *const)(0x40040100 + 0x0004))) = bits;
    break;
  case 2:
    (*((volatile unsigned int *const)(0x40040200 + 0x0004))) = bits;
    break;
  }
}


x86 assembly (clang, -O0):
<clearPin>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%cl
mov    $0x10000,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     114c <clearPin+0x4c>
jmp    112a <clearPin+0x2a>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     115b <clearPin+0x5b>
jmp    113b <clearPin+0x3b>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     116a <clearPin+0x6a>
jmp    1174 <clearPin+0x74>
mov    -0xc(%rbp),%ecx
mov    $0x40040004,%eax
mov    %ecx,(%rax)
jmp    1174 <clearPin+0x74>
mov    -0xc(%rbp),%ecx
mov    $0x40040104,%eax
mov    %ecx,(%rax)
jmp    1174 <clearPin+0x74>
mov    -0xc(%rbp),%ecx
mov    $0x40040204,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearPin>:
mov    %esi,%ecx
mov    $0x10000,%eax
shl    %cl,%eax
test   %edi,%edi
je     111e <clearPin+0x1e>
cmp    $0x2,%edi
je     1125 <clearPin+0x25>
cmp    $0x1,%edi
jne    112c <clearPin+0x2c>
mov    $0x40040104,%ecx
jmp    112a <clearPin+0x2a>
mov    $0x40040004,%ecx
jmp    112a <clearPin+0x2a>
mov    $0x40040204,%ecx
mov    %eax,(%rcx)
ret

LLVM IR (-O0):
define void @clearPin(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = shl i32 65536, %6
store i32 %7, i32* %5
%8 = load i32, i32* %3
switch i32 %8, label %15 [
i32 0, label %9
i32 1, label %11
i32 2, label %13
]
9: ; preds = %2
%10 = load i32, i32* %5
store volatile i32 %10, i32* inttoptr (i64 1074003972 to i32*)
br label %15
11: ; preds = %2
%12 = load i32, i32* %5
store volatile i32 %12, i32* inttoptr (i64 1074004228 to i32*)
br label %15
13: ; preds = %2
%14 = load i32, i32* %5
store volatile i32 %14, i32* inttoptr (i64 1074004484 to i32*)
br label %15
15: ; preds = %2, %13, %11, %9
ret void
}

LLVM IR (-O2):
define void @clearPin(i32 %0, i32 %1) {
%3 = shl i32 65536, %1
switch i32 %0, label %8 [
i32 0, label %6
i32 1, label %4
i32 2, label %5
]
4: ; preds = %2
br label %6
5: ; preds = %2
br label %6
6: ; preds = %2, %4, %5
%7 = phi i32* [ inttoptr (i64 1074004484 to i32*), %5 ], [ inttoptr (i64 1074004228 to i32*), %4 ], [ inttoptr (i64 1074003972 to i32*), %2 ]
store volatile i32 %3, i32* %7
br label %8
8: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LCD_WriteCommand(int);
void LCD_ClearScreen(void) { LCD_WriteCommand(0x01); }


x86 assembly (clang, -O0):
<LCD_ClearScreen>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <LCD_WriteCommand@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCD_ClearScreen>:
mov    $0x1,%edi
jmp    1030 <LCD_WriteCommand@plt>

LLVM IR (-O0):
define void @LCD_ClearScreen() {
%1 = call i32 @LCD_WriteCommand(i32 1)
ret void
}

LLVM IR (-O2):
define void @LCD_ClearScreen() {
%1 = tail call i32 @LCD_WriteCommand(i32 1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/ *);
void readToNewLine(FILE *s) {
  int c = 0;
  while ((c = fgetc(s)) != EOF && c != '\n')
    ;
}


x86 assembly (clang, -O0):
<readToNewLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
mov    0x2eae(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0xd(%rbp)
je     114f <readToNewLine+0x3f>
cmpl   $0xa,-0xc(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    115f <readToNewLine+0x4f>
jmp    1164 <readToNewLine+0x54>
jmp    1123 <readToNewLine+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readToNewLine>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eca(%rip),%r14
xchg   %ax,%ax
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0xa,%eax
je     1132 <readToNewLine+0x22>
cmp    (%r14),%eax
jne    1120 <readToNewLine+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
define void @readToNewLine(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
br label %4
4: ; preds = %14, %1
%5 = load i32*, i32** %2
%6 = call i32 @fgetc(i32* %5)
store i32 %6, i32* %3
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 10
br label %12
12: ; preds = %9, %4
%13 = phi i1 [ false, %4 ], [ %11, %9 ]
br i1 %13, label %14, label %15
14: ; preds = %12
br label %4
15: ; preds = %12
ret void
}

LLVM IR (-O2):
@EOF = global i32 0
define void @readToNewLine(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @fgetc(i32* %0)
%4 = load i32, i32* @EOF
%5 = icmp ne i32 %3, %4
%6 = icmp ne i32 %3, 10
%7 = and i1 %6, %5
br i1 %7, label %2, label %8
8: ; preds = %2
ret void
}
/* Type definitions */
struct stat {
  long st_size;
};

/* Variables and functions */
int fstat(int, struct stat *);
int /*<<< orphan*/ galinette_setError(int, char *);
long getfilesize(int fd) {
  int ret;
  struct stat stbuf;
  ret = fstat(fd, &stbuf);
  if (ret < 0) {
    galinette_setError(-0x11, "Failed to get file size");
    return -0x11;
  }
  return stbuf.st_size;
}


x86 assembly (clang, -O0):
<getfilesize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1040 <fstat@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jge    1162 <getfilesize+0x42>
mov    $0xffffffef,%edi
lea    0xeb0(%rip),%rsi
call   1030 <galinette_setError@plt>
movq   $0xffffffffffffffef,-0x8(%rbp)
ff
jmp    116a <getfilesize+0x4a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getfilesize>:
push   %rax
mov    %rsp,%rsi
call   1040 <fstat@plt>
test   %eax,%eax
js     1133 <getfilesize+0x13>
mov    (%rsp),%rax
pop    %rcx
ret
lea    0xec6(%rip),%rsi
mov    $0xffffffef,%edi
call   1030 <galinette_setError@plt>
mov    $0xffffffffffffffef,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
@.str = [24 x i8] c"Failed to get file size\00"
define i64 @getfilesize(i32 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.stat
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @fstat(i32 %6, %struct.stat* %5)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @galinette_setError(i32 -17, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
store i64 -17, i64* %2
br label %15
12: ; preds = %1
%13 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 0
%14 = load i64, i64* %13
store i64 %14, i64* %2
br label %15
15: ; preds = %12, %10
%16 = load i64, i64* %2
ret i64 %16
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@.str = [24 x i8] c"Failed to get file size\00"
define i64 @getfilesize(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @fstat(i32 %0, %struct.stat* %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @galinette_setError(i32 -17, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %11
8: ; preds = %1
%9 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%10 = load i64, i64* %9
br label %11
11: ; preds = %8, %6
%12 = phi i64 [ -17, %6 ], [ %10, %8 ]
ret i64 %12
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void put_field(unsigned int start, unsigned int len) {
  int cur_bitshift = ((start + len) % 8) - 8;
  if (cur_bitshift > -8)
    exit(0);
}


x86 assembly (clang, -O0):
<put_field>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
and    $0x7,%eax
sub    $0x8,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xfffffff8,-0xc(%rbp)
jle    113e <put_field+0x2e>
xor    %edi,%edi
call   1030 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_field>:
add    %esi,%edi
test   $0x7,%dil
jne    1119 <put_field+0x9>
ret
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @put_field(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = add i32 %6, %7
%9 = urem i32 %8, 8
%10 = sub i32 %9, 8
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp sgt i32 %11, -8
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @exit(i32 0)
unreachable
15: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @put_field(i32 %0, i32 %1) {
%3 = add i32 %1, %0
%4 = and i32 %3, 7
%5 = icmp eq i32 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ little_endian_read_16(int /*<<< orphan*/ const *, int);
uint16_t bnep_event_channel_opened_get_mtu(const uint8_t *event) {
  return little_endian_read_16(event, 9);
}


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

x86 assembly (clang, -O2):
<bnep_event_channel_opened_get_mtu>:
mov    $0x9,%esi
jmp    1030 <little_endian_read_16@plt>

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

LLVM IR (-O2):
define i32 @bnep_event_channel_opened_get_mtu(i32* %0) {
%2 = tail call i32 @little_endian_read_16(i32* %0, i32 9)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int by_pointer(int *x, int *y) {
  (*x) = 1;
  (*y) = 10;
  printf("%2d %2d\n", *x, *y);
  return 0;
}


x86 assembly (clang, -O0):
<by_pointer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
movl   $0xa,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<by_pointer>:
push   %rax
movl   $0x1,(%rdi)
movl   $0xa,(%rsi)
mov    (%rdi),%esi
lea    0xeda(%rip),%rdi
mov    $0xa,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"%2d %2d\0A\00"
define i32 @by_pointer(i32* nocapture %0, i32* nocapture writeonly %1) {
store i32 1, i32* %0
store i32 10, i32* %1
%3 = load i32, i32* %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %3, i32 10)
ret i32 0
}
int main(void) {
  int i;
  unsigned u;
  i = 1;
  i = -1;
  i = -1l;
  i = -1u;
  i = -1ll;
  i = 32766 + 1 & 3;
  i = (int)32768 < 0;
  i = -1u < 0;
  u = 1;
  u = -1;
  u = -1l;
  u = -1u;
  u = -1ll;
  u = (unsigned)32768 < 0;
  u = 32766 + 1 & 3;
  u = -1u < 0;
  return 0;
}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @traceBegin() {
%1 = tail call i32 (...) @traceInit()
ret void
}
/* Variables and functions */
scalar_t__ sin(double);
long double sinl(long double x) { return (long double)sin((double)x); }


x86 assembly (clang, -O0):
<sinl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fstpl  -0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <sin@plt>
mov    %rax,-0x18(%rbp)
fildll -0x18(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinl>:
sub    $0x18,%rsp
fldt   0x20(%rsp)
fstpl  0x8(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
mov    %rax,0x10(%rsp)
fildll 0x10(%rsp)
add    $0x18,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @sinl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = fptrunc x86_fp80 %3 to double
%5 = call i64 @sin(double %4)
%6 = sitofp i64 %5 to x86_fp80
ret x86_fp80 %6
}

LLVM IR (-O2):
define x86_fp80 @sinl(x86_fp80 %0) {
%2 = fptrunc x86_fp80 %0 to double
%3 = tail call i64 @sin(double %2)
%4 = sitofp i64 %3 to x86_fp80
ret x86_fp80 %4
}
void rl_bind_key(char foo, int (*func)(int, int)) {}


x86 assembly (clang, -O0):
<rl_bind_key>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @rl_bind_key(i8 signext %0, i32 (i32, i32)* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void *func(void *arg) {
  printf("thread %d\n", (int)arg);
  return NULL;
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%esi
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"thread %d\0A\00"
define i8* @func(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i32
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i8* null
}

LLVM IR (-O2):
@.str = [11 x i8] c"thread %d\0A\00"
define noalias i8* @func(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void HelloFunc() { printf("Hello,World\n"); }


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

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

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

LLVM IR (-O2):
@str = [12 x i8] c"Hello,World\00"
define void @HelloFunc() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
void Default_Handler(void) {
  while (true) {
  }
}


x86 assembly (clang, -O0):
<Default_Handler>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <Default_Handler+0x9>
jmp    1109 <Default_Handler+0x9>

x86 assembly (clang, -O2):
<Default_Handler>:
jmp    1100 <Default_Handler>

LLVM IR (-O0):
define void @Default_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @Default_Handler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
size_t first_component_len(const char *s) {
  const char *first = s;
  while (*s && *s != '.')
    s++;
  return s - first;
}


x86 assembly (clang, -O0):
<first_component_len>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1135 <first_component_len+0x35>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1145 <first_component_len+0x45>
jmp    1156 <first_component_len+0x56>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <first_component_len+0x10>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<first_component_len>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi,%rax,1),%ecx
test   %cl,%cl
je     1123 <first_component_len+0x23>
cmp    $0x2e,%cl
je     1123 <first_component_len+0x23>
add    $0x1,%rax
jmp    1110 <first_component_len+0x10>
ret

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

LLVM IR (-O2):
define i64 @first_component_len(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %7
i8 46, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2, %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ create_write_byte(int);
void create_wait_length(int distance) {
  ;
  create_write_byte(156);
  create_write_byte(((distance & 0xFFFF) >> 8));
  create_write_byte((distance & 0xFF));
  ;
}


x86 assembly (clang, -O0):
<create_wait_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x9c,%edi
call   1030 <create_write_byte@plt>
mov    -0x4(%rbp),%edi
and    $0xffff,%edi
sar    $0x8,%edi
call   1030 <create_write_byte@plt>
mov    -0x4(%rbp),%edi
and    $0xff,%edi
call   1030 <create_write_byte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_wait_length>:
push   %rbx
mov    %edi,%ebx
mov    $0x9c,%edi
call   1030 <create_write_byte@plt>
movzbl %bh,%edi
call   1030 <create_write_byte@plt>
movzbl %bl,%edi
pop    %rbx
jmp    1030 <create_write_byte@plt>

LLVM IR (-O0):
define void @create_wait_length(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @create_write_byte(i32 156)
%4 = load i32, i32* %2
%5 = and i32 %4, 65535
%6 = ashr i32 %5, 8
%7 = call i32 @create_write_byte(i32 %6)
%8 = load i32, i32* %2
%9 = and i32 %8, 255
%10 = call i32 @create_write_byte(i32 %9)
ret void
}

LLVM IR (-O2):
define void @create_wait_length(i32 %0) {
%2 = tail call i32 @create_write_byte(i32 156)
%3 = lshr i32 %0, 8
%4 = and i32 %3, 255
%5 = tail call i32 @create_write_byte(i32 %4)
%6 = and i32 %0, 255
%7 = tail call i32 @create_write_byte(i32 %6)
ret void
}
/* Type definitions */
struct timeval {
  double tv_sec;
  int tv_usec;
};

/* Variables and functions */
double timeval_to_secs(struct timeval *t) {
  return t->tv_sec + t->tv_usec / 1e6;
}


x86 assembly (clang, -O0):
<timeval_to_secs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
cvtsi2sdl 0x8(%rax),%xmm1
movsd  0xedf(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeval_to_secs>:
cvtsi2sdl 0x8(%rdi),%xmm0
divsd  0xef3(%rip),%xmm0
addsd  (%rdi),%xmm0
ret

LLVM IR (-O0):
%struct.timeval = type { double, i32 }
define double @timeval_to_secs(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %2
%3 = load %struct.timeval*, %struct.timeval** %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%5 = load double, double* %4
%6 = load %struct.timeval*, %struct.timeval** %2
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i32 0, i32 1
%8 = load i32, i32* %7
%9 = sitofp i32 %8 to double
%10 = fdiv double %9, 1.000000e+06
%11 = fadd double %5, %10
ret double %11
}

LLVM IR (-O2):
%struct.timeval = type { double, i32 }
define double @timeval_to_secs(%struct.timeval* nocapture %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%3 = load double, double* %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%5 = load i32, i32* %4
%6 = sitofp i32 %5 to double
%7 = fdiv double %6, 1.000000e+06
%8 = fadd double %3, %7
ret double %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int unaddr_test2(int *val_p) {
  int x = 1;
  printf("testing access after free\n");
  return (*val_p & x) ? 1 : 0;
}


x86 assembly (clang, -O0):
<unaddr_test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
and    -0xc(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unaddr_test2>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%eax
and    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"testing access after free\0A\00"
define i32 @unaddr_test2(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 1, i32* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
%7 = load i32, i32* %3
%8 = and i32 %6, %7
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 1, i32 0
ret i32 %11
}

LLVM IR (-O2):
@str = [26 x i8] c"testing access after free\00"
define i32 @unaddr_test2(i32* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%3 = load i32, i32* %0
%4 = and i32 %3, 1
ret i32 %4
}
long fibonacci(long n) {
  if (n == 0 || n == 1) {
    return n;
  } else {
    return fibonacci(n - 1) + fibonacci(n - 2);
  }
}


x86 assembly (clang, -O0):
<fibonacci>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1132 <fibonacci+0x22>
cmpq   $0x1,-0x10(%rbp)
jne    113f <fibonacci+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116b <fibonacci+0x5b>
mov    -0x10(%rbp),%rdi
sub    $0x1,%rdi
call   1030 <fibonacci@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
sub    $0x2,%rdi
call   1030 <fibonacci@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fibonacci>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %r14d,%r14d
cmp    $0x2,%rdi
jb     1136 <fibonacci+0x26>
lea    -0x1(%rbx),%rdi
call   1030 <fibonacci@plt>
add    $0xfffffffffffffffe,%rbx
add    %rax,%r14
cmp    $0x1,%rbx
ja     1120 <fibonacci+0x10>
add    %rbx,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @fibonacci(i64 %0) {
%2 = icmp ult i64 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ %0, %1 ]
%5 = phi i64 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i64 %4, -1
%7 = tail call i64 @fibonacci(i64 %6)
%8 = add nsw i64 %4, -2
%9 = add nsw i64 %7, %5
%10 = icmp ult i64 %8, 2
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i64 [ 0, %1 ], [ %9, %3 ]
%13 = phi i64 [ %0, %1 ], [ %8, %3 ]
%14 = add nsw i64 %13, %12
ret i64 %14
}
void disable_FPE(void) {}


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

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

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

LLVM IR (-O2):
define void @disable_FPE() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ maxheapify(double *, int, int);
void buildmaxheap(double A[], int n) {
  int i;
  for (i = n / 2; i >= 0; i--) {
    maxheapify(A, i, n);
  }
}


x86 assembly (clang, -O0):
<buildmaxheap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1154 <buildmaxheap+0x44>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <maxheapify@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <buildmaxheap+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buildmaxheap>:
push   %rbp
push   %r14
push   %rbx
cmp    $0xffffffff,%esi
jl     1141 <buildmaxheap+0x31>
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%ebp
shr    $0x1f,%ebp
add    %esi,%ebp
sar    %ebp
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <maxheapify@plt>
add    $0xffffffff,%ebp
jb     1130 <buildmaxheap+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @buildmaxheap(double* %0, i32 %1) {
%3 = icmp sgt i32 %1, -2
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = sdiv i32 %1, 2
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ %9, %6 ], [ %5, %4 ]
%8 = tail call i32 @maxheapify(double* %0, i32 %7, i32 %1)
%9 = add nsw i32 %7, -1
%10 = icmp eq i32 %7, 0
br i1 %10, label %11, label %6
11: ; preds = %6, %2
ret void
}
void chld(int sig) {}


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

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

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

LLVM IR (-O2):
define void @chld(i32 %0) {
ret void
}
char *strcat(char *dest, const char *src) {
  char *pdest = dest;
  while (*pdest != '\0')
    pdest++;
  while (*src != '\0')
    *pdest++ = *src++;
  *pdest = '\0';
  return dest;
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1135 <strcat+0x35>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1114 <strcat+0x14>
jmp    113a <strcat+0x3a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1171 <strcat+0x71>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
jmp    113a <strcat+0x3a>
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
mov    %rdi,%rax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
mov    %rcx,%rdi
add    $0x1,%rcx
cmpb   $0x0,(%rdi)
jne    1110 <strcat+0x10>
mov    (%rsi),%dl
test   %dl,%dl
je     1146 <strcat+0x46>
mov    $0xffffffffffffffff,%rdi
nopl   0x0(%rax)
mov    %dl,(%rcx,%rdi,1)
movzbl 0x2(%rsi,%rdi,1),%edx
add    $0x1,%rdi
test   %dl,%dl
jne    1130 <strcat+0x30>
add    %rdi,%rcx
mov    %rcx,%rdi
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define i8* @strcat(i8* returned %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 = load i8, i8* %1
%10 = icmp eq i8 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %8, %11
%12 = phi i8 [ %17, %11 ], [ %9, %8 ]
%13 = phi i8* [ %16, %11 ], [ %4, %8 ]
%14 = phi i8* [ %15, %11 ], [ %1, %8 ]
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = getelementptr inbounds i8, i8* %13, i64 1
store i8 %12, i8* %13
%17 = load i8, i8* %15
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %11
19: ; preds = %11, %8
%20 = phi i8* [ %4, %8 ], [ %16, %11 ]
store i8 0, i8* %20
ret i8* %0
}
int calc_6to8(int c) {
  int ic, i8;
  double d8;
  ic = c;
  if (ic == 64)
    ic = 63;
  else
    ic &= 0x3f;
  d8 = (ic / 63.0) * 255.0;
  i8 = (int)d8;
  return (i8 & 0xff);
}


x86 assembly (clang, -O0):
<calc_6to8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x40,-0x8(%rbp)
jne    1123 <calc_6to8+0x23>
movl   $0x3f,-0x8(%rbp)
jmp    112c <calc_6to8+0x2c>
mov    -0x8(%rbp),%eax
and    $0x3f,%eax
mov    %eax,-0x8(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xecf(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xebb(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvttsd2si -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_6to8>:
mov    %edi,%eax
and    $0x3f,%eax
cmp    $0x40,%edi
cvtsi2sd %eax,%xmm0
divsd  0xeec(%rip),%xmm0
mulsd  0xeec(%rip),%xmm0
cvttsd2si %xmm0,%eax
movzbl %al,%ecx
mov    $0xff,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @calc_6to8(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 %0, i32* %2
%6 = load i32, i32* %2
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 64
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 63, i32* %3
br label %13
10: ; preds = %1
%11 = load i32, i32* %3
%12 = and i32 %11, 63
store i32 %12, i32* %3
br label %13
13: ; preds = %10, %9
%14 = load i32, i32* %3
%15 = sitofp i32 %14 to double
%16 = fdiv double %15, 6.300000e+01
%17 = fmul double %16, 2.550000e+02
store double %17, double* %5
%18 = load double, double* %5
%19 = fptosi double %18 to i32
store i32 %19, i32* %4
%20 = load i32, i32* %4
%21 = and i32 %20, 255
ret i32 %21
}

LLVM IR (-O2):
define i32 @calc_6to8(i32 %0) {
%2 = icmp eq i32 %0, 64
%3 = and i32 %0, 63
%4 = sitofp i32 %3 to double
%5 = fdiv double %4, 6.300000e+01
%6 = fmul double %5, 2.550000e+02
%7 = fptosi double %6 to i32
%8 = and i32 %7, 255
%9 = select i1 %2, i32 255, i32 %8
ret i32 %9
}
void INT_Excep_WDT_WUNI(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_WDT_WUNI() {
ret void
}
/* Variables and functions */
char *stdc_FC0428A6(char const *);
char *strdup(const char *s) { return stdc_FC0428A6(s); }


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

x86 assembly (clang, -O2):
<strdup>:
jmp    1030 <stdc_FC0428A6@plt>

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

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i8* @stdc_FC0428A6(i8* %0)
ret i8* %2
}
int bar(void) { return 0x1234; }


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

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

LLVM IR (-O0):
define i32 @bar() {
ret i32 4660
}

LLVM IR (-O2):
define i32 @bar() {
ret i32 4660
}
void XtSetMultiClickTime() {}


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

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

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

LLVM IR (-O2):
define void @XtSetMultiClickTime() {
ret void
}
double __ev_fabs(double x) { return x > 0.0 ? x : -x; }


x86 assembly (clang, -O0):
<__ev_fabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    112a <__ev_fabs+0x2a>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    114b <__ev_fabs+0x4b>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ev_fabs>:
movapd 0xef8(%rip),%xmm1
xorpd  %xmm0,%xmm1
xorpd  %xmm2,%xmm2
cmpltsd %xmm0,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @__ev_fabs(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ogt double %3, 0.000000e+00
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load double, double* %2
br label %10
7: ; preds = %1
%8 = load double, double* %2
%9 = fneg double %8
br label %10
10: ; preds = %7, %5
%11 = phi double [ %6, %5 ], [ %9, %7 ]
ret double %11
}

LLVM IR (-O2):
define double @__ev_fabs(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %0, double %3
ret double %4
}
char *LeslieStrcpy(char *dest, char *src) {
  while ((*dest++ = *src++) != '\0')
    ;
  return dest;
}


x86 assembly (clang, -O0):
<LeslieStrcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     113f <LeslieStrcpy+0x3f>
jmp    110c <LeslieStrcpy+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LeslieStrcpy>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rsi),%ecx
add    $0x1,%rsi
mov    %cl,(%rax)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <LeslieStrcpy+0x10>
ret

LLVM IR (-O0):
define i8* @LeslieStrcpy(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 = %13, %2
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %4
%8 = load i8, i8* %6
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %3
store i8 %8, i8* %9
%11 = sext i8 %8 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %5
br label %5
14: ; preds = %5
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
define i8* @LeslieStrcpy(i8* writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = phi i8* [ %1, %2 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %7, i8* %4
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %8
}
/* Variables and functions */
void *__nacl_irt_tls_get();
void *__attribute__((const)) __nacl_read_tp() { return __nacl_irt_tls_get(); }


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

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

LLVM IR (-O0):
define i8* @__nacl_read_tp() {
%1 = call i8* (...) @__nacl_irt_tls_get()
ret i8* %1
}

LLVM IR (-O2):
define i8* @__nacl_read_tp() {
%1 = tail call i8* (...) @__nacl_irt_tls_get()
ret i8* %1
}