xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ sprintf(char *, char *, char const *);
FILE *topdf(const char *filename) {
  char command[1024];
  puts("Content-Type: application/pdf\n");
  sprintf(command, "htmldoc -t pdf --webpage %s", filename);
  return (popen(command, "w"));
}


x86 assembly (clang, -O0):
<topdf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xec2(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x410(%rbp),%rdi
lea    0xecb(%rip),%rsi
call   1040 <popen@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<topdf>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%rbx
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
lea    0xecf(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %rbx,%rdx
call   1050 <sprintf@plt>
lea    0xed6(%rip),%rsi
mov    %r14,%rdi
call   1040 <popen@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Content-Type: application/pdf\0A\00"
@.str.1 = [28 x i8] c"htmldoc -t pdf --webpage %s\00"
@.str.2 = [2 x i8] c"w\00"
define i32* @topdf(i8* %0) {
%2 = alloca i8*
%3 = alloca [1024 x i8]
store i8* %0, i8** %2
%4 = call i32 @puts(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%9 = call i32* @popen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32* %9
}

LLVM IR (-O2):
@.str = [31 x i8] c"Content-Type: application/pdf\0A\00"
@.str.1 = [28 x i8] c"htmldoc -t pdf --webpage %s\00"
@.str.2 = [2 x i8] c"w\00"
define noalias i32* @topdf(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = call i32* @popen(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32* %6
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void runAutostart(void) {
  system("~/.config/cswm/autostart_blocking.sh");
  system("~/.config/cswm/autostart.sh &");
}


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

x86 assembly (clang, -O2):
<runAutostart>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <system@plt>
lea    0xf01(%rip),%rdi
pop    %rax
jmp    1030 <system@plt>

LLVM IR (-O0):
@.str = [37 x i8] c"~/.config/cswm/autostart_blocking.sh\00"
@.str.1 = [30 x i8] c"~/.config/cswm/autostart.sh &\00"
define void @runAutostart() {
%1 = call i32 @system(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @system(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"~/.config/cswm/autostart_blocking.sh\00"
@.str.1 = [30 x i8] c"~/.config/cswm/autostart.sh &\00"
define void @runAutostart() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
char getchar();
int /*<<< orphan*/ scanf(char *, int *);
void getopt(int *option) {
  scanf("%1d", option);
  while (getchar() != '\n')
    ;
}


x86 assembly (clang, -O0):
<getopt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1040 <scanf@plt>
mov    $0x0,%al
call   1030 <getchar@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1154 <getopt+0x34>
jmp    113c <getopt+0x1c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getopt>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1040 <scanf@plt>
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
jne    1130 <getopt+0x10>
pop    %rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%1d\00"
define void @getopt(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %5
5: ; preds = %9, %1
%6 = call signext i8 (...) @getchar()
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 10
br i1 %8, label %9, label %10
9: ; preds = %5
br label %5
10: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%1d\00"
define void @getopt(i32* %0) {
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %0)
br label %3
3: ; preds = %3, %1
%4 = tail call signext i8 (...) @getchar()
%5 = icmp eq i8 %4, 10
br i1 %5, label %6, label %3
6: ; preds = %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ result;

/* Variables and functions */
int /*<<< orphan*/ ft_putstr(char *);
int readlink(char const *, char *, int);
void put_symlink(char const *s) {
  char result[256];
  int len;
  len = readlink(s, result, sizeof(result));
  if (len == -1)
    return;
  else {
    ft_putstr(" -> ");
    result[len] = '\0';
    ft_putstr(result);
  }
}


x86 assembly (clang, -O0):
<put_symlink>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    $0x100,%edx
call   1030 <readlink@plt>
mov    %eax,-0x114(%rbp)
cmpl   $0xffffffff,-0x114(%rbp)
jne    115c <put_symlink+0x3c>
jmp    1183 <put_symlink+0x63>
lea    0xe9d(%rip),%rdi
call   1040 <ft_putstr@plt>
movslq -0x114(%rbp),%rax
movb   $0x0,-0x110(%rbp,%rax,1)
lea    -0x110(%rbp),%rdi
call   1040 <ft_putstr@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_symlink>:
push   %rbx
sub    $0x100,%rsp
mov    %rsp,%rsi
mov    $0x100,%edx
call   1030 <readlink@plt>
cmp    $0xffffffff,%eax
je     1157 <put_symlink+0x37>
mov    %eax,%ebx
lea    0xebd(%rip),%rdi
call   1040 <ft_putstr@plt>
movslq %ebx,%rax
movb   $0x0,(%rsp,%rax,1)
mov    %rsp,%rdi
call   1040 <ft_putstr@plt>
add    $0x100,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c" -> \00"
define void @put_symlink(i8* nocapture %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @readlink(i8* %0, i8* %3, i32 256)
%5 = icmp eq i32 %4, -1
br i1 %5, label %11, label %6
6: ; preds = %1
%7 = tail call i32 @ft_putstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = sext i32 %4 to i64
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 %8
store i8 0, i8* %9
%10 = call i32 @ft_putstr(i8* %3)
br label %11
11: ; preds = %1, %6
ret void
}
int test_imm_8Fint16_mem(short *val) {
  return ((*val) & (-0x8F << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_8Fint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -143
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void ASN1_item_ex_new(void) {}


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

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

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

LLVM IR (-O2):
define void @ASN1_item_ex_new() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ generate_states();
int /*<<< orphan*/ set_derives();
int /*<<< orphan*/ set_nullable();
void lr0(void) {
  set_derives();
  set_nullable();
  generate_states();
}


x86 assembly (clang, -O0):
<lr0>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <set_derives@plt>
mov    $0x0,%al
call   1050 <set_nullable@plt>
mov    $0x0,%al
call   1030 <generate_states@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lr0>:
push   %rax
xor    %eax,%eax
call   1040 <set_derives@plt>
xor    %eax,%eax
call   1050 <set_nullable@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <generate_states@plt>

LLVM IR (-O0):
define void @lr0() {
%1 = call i32 (...) @set_derives()
%2 = call i32 (...) @set_nullable()
%3 = call i32 (...) @generate_states()
ret void
}

LLVM IR (-O2):
define void @lr0() {
%1 = tail call i32 (...) @set_derives()
%2 = tail call i32 (...) @set_nullable()
%3 = tail call i32 (...) @generate_states()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SysCtlClockGet();
int /*<<< orphan*/ UARTStdioConfig(unsigned long, int, int /*<<< orphan*/);
void UARTStdioInit(unsigned long ulPortNum) {
  UARTStdioConfig(ulPortNum, 115200, SysCtlClockGet());
}


x86 assembly (clang, -O0):
<UARTStdioInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <SysCtlClockGet@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%edx
mov    $0x1c200,%esi
call   1040 <UARTStdioConfig@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTStdioInit>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <SysCtlClockGet@plt>
mov    %rbx,%rdi
mov    $0x1c200,%esi
mov    %eax,%edx
pop    %rbx
jmp    1040 <UARTStdioConfig@plt>

LLVM IR (-O0):
define void @UARTStdioInit(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 (...) @SysCtlClockGet()
%5 = call i32 @UARTStdioConfig(i64 %3, i32 115200, i32 %4)
ret void
}

LLVM IR (-O2):
define void @UARTStdioInit(i64 %0) {
%2 = tail call i32 (...) @SysCtlClockGet()
%3 = tail call i32 @UARTStdioConfig(i64 %0, i32 115200, i32 %2)
ret void
}
/* Variables and functions */
char *strchr(char *, char);
void sdb_chomp(char *p) {
  if ((p = strchr(p, '\n')))
    *p = '\0';
}


x86 assembly (clang, -O0):
<sdb_chomp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     113f <sdb_chomp+0x2f>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sdb_chomp>:
push   %rax
mov    $0xa,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1123 <sdb_chomp+0x13>
movb   $0x0,(%rax)
pop    %rax
ret

LLVM IR (-O0):
define void @sdb_chomp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @strchr(i8* %3, i8 signext 10)
store i8* %4, i8** %2
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = load i8*, i8** %2
store i8 0, i8* %7
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @sdb_chomp(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 10)
%3 = icmp eq i8* %2, null
br i1 %3, label %5, label %4
4: ; preds = %1
store i8 0, i8* %2
br label %5
5: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void test_start(const char *name) {
  printf("\n------ test start ------\n  RUNNING: %s\n", name);
}


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

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

LLVM IR (-O2):
@.str = [41 x i8] c"\0A------ test start ------\0A RUNNING: %s\0A\00"
define void @test_start(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
extern void shmem_longdouble_p(long double *addr, long double value, int pe) {
  printf("\nOpenSHMEM Analyzer\n");
}


x86 assembly (clang, -O0):
<shmem_longdouble_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
mov    %rdi,-0x8(%rbp)
fstpt  -0x20(%rbp)
mov    %esi,-0x24(%rbp)
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [21 x i8] c"\0AOpenSHMEM Analyzer\0A\00"
define void @shmem_longdouble_p(x86_fp80* %0, x86_fp80 %1, i32 %2) {
%4 = alloca x86_fp80*
%5 = alloca x86_fp80
%6 = alloca i32
store x86_fp80* %0, x86_fp80** %4
store x86_fp80 %1, x86_fp80* %5
store i32 %2, i32* %6
%7 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [20 x i8] c"\0AOpenSHMEM Analyzer\00"
define void @shmem_longdouble_p(x86_fp80* nocapture readnone %0, x86_fp80 %1, i32 %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
ret void
}
int mswin_minorver() { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @mswin_minorver() {
ret i32 0
}
/* Variables and functions */
char *find_path(char *);
char *flu_pline(char *, char *);
int /*<<< orphan*/ free(char *);
char *hlp_last_msg(char *exid) {
  char *path = find_path(exid);
  char *s = flu_pline("tail -1 %s/msg.log", path);
  free(path);
  return s;
}


x86 assembly (clang, -O0):
<hlp_last_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <find_path@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeac(%rip),%rdi
call   1050 <flu_pline@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hlp_last_msg>:
push   %r14
push   %rbx
push   %rax
call   1040 <find_path@plt>
mov    %rax,%rbx
lea    0xebd(%rip),%rdi
mov    %rax,%rsi
call   1050 <flu_pline@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [19 x i8] c"tail -1 %s/msg.log\00"
define i8* @hlp_last_msg(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @find_path(i8* %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i8* @flu_pline(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %7)
store i8* %8, i8** %4
%9 = load i8*, i8** %3
%10 = call i32 @free(i8* %9)
%11 = load i8*, i8** %4
ret i8* %11
}

LLVM IR (-O2):
@.str = [19 x i8] c"tail -1 %s/msg.log\00"
define i8* @hlp_last_msg(i8* %0) {
%2 = tail call i8* @find_path(i8* %0)
%3 = tail call i8* @flu_pline(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @free(i8* %2)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned short);
void main(void) {
  unsigned short i = 0x3f57;
  printf("output: 0x%x\n", i);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movw   $0x3f57,-0x2(%rbp)
lea    0xedb(%rip),%rdi
movzwl -0x2(%rbp),%esi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
mov    $0x3f57,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [14 x i8] c"output: 0x%x\0A\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i16 zeroext 16215)
ret void
}
void RTManifestEquals(void) {}


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

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

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

LLVM IR (-O2):
define void @RTManifestEquals() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int _read_usage(void) {
  fputs("Usage: read [-r] var...\n  -r	do not escape backslashes\n", stderr);
  return 1;
}


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

x86 assembly (clang, -O2):
<_read_usage>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [56 x i8] c"Usage: read [-r] var...\0A -r\09do not escape backslashes\0A\00"
@stderr = global i32 0
define i32 @_read_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}

LLVM IR (-O2):
@.str = [56 x i8] c"Usage: read [-r] var...\0A -r\09do not escape backslashes\0A\00"
@stderr = global i32 0
define i32 @_read_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}
__typeof__(isprint("")) test_isprint_44(void) { return isprint(""); }


x86 assembly (clang, -O0):
<test_isprint_44>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rax
mov    %eax,%edi
call   1030 <isprint@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @test_isprint_44() {
%1 = call i32 @isprint(i32 ptrtoint ([1 x i8]* @.str to i32))
ret i32 %1
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @test_isprint_44() {
%1 = tail call i32 @isprint(i32 ptrtoint ([1 x i8]* @.str to i32))
ret i32 %1
}
int test_imm_8Bint32_reg(int val) { return ((val) & (0x8B << 0)) ? -20 : -40; }


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

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

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

LLVM IR (-O2):
define i32 @test_imm_8Bint32_reg(i32 %0) {
%2 = and i32 %0, 139
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int g_DUMMY_popup_messagebox3(int win_id, char *title, char *message,
                              char *button1text, char *button2text,
                              char *button3text) {
  win_id = win_id;
  title = title;
  message = message;
  button1text = button1text;
  button2text = button2text;
  button3text = button3text;
  return 3;
}


x86 assembly (clang, -O0):
<g_DUMMY_popup_messagebox3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    $0x3,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @g_DUMMY_popup_messagebox3(i32 %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
store i32 %0, i32* %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i8* %5, i8** %12
%13 = load i32, i32* %7
store i32 %13, i32* %7
%14 = load i8*, i8** %8
store i8* %14, i8** %8
%15 = load i8*, i8** %9
store i8* %15, i8** %9
%16 = load i8*, i8** %10
store i8* %16, i8** %10
%17 = load i8*, i8** %11
store i8* %17, i8** %11
%18 = load i8*, i8** %12
store i8* %18, i8** %12
ret i32 3
}

LLVM IR (-O2):
define i32 @g_DUMMY_popup_messagebox3(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i8* nocapture readnone %4, i8* nocapture readnone %5) {
ret i32 3
}
/* Variables and functions */
char getchr();
int /*<<< orphan*/ trm_xstr(char *);
void trm_wait(void) {
  trm_xstr("  << MORE >>");
  while (getchr() != '\n')
    ;
  trm_xstr("            \r");
}


x86 assembly (clang, -O0):
<trm_wait>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <trm_xstr@plt>
mov    $0x0,%al
call   1030 <getchr@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     1148 <trm_wait+0x28>
jmp    1130 <trm_wait+0x10>
lea    0xebe(%rip),%rdi
call   1040 <trm_xstr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<trm_wait>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <trm_xstr@plt>
nopl   (%rax)
xor    %eax,%eax
call   1030 <getchr@plt>
cmp    $0xa,%al
jne    1130 <trm_wait+0x10>
lea    0xecb(%rip),%rdi
pop    %rax
jmp    1040 <trm_xstr@plt>

LLVM IR (-O0):
@.str = [13 x i8] c" << MORE >>\00"
@.str.1 = [14 x i8] c" \0D\00"
define void @trm_wait() {
%1 = call i32 @trm_xstr(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %6, %0
%3 = call signext i8 (...) @getchr()
%4 = sext i8 %3 to i32
%5 = icmp ne i32 %4, 10
br i1 %5, label %6, label %7
6: ; preds = %2
br label %2
7: ; preds = %2
%8 = call i32 @trm_xstr(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c" << MORE >>\00"
@.str.1 = [14 x i8] c" \0D\00"
define void @trm_wait() {
%1 = tail call i32 @trm_xstr(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %2, %0
%3 = tail call signext i8 (...) @getchr()
%4 = icmp eq i8 %3, 10
br i1 %4, label %5, label %2
5: ; preds = %2
%6 = tail call i32 @trm_xstr(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ define_config(char const *, unsigned int, unsigned int);
scalar_t__ is_defined_config(char const *, unsigned int, unsigned int);
int /*<<< orphan*/ print_config(char const *, unsigned int);
unsigned int strhash(char const *, unsigned int);
void use_config(const char *m, unsigned int slen) {
  unsigned int hash = strhash(m, slen);
  if (is_defined_config(m, slen, hash))
    return;
  define_config(m, slen, hash);
  print_config(m, slen);
}


x86 assembly (clang, -O0):
<use_config>:
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 <strhash@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1050 <is_defined_config@plt>
cmp    $0x0,%rax
je     117c <use_config+0x3c>
jmp    1197 <use_config+0x57>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <define_config@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1060 <print_config@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<use_config>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strhash@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1050 <is_defined_config@plt>
test   %rax,%rax
je     1167 <use_config+0x27>
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <define_config@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1060 <print_config@plt>

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

LLVM IR (-O2):
define void @use_config(i8* %0, i32 %1) {
%3 = tail call i32 @strhash(i8* %0, i32 %1)
%4 = tail call i64 @is_defined_config(i8* %0, i32 %1, i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @define_config(i8* %0, i32 %1, i32 %3)
%8 = tail call i32 @print_config(i8* %0, i32 %1)
br label %9
9: ; preds = %2, %6
ret void
}
int Operand_uimm6_encode(unsigned int *valp) {
  unsigned imm6_0, uimm6_0;
  uimm6_0 = *valp;
  imm6_0 = (uimm6_0 - 0x4) & 0x3f;
  *valp = imm6_0;
  return 0;
}


x86 assembly (clang, -O0):
<Operand_uimm6_encode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
and    $0x3f,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Operand_uimm6_encode>:
mov    (%rdi),%eax
add    $0x3c,%eax
and    $0x3f,%eax
mov    %eax,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @Operand_uimm6_encode(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = load i32, i32* %5
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = sub i32 %7, 4
%9 = and i32 %8, 63
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = load i32*, i32** %2
store i32 %10, i32* %11
ret i32 0
}

LLVM IR (-O2):
define i32 @Operand_uimm6_encode(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = add i32 %2, 60
%4 = and i32 %3, 63
store i32 %4, i32* %0
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint64_t;

/* Variables and functions */
void to_array(uint8_t *result, const uint64_t src) {
  for (size_t i = 0; i < 8; ++i) {
    result[7 - i] = (src >> (8 * i)) & 0xFF;
  }
}


x86 assembly (clang, -O0):
<to_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x8,-0x18(%rbp)
jae    1154 <to_array+0x54>
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%ecx
sar    %cl,%edx
and    $0xff,%edx
mov    -0x8(%rbp),%rax
mov    $0x7,%ecx
sub    -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1113 <to_array+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_array>:
mov    %esi,%eax
movzbl %al,%ecx
mov    %ecx,0x1c(%rdi)
movzbl %ah,%ecx
mov    %ecx,0x18(%rdi)
mov    %esi,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
mov    %ecx,0x14(%rdi)
shr    $0x18,%eax
mov    %eax,0x10(%rdi)
ret

LLVM IR (-O0):
define void @to_array(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i64
store i32* %0, i32** %3
store i32 %1, i32* %4
store i64 0, i64* %5
br label %6
6: ; preds = %20, %2
%7 = load i64, i64* %5
%8 = icmp ult i64 %7, 8
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load i32, i32* %4
%11 = load i64, i64* %5
%12 = mul i64 8, %11
%13 = trunc i64 %12 to i32
%14 = ashr i32 %10, %13
%15 = and i32 %14, 255
%16 = load i32*, i32** %3
%17 = load i64, i64* %5
%18 = sub i64 7, %17
%19 = getelementptr inbounds i32, i32* %16, i64 %18
store i32 %15, i32* %19
br label %20
20: ; preds = %9
%21 = load i64, i64* %5
%22 = add i64 %21, 1
store i64 %22, i64* %5
br label %6
23: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @to_array(i32* nocapture writeonly %0, i32 %1) {
%3 = and i32 %1, 255
%4 = getelementptr inbounds i32, i32* %0, i64 7
store i32 %3, i32* %4
%5 = lshr i32 %1, 8
%6 = and i32 %5, 255
%7 = getelementptr inbounds i32, i32* %0, i64 6
store i32 %6, i32* %7
%8 = lshr i32 %1, 16
%9 = and i32 %8, 255
%10 = getelementptr inbounds i32, i32* %0, i64 5
store i32 %9, i32* %10
%11 = lshr i32 %1, 24
%12 = getelementptr inbounds i32, i32* %0, i64 4
store i32 %11, i32* %12
ret void
}
/* Variables and functions */
double M_LN2;
double log(double);
double Log2(double value) { return (log(value) / M_LN2); }


x86 assembly (clang, -O0):
<Log2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
mov    0x2eb2(%rip),%rax
divsd  (%rax),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Log2>:
push   %rax
call   1030 <log@plt>
mov    0x2ec3(%rip),%rax
divsd  (%rax),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@M_LN2 = global double 0.000000e+00
define double @Log2(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @log(double %3)
%5 = load double, double* @M_LN2
%6 = fdiv double %4, %5
ret double %6
}

LLVM IR (-O2):
@M_LN2 = global double 0.000000e+00
define double @Log2(double %0) {
%2 = tail call double @log(double %0)
%3 = load double, double* @M_LN2
%4 = fdiv double %2, %3
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ ol(char *);
asr() {
  ol("MOV  CL,AL");
  ol("MOV  AX,BX");
  ol("SAR  AX,CL");
}


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

x86 assembly (clang, -O2):
<asr>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <ol@plt>
lea    0xee7(%rip),%rdi
call   1030 <ol@plt>
lea    0xee6(%rip),%rdi
pop    %rax
jmp    1030 <ol@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"MOV CL,AL\00"
@.str.1 = [11 x i8] c"MOV AX,BX\00"
@.str.2 = [11 x i8] c"SAR AX,CL\00"
define i32 @asr() {
%1 = alloca i32
%2 = call i32 @ol(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @ol(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @ol(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%5 = load i32, i32* %1
ret i32 %5
}

LLVM IR (-O2):
@.str = [11 x i8] c"MOV CL,AL\00"
@.str.1 = [11 x i8] c"MOV AX,BX\00"
@.str.2 = [11 x i8] c"SAR AX,CL\00"
define i32 @asr() {
%1 = tail call i32 @ol(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @ol(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @ol(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ __NR_write;
int /*<<< orphan*/ access_ok(char const *, size_t);
int syscall(int /*<<< orphan*/, int, char const *, size_t);
int op_write(int fd, const char *p, size_t size) {
  if (!access_ok(p, size))
    return -1;
  return syscall(__NR_write, fd, p, size);
}


x86 assembly (clang, -O0):
<op_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <access_ok@plt>
cmp    $0x0,%eax
jne    1155 <op_write+0x35>
movl   $0xffffffff,-0x4(%rbp)
jmp    1171 <op_write+0x51>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1030 <syscall@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<op_write>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1040 <access_ok@plt>
test   %eax,%eax
je     1155 <op_write+0x35>
mov    0x2ea6(%rip),%rax
mov    (%rax),%edi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <syscall@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@__NR_write = global i32 0
define i32 @op_write(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 @access_ok(i8* %1, i64 %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = load i32, i32* @__NR_write
%8 = tail call i32 @syscall(i32 %7, i32 %0, i8* %1, i64 %2)
br label %9
9: ; preds = %3, %6
%10 = phi i32 [ %8, %6 ], [ -1, %3 ]
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ Disable_Scroll(int);
int /*<<< orphan*/ Enable_Scroll(int);
void CwLnx_autoscroll(int fd, int on) {
  if (on)
    Enable_Scroll(fd);
  else
    Disable_Scroll(fd);
}


x86 assembly (clang, -O0):
<CwLnx_autoscroll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1145 <CwLnx_autoscroll+0x25>
mov    -0x4(%rbp),%edi
call   1040 <Enable_Scroll@plt>
jmp    114d <CwLnx_autoscroll+0x2d>
mov    -0x4(%rbp),%edi
call   1030 <Disable_Scroll@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CwLnx_autoscroll>:
test   %esi,%esi
je     1129 <CwLnx_autoscroll+0x9>
jmp    1040 <Enable_Scroll@plt>
jmp    1030 <Disable_Scroll@plt>

LLVM IR (-O0):
define void @CwLnx_autoscroll(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %3
%9 = call i32 @Enable_Scroll(i32 %8)
br label %13
10: ; preds = %2
%11 = load i32, i32* %3
%12 = call i32 @Disable_Scroll(i32 %11)
br label %13
13: ; preds = %10, %7
ret void
}

LLVM IR (-O2):
define void @CwLnx_autoscroll(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @Enable_Scroll(i32 %0)
br label %8
6: ; preds = %2
%7 = tail call i32 @Disable_Scroll(i32 %0)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strerr_die(int, char *, char *, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/,
                              int /*<<< orphan*/, int /*<<< orphan*/);
void nomem(void) {
  strerr_die((111), ("tcpclient: fatal: "), ("out of memory"), 0, 0, 0, 0, 0);
}


x86 assembly (clang, -O0):
<nomem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x6f,%edi
lea    0xedc(%rip),%rsi
lea    0xee8(%rip),%rdx
xor    %r9d,%r9d
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
call   1030 <strerr_die@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nomem>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0xef4(%rip),%rdx
mov    $0x6f,%edi
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x0
push   $0x0
call   1030 <strerr_die@plt>
add    $0x10,%rsp
pop    %rax
ret

LLVM IR (-O0):
@.str = [19 x i8] c"tcpclient: fatal: \00"
@.str.1 = [14 x i8] c"out of memory\00"
define void @nomem() {
%1 = call i32 @strerr_die(i32 111, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0, i32 0, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"tcpclient: fatal: \00"
@.str.1 = [14 x i8] c"out of memory\00"
define void @nomem() {
%1 = tail call i32 @strerr_die(i32 111, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 0, i32 0, i32 0, i32 0, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() { printf("Hello make!\n"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
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 = [13 x i8] c"Hello make!\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"Hello make!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int solution() {
  int s, a, b, c;
  s = 0;
  a = 1;
  b = 1;
  c = a + b;
  while (c < 4000000L) {
    s += c;
    a = b + c;
    b = a + c;
    c = a + b;
  }
  return s;
}


x86 assembly (clang, -O0):
<solution>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movslq -0x10(%rbp),%rax
cmp    $0x3d0900,%rax
jge    115b <solution+0x5b>
mov    -0x10(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1122 <solution+0x22>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<solution>:
xor    %eax,%eax
mov    $0x1,%ecx
mov    $0x2,%edx
nopl   0x0(%rax)
add    %edx,%eax
add    %edx,%ecx
mov    %edx,%esi
add    %ecx,%esi
add    %esi,%ecx
mov    %ecx,%edx
cmp    $0x3d0900,%ecx
mov    %esi,%ecx
jl     1110 <solution+0x10>
ret

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

LLVM IR (-O2):
define i32 @solution() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 2, %0 ], [ %8, %1 ]
%3 = phi i32 [ 1, %0 ], [ %7, %1 ]
%4 = phi i32 [ 0, %0 ], [ %5, %1 ]
%5 = add nsw i32 %2, %4
%6 = add nsw i32 %2, %3
%7 = add nsw i32 %6, %2
%8 = add nsw i32 %7, %6
%9 = icmp slt i32 %8, 4000000
br i1 %9, label %1, label %10
10: ; preds = %1
ret i32 %5
}
/* Type definitions */
struct Cyc_List_List {
  int dummy;
};

/* Variables and functions */
void *Cyc_Tcutil_close_effect(void *, struct Cyc_List_List *);
void *Cyc_Tcutil_evaluate_effect(struct Cyc_List_List *ec, void *eff) {
  void *_T0;
  _T0 = Cyc_Tcutil_close_effect(eff, ec);
  return _T0;
}


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

x86 assembly (clang, -O2):
<Cyc_Tcutil_evaluate_effect>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <Cyc_Tcutil_close_effect@plt>

LLVM IR (-O0):
%struct.Cyc_List_List = type { i32 }
define i8* @Cyc_Tcutil_evaluate_effect(%struct.Cyc_List_List* %0, i8* %1) {
%3 = alloca %struct.Cyc_List_List*
%4 = alloca i8*
%5 = alloca i8*
store %struct.Cyc_List_List* %0, %struct.Cyc_List_List** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = load %struct.Cyc_List_List*, %struct.Cyc_List_List** %3
%8 = call i8* @Cyc_Tcutil_close_effect(i8* %6, %struct.Cyc_List_List* %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
ret i8* %9
}

LLVM IR (-O2):
%struct.Cyc_List_List = type { i32 }
define i8* @Cyc_Tcutil_evaluate_effect(%struct.Cyc_List_List* %0, i8* %1) {
%3 = tail call i8* @Cyc_Tcutil_close_effect(i8* %1, %struct.Cyc_List_List* %0)
ret i8* %3
}
void longnop() {
  asm volatile("nop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\n"
               "nop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\n"
               "nop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\n"
               "nop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\n"
               "nop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\n"
               "nop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\n"
               "nop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\n"
               "nop\nnop\nnop\nnop\nnop\nnop\nnop\nnop\n");
}


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

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

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

LLVM IR (-O2):
define void @longnop() {
tail call void asm sideeffect "nop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0Anop\0A", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Type definitions */
struct fh_program {
  int dummy;
};
struct fh_gc_state {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mark_container_children(struct fh_gc_state *);
int /*<<< orphan*/ mark_roots(struct fh_gc_state *, struct fh_program *);
void mark(struct fh_gc_state *gc, struct fh_program *prog) {
  mark_roots(gc, prog);
  ;
  mark_container_children(gc);
}


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

x86 assembly (clang, -O2):
<mark>:
push   %rbx
mov    %rdi,%rbx
call   1030 <mark_roots@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <mark_container_children@plt>

LLVM IR (-O0):
%struct.fh_gc_state = type { i32 }
%struct.fh_program = type { i32 }
define void @mark(%struct.fh_gc_state* %0, %struct.fh_program* %1) {
%3 = alloca %struct.fh_gc_state*
%4 = alloca %struct.fh_program*
store %struct.fh_gc_state* %0, %struct.fh_gc_state** %3
store %struct.fh_program* %1, %struct.fh_program** %4
%5 = load %struct.fh_gc_state*, %struct.fh_gc_state** %3
%6 = load %struct.fh_program*, %struct.fh_program** %4
%7 = call i32 @mark_roots(%struct.fh_gc_state* %5, %struct.fh_program* %6)
%8 = load %struct.fh_gc_state*, %struct.fh_gc_state** %3
%9 = call i32 @mark_container_children(%struct.fh_gc_state* %8)
ret void
}

LLVM IR (-O2):
%struct.fh_gc_state = type { i32 }
%struct.fh_program = type { i32 }
define void @mark(%struct.fh_gc_state* %0, %struct.fh_program* %1) {
%3 = tail call i32 @mark_roots(%struct.fh_gc_state* %0, %struct.fh_program* %1)
%4 = tail call i32 @mark_container_children(%struct.fh_gc_state* %0)
ret void
}