xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ foo();
int **foobar();
int __attribute__((no)) bar(int local_p) {
  int x = 0;
  int *j;
  int **p;
  if (local_p)
    p = &j;
  else
    p = foobar();
  *p = &x;
  foo();
  return x;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1149 <bar+0x29>
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1154 <bar+0x34>
mov    $0x0,%al
call   1030 <foobar@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
lea    -0x8(%rbp),%rcx
mov    %rcx,(%rax)
mov    $0x0,%al
call   1040 <foo@plt>
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
sub    $0x18,%rsp
movl   $0x0,0xc(%rsp)
test   %edi,%edi
je     1137 <bar+0x17>
lea    0x10(%rsp),%rax
jmp    113e <bar+0x1e>
xor    %eax,%eax
call   1030 <foobar@plt>
lea    0xc(%rsp),%rcx
mov    %rcx,(%rax)
xor    %eax,%eax
call   1040 <foo@plt>
mov    0xc(%rsp),%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i32 @bar(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = bitcast i32** %3 to i8*
%6 = icmp eq i32 %0, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32** (...) @foobar()
br label %9
9: ; preds = %1, %7
%10 = phi i32** [ %8, %7 ], [ %3, %1 ]
store i32* %2, i32** %10
%11 = call i32 (...) @foo()
%12 = load i32, i32* %2
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int slib_export(int);
int main() {
  printf("%d", slib_export(42));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2a,%edi
call   1030 <slib_export@plt>
mov    %eax,%esi
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2a,%edi
call   1030 <slib_export@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @slib_export(i32 42)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ hd44780_ll_register_read(int /*<<< orphan*/);
uint8_t hd44780_ll_instruction_read(void) {
  return (hd44780_ll_register_read(0));
}


x86 assembly (clang, -O0):
<hd44780_ll_instruction_read>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <hd44780_ll_register_read@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hd44780_ll_instruction_read>:
xor    %edi,%edi
jmp    1030 <hd44780_ll_register_read@plt>

LLVM IR (-O0):
define i32 @hd44780_ll_instruction_read() {
%1 = call i32 @hd44780_ll_register_read(i32 0)
ret i32 %1
}

LLVM IR (-O2):
define i32 @hd44780_ll_instruction_read() {
%1 = tail call i32 @hd44780_ll_register_read(i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void vector_die(int error) {
  switch (error) {
  case 0:
    printf("vector_die:\nOut of memory. Aborting.\n");
    break;
  case 1:
    printf("vector_die:\nIndexing error. Aborting.\n");
    break;
  }
  exit(1);
}


x86 assembly (clang, -O0):
<vector_die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
test   %eax,%eax
je     114f <vector_die+0x2f>
jmp    113e <vector_die+0x1e>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
je     1160 <vector_die+0x40>
jmp    116c <vector_die+0x4c>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
jmp    116c <vector_die+0x4c>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<vector_die>:
push   %rax
test   %edi,%edi
je     1133 <vector_die+0x13>
cmp    $0x1,%edi
jne    113f <vector_die+0x1f>
lea    0xecf(%rip),%rdi
jmp    113a <vector_die+0x1a>
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"vector_die:\0AOut of memory. Aborting.\0A\00"
@.str.1 = [39 x i8] c"vector_die:\0AIndexing error. Aborting.\0A\00"
define void @vector_die(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %8 [
i32 0, label %4
i32 1, label %6
]
4: ; preds = %1
%5 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %1, %6, %4
%9 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [38 x i8] c"vector_die:\0AIndexing error. Aborting.\00"
@str.2 = [37 x i8] c"vector_die:\0AOut of memory. Aborting.\00"
define void @vector_die(i32 %0) {
switch i32 %0, label %6 [
i32 0, label %3
i32 1, label %2
]
2: ; preds = %1
br label %3
3: ; preds = %1, %2
%4 = phi i8* [ getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([37 x i8], [37 x i8]* @str.2, i64 0, i64 0), %1 ]
%5 = tail call i32 @puts(i8* dereferenceable(1) %4)
br label %6
6: ; preds = %3, %1
%7 = tail call i32 @exit(i32 1)
unreachable
}
unsigned short SWAP16(unsigned short s) { return (s >> 8) | (s << 8); }


x86 assembly (clang, -O0):
<SWAP16>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
movzwl -0x2(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<SWAP16>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define zeroext i16 @SWAP16(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = ashr i32 %4, 8
%6 = load i16, i16* %2
%7 = zext i16 %6 to i32
%8 = shl i32 %7, 8
%9 = or i32 %5, %8
%10 = trunc i32 %9 to i16
ret i16 %10
}

LLVM IR (-O2):
define zeroext i16 @SWAP16(i16 zeroext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ create_page_table();
int /*<<< orphan*/ mmu_init();
int gboot_main() {
  create_page_table();
  mmu_init();
  *(volatile unsigned long *)0xA0000010 = 0x1540;
  *(volatile unsigned long *)0xA0000014 = 0x75f;
  return 0;
}


x86 assembly (clang, -O0):
<gboot_main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <create_page_table@plt>
mov    $0x0,%al
call   1040 <mmu_init@plt>
mov    $0xa0000010,%eax
movq   $0x1540,(%rax)
mov    $0xa0000014,%eax
movq   $0x75f,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gboot_main>:
push   %rax
xor    %eax,%eax
call   1030 <create_page_table@plt>
xor    %eax,%eax
call   1040 <mmu_init@plt>
mov    $0xa0000010,%eax
movq   $0x1540,(%rax)
movq   $0x75f,0x4(%rax)
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @gboot_main() {
%1 = call i32 (...) @create_page_table()
%2 = call i32 (...) @mmu_init()
store volatile i64 5440, i64* inttoptr (i64 2684354576 to i64*)
store volatile i64 1887, i64* inttoptr (i64 2684354580 to i64*)
ret i32 0
}

LLVM IR (-O2):
define i32 @gboot_main() {
%1 = tail call i32 (...) @create_page_table()
%2 = tail call i32 (...) @mmu_init()
store volatile i64 5440, i64* inttoptr (i64 2684354576 to i64*)
store volatile i64 1887, i64* inttoptr (i64 2684354580 to i64*)
ret i32 0
}
void RTSocketRead(void) {}


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

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

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

LLVM IR (-O2):
define void @RTSocketRead() {
ret void
}
/* Variables and functions */
char *message();
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char *argv[]) {
  printf("%s\n", message());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <message@plt>
mov    %rax,%rsi
lea    0xeb9(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* (...) @message()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void ft_strdel(char **as) {
  if (as)
    if (*as) {
      free(*as);
      *as = NULL;
    }
}


x86 assembly (clang, -O0):
<ft_strdel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1151 <ft_strdel+0x41>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     114c <ft_strdel+0x3c>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
jmp    1151 <ft_strdel+0x41>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strdel>:
push   %rbx
test   %rdi,%rdi
je     112d <ft_strdel+0x1d>
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     112d <ft_strdel+0x1d>
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ft_strdel(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @free(i8* %4)
store i8* null, i8** %0
br label %8
8: ; preds = %3, %6, %1
ret void
}
int count_scopemap(str)
char *str;
{
  char *ptr;
  int num = 0;
  for (ptr = str; *ptr; ptr++) {
    if (*ptr == ']') {
      num++;
    }
  }
  return (num);
}


x86 assembly (clang, -O0):
<count_scopemap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1153 <count_scopemap+0x53>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5d,%eax
jne    113d <count_scopemap+0x3d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1142 <count_scopemap+0x42>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1117 <count_scopemap+0x17>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_scopemap>:
xor    %eax,%eax
jmp    1117 <count_scopemap+0x17>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%eax
add    $0x1,%rdi
movzbl (%rdi),%ecx
cmp    $0x5d,%cl
je     1110 <count_scopemap+0x10>
test   %cl,%cl
jne    1113 <count_scopemap+0x13>
ret

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

LLVM IR (-O2):
define i32 @count_scopemap(i8* nocapture %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %10, %8 ]
%4 = phi i32 [ 0, %1 ], [ %9, %8 ]
%5 = load i8, i8* %3
switch i8 %5, label %8 [
i8 0, label %11
i8 93, label %6
]
6: ; preds = %2
%7 = add nsw i32 %4, 1
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ %7, %6 ], [ %4, %2 ]
%10 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
11: ; preds = %2
ret i32 %4
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
void fprint_orl_direct(FILE *stream, uint8_t direct) {
  fprintf(stream,
          "ORL   A, "
          "0x%02X"
          "                   ",
          direct);
}


x86 assembly (clang, -O0):
<fprint_orl_direct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fprint_orl_direct>:
mov    %esi,%edx
lea    0xee7(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"ORL A, 0x%02X \00"
define void @fprint_orl_direct(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"ORL A, 0x%02X \00"
define void @fprint_orl_direct(i32* nocapture %0, i32 %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
char *ultoa(long);
char *ltoa(long val) {
  char *p;
  int flg = 0;
  if (val < 0) {
    flg++;
    val = -val;
  }
  p = ultoa(val);
  if (flg)
    *--p = '-';
  return p;
}


x86 assembly (clang, -O0):
<ltoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1141 <ltoa+0x31>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ultoa@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     116b <ltoa+0x5b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x2d,-0x1(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltoa>:
push   %rbx
mov    %rdi,%rbx
neg    %rdi
cmovs  %rbx,%rdi
call   1030 <ultoa@plt>
test   %rbx,%rbx
js     1127 <ltoa+0x17>
pop    %rbx
ret
movb   $0x2d,-0x1(%rax)
add    $0xffffffffffffffff,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @ltoa(i64 %0) {
%2 = icmp slt i64 %0, 0
%3 = sub nsw i64 0, %0
%4 = select i1 %2, i64 %3, i64 %0
%5 = tail call i8* @ultoa(i64 %4)
br i1 %2, label %6, label %8
6: ; preds = %1
%7 = getelementptr inbounds i8, i8* %5, i64 -1
store i8 45, i8* %7
br label %8
8: ; preds = %6, %1
%9 = phi i8* [ %7, %6 ], [ %5, %1 ]
ret i8* %9
}
/* Variables and functions */
char *alloc(scalar_t__);
int /*<<< orphan*/ env_add(char *);
int /*<<< orphan*/ env_init();
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
void env_put(char *s) {
  char *u;
  env_init();
  u = alloc(strlen(s) + 1);
  strcpy((u), (s));
  env_add(u);
}


x86 assembly (clang, -O0):
<env_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1070 <env_init@plt>
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1060 <alloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
call   1040 <env_add@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<env_put>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %eax,%eax
call   1070 <env_init@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
lea    0x1(%rax),%rdi
call   1060 <alloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <env_add@plt>

LLVM IR (-O0):
define void @env_put(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i32 (...) @env_init()
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
%7 = add nsw i64 %6, 1
%8 = call i8* @alloc(i64 %7)
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = load i8*, i8** %2
%11 = call i32 @strcpy(i8* %9, i8* %10)
%12 = load i8*, i8** %3
%13 = call i32 @env_add(i8* %12)
ret void
}

LLVM IR (-O2):
define void @env_put(i8* %0) {
%2 = tail call i32 (...) @env_init()
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = add nsw i64 %3, 1
%5 = tail call i8* @alloc(i64 %4)
%6 = tail call i32 @strcpy(i8* %5, i8* %0)
%7 = tail call i32 @env_add(i8* %5)
ret void
}
long a_swap_l(volatile void *x, long v) {
  __asm__("xchg %0, %1" : "=r"(v), "=m"(*(long *)x) : "0"(v) : "memory");
  return v;
}


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

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

LLVM IR (-O0):
define i64 @a_swap_l(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i64*
%7 = load i64, i64* %4
%8 = call i64 asm "xchg $0, $1", "=r,=*m,0,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %6, i64 %7)
store i64 %8, i64* %4
%9 = load i64, i64* %4
ret i64 %9
}

LLVM IR (-O2):
define i64 @a_swap_l(i8* %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
%4 = tail call i64 asm "xchg $0, $1", "=r,=*m,0,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %3, i64 %1)
ret i64 %4
}
/* Type definitions */
struct rlimit {
  int dummy;
};

/* Variables and functions */
scalar_t__ setrlimit(int, struct rlimit *);
int /*<<< orphan*/ shutdown(int, char *, int);
void setr(int type, struct rlimit *rlim) {
  if (setrlimit(type, rlim)) {
    shutdown(7, "setrlimit()", 178 - 1);
  }
}


x86 assembly (clang, -O0):
<setr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <setrlimit@plt>
cmp    $0x0,%rax
je     115b <setr+0x3b>
mov    $0x7,%edi
lea    0xeaf(%rip),%rsi
mov    $0xb1,%edx
call   1030 <shutdown@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setr>:
push   %rax
call   1040 <setrlimit@plt>
test   %rax,%rax
je     1142 <setr+0x22>
lea    0xece(%rip),%rsi
mov    $0x7,%edi
mov    $0xb1,%edx
pop    %rax
jmp    1030 <shutdown@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.rlimit = type { i32 }
@.str = [12 x i8] c"setrlimit()\00"
define void @setr(i32 %0, %struct.rlimit* %1) {
%3 = alloca i32
%4 = alloca %struct.rlimit*
store i32 %0, i32* %3
store %struct.rlimit* %1, %struct.rlimit** %4
%5 = load i32, i32* %3
%6 = load %struct.rlimit*, %struct.rlimit** %4
%7 = call i64 @setrlimit(i32 %5, %struct.rlimit* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @shutdown(i32 7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 177)
br label %11
11: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
%struct.rlimit = type { i32 }
@.str = [12 x i8] c"setrlimit()\00"
define void @setr(i32 %0, %struct.rlimit* %1) {
%3 = tail call i64 @setrlimit(i32 %0, %struct.rlimit* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @shutdown(i32 7, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 177)
br label %7
7: ; preds = %5, %2
ret void
}
signed int _qmix_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @_qmix_init() {
ret i32 0
}
void os_set_thread_name(const char *name) {}


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

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

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

LLVM IR (-O2):
define void @os_set_thread_name(i8* nocapture %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIG_SETMASK;
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *);
int benchmark_initrun() {
  sigset_t iset;
  (void)sigemptyset(&iset);
  (void)sigprocmask(SIG_SETMASK, &iset, NULL);
  return (0);
}


x86 assembly (clang, -O0):
<benchmark_initrun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1040 <sigemptyset@plt>
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    -0x4(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigprocmask@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<benchmark_initrun>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <sigemptyset@plt>
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SIG_SETMASK = global i32 0
define i32 @benchmark_initrun() {
%1 = alloca i32
%2 = call i32 @sigemptyset(i32* %1)
%3 = load i32, i32* @SIG_SETMASK
%4 = call i32 @sigprocmask(i32 %3, i32* %1, i32* null)
ret i32 0
}

LLVM IR (-O2):
@SIG_SETMASK = global i32 0
define i32 @benchmark_initrun() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @sigemptyset(i32* %1)
%4 = load i32, i32* @SIG_SETMASK
%5 = call i32 @sigprocmask(i32 %4, i32* %1, i32* null)
ret i32 0
}
void XmbTextPropertyToTextList() {}


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

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

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

LLVM IR (-O2):
define void @XmbTextPropertyToTextList() {
ret void
}
/* Variables and functions */
int floor(double);
double onluk_tam_sayiya_yuvarla(double girilen_sayi) {
  double onluk_yuvarlanan_sayi;
  onluk_yuvarlanan_sayi = floor((girilen_sayi * 10) + .5) / 10;
  return onluk_yuvarlanan_sayi;
}


x86 assembly (clang, -O0):
<onluk_tam_sayiya_yuvarla>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xed2(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <floor@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<onluk_tam_sayiya_yuvarla>:
push   %rax
mulsd  0xee7(%rip),%xmm0
addsd  0xee7(%rip),%xmm0
call   1030 <floor@plt>
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @onluk_tam_sayiya_yuvarla(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call double @llvm.fmuladd.f64(double %4, double 1.000000e+01, double 5.000000e-01)
%6 = call i32 @floor(double %5)
%7 = sdiv i32 %6, 10
%8 = sitofp i32 %7 to double
store double %8, double* %3
%9 = load double, double* %3
ret double %9
}

LLVM IR (-O2):
define double @onluk_tam_sayiya_yuvarla(double %0) {
%2 = tail call double @llvm.fmuladd.f64(double %0, double 1.000000e+01, double 5.000000e-01)
%3 = tail call i32 @floor(double %2)
%4 = sdiv i32 %3, 10
%5 = sitofp i32 %4 to double
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ create_a_tag(int, int);
void initialize_collection_box() {
  int i, j;
  for (i = 0; i <= 9; i++) {
    for (j = 0; j <= 4; j++)
      create_a_tag(i + 1, j + 1);
  }
}


x86 assembly (clang, -O0):
<initialize_collection_box>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x9,-0x4(%rbp)
jg     116c <initialize_collection_box+0x5c>
movl   $0x0,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jg     1159 <initialize_collection_box+0x49>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x8(%rbp),%esi
add    $0x1,%esi
call   1030 <create_a_tag@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <initialize_collection_box+0x20>
jmp    115e <initialize_collection_box+0x4e>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <initialize_collection_box+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialize_collection_box>:
push   %rbx
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <create_a_tag@plt>
mov    %ebx,%edi
mov    $0x2,%esi
call   1030 <create_a_tag@plt>
mov    %ebx,%edi
mov    $0x3,%esi
call   1030 <create_a_tag@plt>
mov    %ebx,%edi
mov    $0x4,%esi
call   1030 <create_a_tag@plt>
mov    %ebx,%edi
mov    $0x5,%esi
call   1030 <create_a_tag@plt>
add    $0x1,%ebx
cmp    $0xb,%ebx
jne    1120 <initialize_collection_box+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @initialize_collection_box() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %3, %1 ]
%3 = add nuw nsw i32 %2, 1
%4 = tail call i32 @create_a_tag(i32 %3, i32 1)
%5 = tail call i32 @create_a_tag(i32 %3, i32 2)
%6 = tail call i32 @create_a_tag(i32 %3, i32 3)
%7 = tail call i32 @create_a_tag(i32 %3, i32 4)
%8 = tail call i32 @create_a_tag(i32 %3, i32 5)
%9 = icmp eq i32 %3, 10
br i1 %9, label %10, label %1
10: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ binaryIm(int);
int medianIm();
int /*<<< orphan*/ printf(char *, ...);
bin() {
  int med;
  printf("-\n");
  med = medianIm();
  printf("=\n");
  if (med > 0)
    binaryIm(med);
  else {
    printf("med = %d\n", med);
  }
}


x86 assembly (clang, -O0):
<bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <medianIm@plt>
mov    %eax,-0x8(%rbp)
lea    0xeac(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    1175 <bin+0x45>
mov    -0x8(%rbp),%edi
call   1050 <binaryIm@plt>
jmp    1186 <bin+0x56>
mov    -0x8(%rbp),%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin>:
push   %rbx
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <medianIm@plt>
mov    %eax,%ebx
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
test   %ebx,%ebx
jle    116f <bin+0x2f>
mov    %ebx,%edi
call   1060 <binaryIm@plt>
pop    %rbx
ret
lea    0xe8a(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-\0A\00"
@.str.1 = [3 x i8] c"=\0A\00"
@.str.2 = [10 x i8] c"med = %d\0A\00"
define i32 @bin() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @medianIm()
store i32 %4, i32* %2
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load i32, i32* %2
%10 = call i32 @binaryIm(i32 %9)
br label %14
11: ; preds = %0
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %12)
br label %14
14: ; preds = %11, %8
%15 = load i32, i32* %1
ret i32 %15
}

LLVM IR (-O2):
@.str.2 = [10 x i8] c"med = %d\0A\00"
@str = [2 x i8] c"-\00"
@str.3 = [2 x i8] c"=\00"
define i32 @bin() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @medianIm()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0))
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @binaryIm(i32 %2)
br label %9
7: ; preds = %0
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %2)
br label %9
9: ; preds = %7, %5
ret i32 undef
}
/* Variables and functions */
char EOF;
char getchar();
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ putchar(char);
void simpleIO(void) {
  printf("%s\n", "simple io");
  char ch;
  while ((ch = getchar()) != EOF) {
    putchar(ch);
  }
}


x86 assembly (clang, -O0):
<simpleIO>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
lea    0xebe(%rip),%rsi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl %al,%eax
mov    0x2e89(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1178 <simpleIO+0x48>
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
jmp    114b <simpleIO+0x1b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simpleIO>:
push   %rbx
lea    0xec8(%rip),%rdi
lea    0xec5(%rip),%rsi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e96(%rip),%rbx
cmp    (%rbx),%al
je     1173 <simpleIO+0x43>
cs nopw 0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    (%rbx),%al
jne    1160 <simpleIO+0x30>
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [10 x i8] c"simple io\00"
@EOF = global i8 0
define void @simpleIO() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call signext i8 (...) @getchar()
%3 = load i8, i8* @EOF
%4 = icmp eq i8 %2, %3
br i1 %4, label %11, label %5
5: ; preds = %0, %5
%6 = phi i8 [ %8, %5 ], [ %2, %0 ]
%7 = tail call i32 @putchar(i8 signext %6)
%8 = tail call signext i8 (...) @getchar()
%9 = load i8, i8* @EOF
%10 = icmp eq i8 %8, %9
br i1 %10, label %11, label %5
11: ; preds = %5, %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ __put_unaligned_be64(int /*<<< orphan*/,
                                        int /*<<< orphan*/ *);
void put_unaligned_be64(uint64_t val, void *p) {
  __put_unaligned_be64(val, (uint8_t *)p);
}


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

x86 assembly (clang, -O2):
<put_unaligned_be64>:
jmp    1030 <__put_unaligned_be64@plt>

LLVM IR (-O0):
define void @put_unaligned_be64(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to i32*
%8 = call i32 @__put_unaligned_be64(i32 %5, i32* %7)
ret void
}

LLVM IR (-O2):
define void @put_unaligned_be64(i32 %0, i8* %1) {
%3 = bitcast i8* %1 to i32*
%4 = tail call i32 @__put_unaligned_be64(i32 %0, i32* %3)
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int check_str(char *val1, char *val2) { return strcmp(val1, val2); }


x86 assembly (clang, -O0):
<check_str>:
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 <strcmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_str>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @check_str(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
/* Variables and functions */
unsigned int sm_get_current_micros();
unsigned int sm_get_current_seconds();
void sm_get_current_time(unsigned int *seconds, unsigned int *mics) {
  do {
    *seconds = sm_get_current_seconds();
    *mics = sm_get_current_micros();
  } while (sm_get_current_seconds() != *seconds);
}


x86 assembly (clang, -O0):
<sm_get_current_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <sm_get_current_seconds@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <sm_get_current_micros@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1040 <sm_get_current_seconds@plt>
mov    -0x8(%rbp),%rcx
cmp    (%rcx),%eax
jne    1130 <sm_get_current_time+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sm_get_current_time>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <sm_get_current_seconds@plt>
mov    %eax,(%rbx)
xor    %eax,%eax
call   1030 <sm_get_current_micros@plt>
mov    %eax,(%r14)
xor    %eax,%eax
call   1040 <sm_get_current_seconds@plt>
cmp    (%rbx),%eax
jne    1130 <sm_get_current_time+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @sm_get_current_time(i32* nocapture %0, i32* nocapture writeonly %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 (...) @sm_get_current_seconds()
store i32 %4, i32* %0
%5 = tail call i32 (...) @sm_get_current_micros()
store i32 %5, i32* %1
%6 = tail call i32 (...) @sm_get_current_seconds()
%7 = load i32, i32* %0
%8 = icmp eq i32 %6, %7
br i1 %8, label %9, label %3
9: ; preds = %3
ret void
}
int chirp_fs_hdfs_do_acl_check() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @chirp_fs_hdfs_do_acl_check() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main() {
  printf("\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @putchar(i32 10)
%2 = tail call i32 @exit(i32 0)
unreachable
}
long kbd_bit_out(long bitval) {
  volatile unsigned long *kbdgpio = (unsigned long *)0xd4019008;
  unsigned long regval;
  do {
    regval = *kbdgpio;
  } while ((regval & 0x80) != 0);
  kbdgpio[bitval ? 0x18 : 0x15] = 0x100;
  do {
    regval = *kbdgpio;
  } while ((regval & 0x80) == 0);
  return bitval;
}


x86 assembly (clang, -O0):
<kbd_bit_out>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0xd4019008,%eax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
and    $0x80,%rax
cmp    $0x0,%rax
jne    1111 <kbd_bit_out+0x11>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rsi
mov    $0x15,%ecx
mov    $0x18,%edx
cmp    $0x0,%rsi
cmovne %edx,%ecx
movslq %ecx,%rcx
movq   $0x100,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
and    $0x80,%rax
cmp    $0x0,%rax
je     1154 <kbd_bit_out+0x54>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<kbd_bit_out>:
mov    %rdi,%rax
mov    $0xd4019008,%ecx
nopl   0x0(%rax,%rax,1)
testq  $0x80,(%rcx)
jne    1110 <kbd_bit_out+0x10>
lea    0xc0(%rcx),%rdx
lea    0xa8(%rcx),%rsi
test   %rax,%rax
cmove  %rsi,%rdx
movq   $0x100,(%rdx)
cs nopw 0x0(%rax,%rax,1)
nop
testq  $0x80,(%rcx)
je     1140 <kbd_bit_out+0x40>
ret

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

LLVM IR (-O2):
define i64 @kbd_bit_out(i64 returned %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i64, i64* inttoptr (i64 3556872200 to i64*)
%4 = and i64 %3, 128
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %2
6: ; preds = %2
%7 = icmp eq i64 %0, 0
%8 = select i1 %7, i64 21, i64 24
%9 = getelementptr inbounds i64, i64* inttoptr (i64 3556872200 to i64*), i64 %8
store volatile i64 256, i64* %9
br label %10
10: ; preds = %10, %6
%11 = load volatile i64, i64* inttoptr (i64 3556872200 to i64*)
%12 = and i64 %11, 128
%13 = icmp eq i64 %12, 0
br i1 %13, label %10, label %14
14: ; preds = %10
ret i64 %0
}
long oldfunctiondef2(a, b, c, d, e, f, g, h)
long a;
int b, g, h;
float c, f;
char d, e;
{ return a + b - c; }


x86 assembly (clang, -O0):
<oldfunctiondef2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x28(%rbp)
mov    %ecx,%eax
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
mov    %dl,%cl
cvtsd2ss %xmm0,%xmm0
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
mov    %cl,-0x11(%rbp)
mov    %al,-0x12(%rbp)
movss  %xmm0,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
add    %rcx,%rax
cvtsi2ss %rax,%xmm0
subss  -0x10(%rbp),%xmm0
cvttss2si %xmm0,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<oldfunctiondef2>:
cvtsd2ss %xmm0,%xmm0
movslq %esi,%rax
add    %rdi,%rax
cvtsi2ss %rax,%xmm1
subss  %xmm0,%xmm1
cvttss2si %xmm1,%rax
ret

LLVM IR (-O0):
define i64 @oldfunctiondef2(i64 %0, i32 %1, double %2, i32 %3, i32 %4, double %5, i32 %6, i32 %7) {
%9 = alloca i64
%10 = alloca i32
%11 = alloca float
%12 = alloca i8
%13 = alloca i8
%14 = alloca float
%15 = alloca i32
%16 = alloca i32
%17 = fptrunc double %2 to float
%18 = trunc i32 %3 to i8
%19 = trunc i32 %4 to i8
%20 = fptrunc double %5 to float
store i64 %0, i64* %9
store i32 %1, i32* %10
store float %17, float* %11
store i8 %18, i8* %12
store i8 %19, i8* %13
store float %20, float* %14
store i32 %6, i32* %15
store i32 %7, i32* %16
%21 = load i64, i64* %9
%22 = load i32, i32* %10
%23 = sext i32 %22 to i64
%24 = add nsw i64 %21, %23
%25 = sitofp i64 %24 to float
%26 = load float, float* %11
%27 = fsub float %25, %26
%28 = fptosi float %27 to i64
ret i64 %28
}

LLVM IR (-O2):
define i64 @oldfunctiondef2(i64 %0, i32 %1, double %2, i32 %3, i32 %4, double %5, i32 %6, i32 %7) {
%9 = fptrunc double %2 to float
%10 = sext i32 %1 to i64
%11 = add nsw i64 %10, %0
%12 = sitofp i64 %11 to float
%13 = fsub float %12, %9
%14 = fptosi float %13 to i64
ret i64 %14
}
void i(void) {}


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

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

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

LLVM IR (-O2):
define void @i() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int posix_memalign(void **, int, size_t);
int /*<<< orphan*/ stderr;
void *xmalloc(size_t num) {
  void *new = NULL;
  int ret = posix_memalign(&new, 32, num);
  if (!new || ret) {
    fprintf(stderr, "[PolyBench] posix_memalign: cannot allocate memory");
    exit(1);
  }
  return new;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
lea    -0x10(%rbp),%rdi
mov    $0x20,%esi
call   1050 <posix_memalign@plt>
mov    %eax,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116e <xmalloc+0x3e>
cmpl   $0x0,-0x14(%rbp)
je     118d <xmalloc+0x5d>
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
lea    0xe82(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rax
mov    %rdi,%rdx
movq   $0x0,(%rsp)
mov    %rsp,%rdi
mov    $0x20,%esi
call   1050 <posix_memalign@plt>
mov    %eax,%ecx
mov    (%rsp),%rax
test   %rax,%rax
je     115a <xmalloc+0x2a>
test   %ecx,%ecx
jne    115a <xmalloc+0x2a>
pop    %rcx
ret
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
lea    0xe96(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [51 x i8] c"[PolyBench] posix_memalign: cannot allocate memory\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i32
store i64 %0, i64* %2
store i8* null, i8** %3
%5 = load i64, i64* %2
%6 = call i32 @posix_memalign(i8** %3, i32 32, i64 %5)
store i32 %6, i32* %4
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9, %1
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %9
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [51 x i8] c"[PolyBench] posix_memalign: cannot allocate memory\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%4 = call i32 @posix_memalign(i8** %2, i32 32, i64 %0)
%5 = load i8*, i8** %2
%6 = icmp eq i8* %5, null
%7 = icmp ne i32 %4, 0
%8 = select i1 %6, i1 true, i1 %7
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %1
ret i8* %5
}