xunge/DecIR huggingface dataset:
long _hash(const char *key) {
  if (4 == sizeof(long)) {
    const unsigned int seed = 131;
    unsigned int hash = 0;
    while (*key) {
      hash = hash * seed + (*key++);
    }
    return (hash & 0x7FFFFFFF);
  } else {
    const unsigned int seed = 131313;
    unsigned int hash = 0;
    while (*key) {
      hash = hash * seed + (*key++);
    }
    return (hash & 0x7FFFFFFFFFFFFFFF);
  }
}


x86 assembly (clang, -O0):
<_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x200f1,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1146 <_hash+0x46>
imul   $0x200f1,-0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <_hash+0x16>
mov    -0x10(%rbp),%eax
movabs $0x7fffffffffffffff,%rcx
ff ff 7f
and    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_hash>:
mov    (%rdi),%cl
xor    %eax,%eax
test   %cl,%cl
je     1128 <_hash+0x28>
add    $0x1,%rdi
nopl   0x0(%rax)
imul   $0x200f1,%eax,%edx
movsbl %cl,%eax
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <_hash+0x10>
mov    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @_hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = mul i32 %6, 131313
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i32
%11 = add i32 %8, %10
%12 = load i8, i8* %9
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = zext i32 %11 to i64
br label %16
16: ; preds = %14, %1
%17 = phi i64 [ 0, %1 ], [ %15, %14 ]
ret i64 %17
}
int config_READER_CONAX(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @config_READER_CONAX() {
ret i32 0
}
int size_in_blocks(int string_len, int blk_size) {
  return (string_len + blk_size - 1) / blk_size;
}


x86 assembly (clang, -O0):
<size_in_blocks>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x1,%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<size_in_blocks>:
lea    (%rdi,%rsi,1),%eax
add    $0xffffffff,%eax
cltd
idiv   %esi
ret

LLVM IR (-O0):
define i32 @size_in_blocks(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 = add nsw i32 %5, %6
%8 = sub nsw i32 %7, 1
%9 = load i32, i32* %4
%10 = sdiv i32 %8, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @size_in_blocks(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = add i32 %3, %1
%5 = sdiv i32 %4, %1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char *, int, int);
main() {
  char *p = "main(){char*p=%c%s%c;(void)printf(p,34,p,34,10);}%c";
  (void)printf(p, 34, p, 34, 10);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x22,%esi
mov    %rdi,%rdx
mov    $0x22,%ecx
mov    $0xa,%r8d
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [52 x i8] c"main(){char*p=%c%s%c;(void)printf(p,34,p,34,10);}%c\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 34, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 34, i32 10)
ret i32 0
}
/* Variables and functions */
int isnull(unsigned char *s, size_t n) {
  unsigned int i, j = 0;
  for (i = 0; i < n; ++i)
    if (!s[i])
      j++;
  return (j == n) ? 1 : 0;
}


x86 assembly (clang, -O0):
<isnull>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%rax
jae    1154 <isnull+0x54>
mov    -0x8(%rbp),%rax
mov    -0x14(%rbp),%ecx
cmpb   $0x0,(%rax,%rcx,1)
jne    1141 <isnull+0x41>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1146 <isnull+0x46>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111a <isnull+0x1a>
mov    -0x18(%rbp),%eax
mov    %eax,%edx
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %rsi,%rdx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnull>:
xor    %ecx,%ecx
test   %rsi,%rsi
je     1121 <isnull+0x21>
xor    %eax,%eax
nopl   0x0(%rax)
cmpb   $0x1,(%rdi,%rax,1)
adc    $0x0,%ecx
add    $0x1,%eax
cmp    %rsi,%rax
jb     1110 <isnull+0x10>
mov    %ecx,%ecx
xor    %eax,%eax
cmp    %rsi,%rcx
sete   %al
ret

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

LLVM IR (-O2):
define i32 @isnull(i8* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %17, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %13, %4 ], [ 0, %2 ]
%6 = phi i32 [ %11, %4 ], [ 0, %2 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %5
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
%10 = zext i1 %9 to i32
%11 = add i32 %6, %10
%12 = add nuw nsw i64 %5, 1
%13 = and i64 %12, 4294967295
%14 = icmp ult i64 %13, %1
br i1 %14, label %4, label %15
15: ; preds = %4
%16 = zext i32 %11 to i64
br label %17
17: ; preds = %15, %2
%18 = phi i64 [ 0, %2 ], [ %16, %15 ]
%19 = icmp eq i64 %18, %1
%20 = zext i1 %19 to i32
ret i32 %20
}
/* Variables and functions */
int inp_emulate(int);
char TOSH_READ_CC_VREN_PIN() { return 0x01 & (inp_emulate(-5) >> 4); }


x86 assembly (clang, -O0):
<TOSH_READ_CC_VREN_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfffffffb,%edi
call   1030 <inp_emulate@plt>
sar    $0x4,%eax
and    $0x1,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_READ_CC_VREN_PIN>:
push   %rax
mov    $0xfffffffb,%edi
call   1030 <inp_emulate@plt>
shr    $0x4,%al
and    $0x1,%al
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @TOSH_READ_CC_VREN_PIN() {
%1 = call i32 @inp_emulate(i32 -5)
%2 = ashr i32 %1, 4
%3 = and i32 1, %2
%4 = trunc i32 %3 to i8
ret i8 %4
}

LLVM IR (-O2):
define signext i8 @TOSH_READ_CC_VREN_PIN() {
%1 = tail call i32 @inp_emulate(i32 -5)
%2 = trunc i32 %1 to i8
%3 = lshr i8 %2, 4
%4 = and i8 %3, 1
ret i8 %4
}
/* Variables and functions */
int execve(char *, char **, int /*<<< orphan*/ *);
int main() {
  char *target = "//bin/sh";
  char *para_list[2] = {target, NULL};
  int ret = execve(target, para_list, NULL);
  return ret;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <execve@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xee5(%rip),%rdi
mov    %rdi,(%rsp)
movq   $0x0,0x8(%rsp)
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <execve@plt>
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"//bin/sh\00"
define i32 @main() {
%1 = alloca [2 x i8*]
%2 = bitcast [2 x i8*]* %1 to i8*
%3 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = getelementptr inbounds [2 x i8*], [2 x i8*]* %1, i64 0, i64 1
store i8* null, i8** %4
%5 = call i32 @execve(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %3, i32* null)
ret i32 %5
}
void *thread_function(void *thread_arg) {}


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

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

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

LLVM IR (-O2):
define noalias i8* @thread_function(i8* nocapture readnone %0) {
ret i8* undef
}
/* Variables and functions */
int rand();
int main(int argc, char **argv) {
  int x, y;
  x = rand();
  x *= -5;
  y = rand();
  y *= -3;
  return x * y - 204;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x14(%rbp)
imul   $0xfffffffb,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0x18(%rbp)
imul   $0xfffffffd,-0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
sub    $0xcc,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <rand@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <rand@plt>
imul   %ebx,%eax
lea    (%rax,%rax,4),%eax
lea    (%rax,%rax,2),%eax
add    $0xffffff34,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @rand()
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = mul nsw i32 %9, -5
store i32 %10, i32* %6
%11 = call i32 (...) @rand()
store i32 %11, i32* %7
%12 = load i32, i32* %7
%13 = mul nsw i32 %12, -3
store i32 %13, i32* %7
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = mul nsw i32 %14, %15
%17 = sub nsw i32 %16, 204
ret i32 %17
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @rand()
%4 = tail call i32 (...) @rand()
%5 = mul i32 %3, 15
%6 = mul i32 %5, %4
%7 = add nsw i32 %6, -204
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isgraph(int);
void t_isgraph_0xe7() {
  Assert_real((isgraph(231) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isgraph.c",
              1160, ("isgraph should be 0 for 0xe7"));
}


x86 assembly (clang, -O0):
<t_isgraph_0xe7>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe7,%edi
call   1040 <isgraph@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x488,%edx
lea    0xf5b(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isgraph_0xe7>:
push   %rax
mov    $0xe7,%edi
call   1040 <isgraph@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x488,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0xe7\00"
define void @t_isgraph_0xe7() {
%1 = call i64 @isgraph(i32 231)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1160, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0xe7\00"
define void @t_isgraph_0xe7() {
%1 = tail call i64 @isgraph(i32 231)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1160, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint32_t;

/* Variables and functions */
uint32_t w4nat(uint32_t const x) { return x; }


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

x86 assembly (clang, -O2):
<w4nat>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @w4nat(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
struct rlimit {
  int rlim_cur;
  int rlim_max;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ RLIMIT_NOFILE;
int /*<<< orphan*/ err(int /*<<< orphan*/, char *);
scalar_t__ setrlimit(int /*<<< orphan*/, struct rlimit *);
void set_resource_limits(void) {
  struct rlimit lim;
  lim.rlim_cur = 70000;
  lim.rlim_max = 70000;
  if (setrlimit(RLIMIT_NOFILE, &lim) < 0)
    err(EXIT_FAILURE, "Cannot set file handle limit");
}


x86 assembly (clang, -O0):
<set_resource_limits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x11170,-0x8(%rbp)
movl   $0x11170,-0x4(%rbp)
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1040 <setrlimit@plt>
cmp    $0x0,%rax
jge    1167 <set_resource_limits+0x47>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
lea    0xe9e(%rip),%rsi
call   1030 <err@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_resource_limits>:
push   %rax
movabs $0x1117000011170,%rax
mov    %rax,(%rsp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1040 <setrlimit@plt>
test   %rax,%rax
js     1147 <set_resource_limits+0x27>
pop    %rax
ret
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
lea    0xea9(%rip),%rsi
call   1030 <err@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.rlimit = type { i32, i32 }
@RLIMIT_NOFILE = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [29 x i8] c"Cannot set file handle limit\00"
define void @set_resource_limits() {
%1 = alloca %struct.rlimit
%2 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i32 0, i32 0
store i32 70000, i32* %2
%3 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i32 0, i32 1
store i32 70000, i32* %3
%4 = load i32, i32* @RLIMIT_NOFILE
%5 = call i64 @setrlimit(i32 %4, %struct.rlimit* %1)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @err(i32 %8, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %7, %0
ret void
}

LLVM IR (-O2):
%struct.rlimit = type { i32, i32 }
@RLIMIT_NOFILE = global i32 0
@EXIT_FAILURE = global i32 0
@.str = [29 x i8] c"Cannot set file handle limit\00"
define void @set_resource_limits() {
%1 = alloca %struct.rlimit
%2 = bitcast %struct.rlimit* %1 to i8*
%3 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 0
store i32 70000, i32* %3
%4 = getelementptr inbounds %struct.rlimit, %struct.rlimit* %1, i64 0, i32 1
store i32 70000, i32* %4
%5 = load i32, i32* @RLIMIT_NOFILE
%6 = call i64 @setrlimit(i32 %5, %struct.rlimit* %1)
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %0
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @err(i32 %9, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %8, %0
ret void
}
int fb_ConsoleColor(int fc, int bc, int flags) { return 0; }


x86 assembly (clang, -O0):
<fb_ConsoleColor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @fb_ConsoleColor(i32 %0, i32 %1, i32 %2) {
ret i32 0
}
void gdk_display_open() {}


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

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

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

LLVM IR (-O2):
define void @gdk_display_open() {
ret void
}
int clip(int v, int minv, int maxv) {
  v = (v < minv) ? minv : v;
  v = (v > maxv) ? maxv : v;
  return v;
}


x86 assembly (clang, -O0):
<clip>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1124 <clip+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    112a <clip+0x2a>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1147 <clip+0x47>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    114d <clip+0x4d>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clip>:
mov    %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
cmp    %edx,%eax
cmovg  %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @clip(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = select i1 %4, i32 %1, i32 %0
%6 = icmp sgt i32 %5, %2
%7 = select i1 %6, i32 %2, i32 %5
ret i32 %7
}
int fib(int n) {
  if (n == 1) {
    return 0;
  } else if (n == 2) {
    return 1;
  } else {
    return fib(n - 1) + fib(n - 2);
  }
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1131 <fib+0x21>
movl   $0x0,-0x4(%rbp)
jmp    116a <fib+0x5a>
cmpl   $0x2,-0x8(%rbp)
jne    1147 <fib+0x37>
movl   $0x1,-0x4(%rbp)
jmp    116a <fib+0x5a>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x1,%ebx
je     1137 <fib+0x27>
nopl   0x0(%rax)
cmp    $0x2,%ebx
je     113b <fib+0x2b>
lea    -0x1(%rbx),%edi
call   1030 <fib@plt>
add    %eax,%ebp
add    $0xfffffffe,%ebx
cmp    $0x1,%ebx
jne    1120 <fib+0x10>
xor    %eax,%eax
jmp    1140 <fib+0x30>
mov    $0x1,%eax
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fib(i32 %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i32 [ 0, %1 ], [ %9, %5 ]
%4 = phi i32 [ %0, %1 ], [ %8, %5 ]
switch i32 %4, label %5 [
i32 1, label %10
i32 2, label %11
]
5: ; preds = %2
%6 = add nsw i32 %4, -1
%7 = tail call i32 @fib(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %3
br label %2
10: ; preds = %2
br label %11
11: ; preds = %2, %10
%12 = phi i32 [ 0, %10 ], [ 1, %2 ]
%13 = add nsw i32 %12, %3
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int read(int, char *, int);
int /*<<< orphan*/ write(int, char *, int);
void copy(int fd) {
  char buf[4096];
  int c;
  while (c = read(fd, buf, sizeof(buf)))
    write(2, buf, c);
}


x86 assembly (clang, -O0):
<copy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x1010(%rbp),%rsi
mov    $0x1000,%edx
call   1040 <read@plt>
mov    %eax,-0x1014(%rbp)
cmp    $0x0,%eax
je     116d <copy+0x4d>
lea    -0x1010(%rbp),%rsi
mov    -0x1014(%rbp),%edx
mov    $0x2,%edi
call   1030 <write@plt>
jmp    112e <copy+0xe>
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy>:
push   %rbp
push   %rbx
sub    $0x1008,%rsp
mov    %edi,%ebp
mov    %rsp,%rsi
mov    $0x1000,%edx
call   1040 <read@plt>
test   %eax,%eax
je     1162 <copy+0x42>
mov    %rsp,%rbx
nop
mov    $0x2,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x1000,%edx
call   1040 <read@plt>
test   %eax,%eax
jne    1140 <copy+0x20>
add    $0x1008,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @copy(i32 %0) {
%2 = alloca i32
%3 = alloca [4096 x i8]
%4 = alloca i32
store i32 %0, i32* %2
br label %5
5: ; preds = %10, %1
%6 = load i32, i32* %2
%7 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%8 = call i32 @read(i32 %6, i8* %7, i32 4096)
store i32 %8, i32* %4
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %5
%11 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%12 = load i32, i32* %4
%13 = call i32 @write(i32 2, i8* %11, i32 %12)
br label %5
14: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @copy(i32 %0) {
%2 = alloca [4096 x i8]
%3 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%4 = call i32 @read(i32 %0, i8* %3, i32 4096)
%5 = icmp eq i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %1, %6
%7 = phi i32 [ %9, %6 ], [ %4, %1 ]
%8 = call i32 @write(i32 2, i8* %3, i32 %7)
%9 = call i32 @read(i32 %0, i8* %3, i32 4096)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6, %1
ret void
}
int pathcon_nm9_n_out(void) { return 2; }


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

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

LLVM IR (-O0):
define i32 @pathcon_nm9_n_out() {
ret i32 2
}

LLVM IR (-O2):
define i32 @pathcon_nm9_n_out() {
ret i32 2
}
int convert(int fahrenheit) { return (5 * (fahrenheit - 32)) / 9; }


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

x86 assembly (clang, -O2):
<convert>:
lea    (%rdi,%rdi,4),%eax
add    $0xffffff60,%eax
cltq
imul   $0x38e38e39,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @convert(i32 %0) {
%2 = mul i32 %0, 5
%3 = add i32 %2, -160
%4 = sdiv i32 %3, 9
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ pause();
void wait_for_signal(void) { pause(); }


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

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

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

LLVM IR (-O2):
define void @wait_for_signal() {
%1 = tail call i32 (...) @pause()
ret void
}
int estimate_bucket_size(int no_of_buckets) { return 1000000; }


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

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

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

LLVM IR (-O2):
define i32 @estimate_bucket_size(i32 %0) {
ret i32 1000000
}
void transfer_RGB888_to_ABGR8888(unsigned char *(*output),
                                 unsigned char *input) {
  *(*output)++ = 0xff;
  *(*output)++ = input[2];
  *(*output)++ = input[1];
  *(*output)++ = input[0];
}


x86 assembly (clang, -O0):
<transfer_RGB888_to_ABGR8888>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,(%rcx)
movb   $0xff,(%rax)
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rax
mov    %rax,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<transfer_RGB888_to_ABGR8888>:
mov    (%rdi),%rax
lea    0x1(%rax),%rcx
mov    %rcx,(%rdi)
movb   $0xff,(%rax)
mov    0x2(%rsi),%al
mov    (%rdi),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,(%rdi)
mov    %al,(%rcx)
mov    0x1(%rsi),%al
mov    (%rdi),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,(%rdi)
mov    %al,(%rcx)
mov    (%rsi),%al
mov    (%rdi),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,(%rdi)
mov    %al,(%rcx)
ret

LLVM IR (-O0):
define void @transfer_RGB888_to_ABGR8888(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** %5
%7 = getelementptr inbounds i8, i8* %6, i32 1
store i8* %7, i8** %5
store i8 -1, i8* %6
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 2
%10 = load i8, i8* %9
%11 = load i8**, i8*** %3
%12 = load i8*, i8** %11
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %11
store i8 %10, i8* %12
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = load i8, i8* %15
%17 = load i8**, i8*** %3
%18 = load i8*, i8** %17
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %17
store i8 %16, i8* %18
%20 = load i8*, i8** %4
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = load i8**, i8*** %3
%24 = load i8*, i8** %23
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %23
store i8 %22, i8* %24
ret void
}

LLVM IR (-O2):
define void @transfer_RGB888_to_ABGR8888(i8** nocapture %0, i8* nocapture %1) {
%3 = load i8*, i8** %0
%4 = getelementptr inbounds i8, i8* %3, i64 1
store i8* %4, i8** %0
store i8 -1, i8* %3
%5 = getelementptr inbounds i8, i8* %1, i64 2
%6 = load i8, i8* %5
%7 = load i8*, i8** %0
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %8, i8** %0
store i8 %6, i8* %7
%9 = getelementptr inbounds i8, i8* %1, i64 1
%10 = load i8, i8* %9
%11 = load i8*, i8** %0
%12 = getelementptr inbounds i8, i8* %11, i64 1
store i8* %12, i8** %0
store i8 %10, i8* %11
%13 = load i8, i8* %1
%14 = load i8*, i8** %0
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8* %15, i8** %0
store i8 %13, i8* %14
ret void
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ mvprintw(int, int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ refresh();
void get_return() {
  int ch;
  mvprintw(23, 0, "%s", " Press return ");
  refresh();
  while ((ch = getchar()) != '\n' && ch != EOF)
    ;
}


x86 assembly (clang, -O0):
<get_return>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x17,%edi
xor    %esi,%esi
lea    0xeba(%rip),%rdx
lea    0xeb6(%rip),%rcx
call   1050 <mvprintw@plt>
mov    $0x0,%al
call   1040 <refresh@plt>
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,%ecx
mov    %ecx,-0x4(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x5(%rbp)
je     1185 <get_return+0x55>
mov    -0x4(%rbp),%eax
mov    0x2e6b(%rip),%rcx
cmp    (%rcx),%eax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1195 <get_return+0x65>
jmp    119a <get_return+0x6a>
jmp    1159 <get_return+0x29>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_return>:
push   %rbx
lea    0xec8(%rip),%rdx
lea    0xec4(%rip),%rcx
mov    $0x17,%edi
xor    %esi,%esi
call   1050 <mvprintw@plt>
xor    %eax,%eax
call   1040 <refresh@plt>
mov    0x2e8f(%rip),%rbx
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%eax
je     1170 <get_return+0x40>
cmp    (%rbx),%eax
jne    1160 <get_return+0x30>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [15 x i8] c" Press return \00"
@EOF = global i32 0
define void @get_return() {
%1 = alloca i32
%2 = call i32 @mvprintw(i32 23, i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 (...) @refresh()
br label %4
4: ; preds = %13, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %1
%6 = icmp ne i32 %5, 10
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = load i32, i32* %1
%9 = load i32, i32* @EOF
%10 = icmp ne i32 %8, %9
br label %11
11: ; preds = %7, %4
%12 = phi i1 [ false, %4 ], [ %10, %7 ]
br i1 %12, label %13, label %14
13: ; preds = %11
br label %4
14: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [15 x i8] c" Press return \00"
@EOF = global i32 0
define void @get_return() {
%1 = tail call i32 @mvprintw(i32 23, i32 0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 (...) @refresh()
br label %3
3: ; preds = %3, %0
%4 = tail call i32 (...) @getchar()
%5 = icmp ne i32 %4, 10
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %4, %6
%8 = select i1 %5, i1 %7, i1 false
br i1 %8, label %3, label %9
9: ; preds = %3
ret void
}
const char *greeting() { return "Hello world!"; }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world!\00"
define i8* @greeting() {
ret i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello world!\00"
define i8* @greeting() {
ret i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void LETimeroff() {
  *((volatile uint32_t *)(0x40082000 + 0x004)) = 0;
  *((volatile uint32_t *)(0x40082000 + 0x02c)) = 0;
  *((volatile uint32_t *)(0x400c8000 + 0x058)) = 0;
  *((volatile uint32_t *)(0x400c8000 + 0x040)) &= ~(1 << 4);
  *((volatile uint32_t *)(0x400c8000 + 0x020)) = (1 << 7);
}


x86 assembly (clang, -O0):
<LETimeroff>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40082004,%eax
movl   $0x0,(%rax)
mov    $0x4008202c,%eax
movl   $0x0,(%rax)
mov    $0x400c8058,%eax
movl   $0x0,(%rax)
mov    $0x400c8040,%eax
mov    (%rax),%ecx
and    $0xffffffef,%ecx
mov    $0x400c8040,%eax
mov    %ecx,(%rax)
mov    $0x400c8020,%eax
movl   $0x80,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<LETimeroff>:
movl   $0x0,0x40082004
movl   $0x0,0x4008202c
movl   $0x0,0x400c8058
andl   $0xffffffef,0x400c8040
ef
movl   $0x80,0x400c8020
ret

LLVM IR (-O0):
define void @LETimeroff() {
store volatile i32 0, i32* inttoptr (i64 1074274308 to i32*)
store volatile i32 0, i32* inttoptr (i64 1074274348 to i32*)
store volatile i32 0, i32* inttoptr (i64 1074561112 to i32*)
%1 = load volatile i32, i32* inttoptr (i64 1074561088 to i32*)
%2 = and i32 %1, -17
store volatile i32 %2, i32* inttoptr (i64 1074561088 to i32*)
store volatile i32 128, i32* inttoptr (i64 1074561056 to i32*)
ret void
}

LLVM IR (-O2):
define void @LETimeroff() {
store volatile i32 0, i32* inttoptr (i64 1074274308 to i32*)
store volatile i32 0, i32* inttoptr (i64 1074274348 to i32*)
store volatile i32 0, i32* inttoptr (i64 1074561112 to i32*)
%1 = load volatile i32, i32* inttoptr (i64 1074561088 to i32*)
%2 = and i32 %1, -17
store volatile i32 %2, i32* inttoptr (i64 1074561088 to i32*)
store volatile i32 128, i32* inttoptr (i64 1074561056 to i32*)
ret void
}
const char *arts_esd_audio_devices() { return "sound server aRts"; }


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"sound server aRts\00"
define i8* @arts_esd_audio_devices() {
ret i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [18 x i8] c"sound server aRts\00"
define i8* @arts_esd_audio_devices() {
ret i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void SetPort(int _port) { printf("Port:%d\r\n", _port); }


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

x86 assembly (clang, -O2):
<SetPort>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [10 x i8] c"Port:%d\0D\0A\00"
define void @SetPort(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
void exynos5_default_sdhci2(void) {}


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

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

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

LLVM IR (-O2):
define void @exynos5_default_sdhci2() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdout;
void version(void) {
  fprintf(stdout, "ioping %s\n",
          "1.2"
          "");
}


x86 assembly (clang, -O0):
<version>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
lea    0xee0(%rip),%rdx
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<version>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
lea    0xee4(%rip),%rdx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [11 x i8] c"ioping %s\0A\00"
@.str.1 = [4 x i8] c"1.2\00"
define void @version() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [11 x i8] c"ioping %s\0A\00"
@.str.1 = [4 x i8] c"1.2\00"
define void @version() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void __attribute__((no)) get_mem_attrs() {}


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

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

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

LLVM IR (-O2):
define void @get_mem_attrs() {
ret void
}
void cw1200_itp_release(struct cw1200_common *priv) {}


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

x86 assembly (clang, -O2):
ret

LLVM IR (-O0):
%struct.cw1200_common = type opaque
define void @cw1200_itp_release(%struct.cw1200_common* %0) {
%2 = alloca %struct.cw1200_common*
store %struct.cw1200_common* %0, %struct.cw1200_common** %2
ret void
}

LLVM IR (-O2):
%struct.cw1200_common = type opaque
define void @cw1200_itp_release(%struct.cw1200_common* nocapture %0) {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void GPIO_clearDio(uint32_t dioNumber) {
  ;
  (*((volatile unsigned long *)(0x40022000 + 0x000000A0))) = (1 << dioNumber);
}


x86 assembly (clang, -O0):
<GPIO_clearDio>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
movslq %eax,%rcx
mov    $0x400220a0,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPIO_clearDio>:
mov    %edi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
mov    %rax,0x400220a0
40
ret

LLVM IR (-O0):
define void @GPIO_clearDio(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 1, %3
%5 = sext i32 %4 to i64
store volatile i64 %5, i64* inttoptr (i64 1073881248 to i64*)
ret void
}

LLVM IR (-O2):
define void @GPIO_clearDio(i32 %0) {
%2 = shl nuw i32 1, %0
%3 = sext i32 %2 to i64
store volatile i64 %3, i64* inttoptr (i64 1073881248 to i64*)
ret void
}
/* Variables and functions */
int f(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @f() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char *);
void usage(void) {
  puts("Usage: hardshutdown -h|-r|-p [NN]\n"
       "	NN - seconds to sleep before requested action");
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [81 x i8] c"Usage: hardshutdown -h|-r|-p [NN]\0A\09NN - seconds to sleep before requested action\00"
define void @usage() {
%1 = call i32 @puts(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [81 x i8] c"Usage: hardshutdown -h|-r|-p [NN]\0A\09NN - seconds to sleep before requested action\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef unsigned long uint32_t;

/* Variables and functions */
void CRYPTOIntClear(uint32_t ui32IntFlags) {

  ;
  (*((volatile unsigned long *)(0x40024000 + 0x00000788))) = ui32IntFlags;
}


x86 assembly (clang, -O0):
<CRYPTOIntClear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x40024788,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<CRYPTOIntClear>:
mov    %rdi,0x40024788
40
ret

LLVM IR (-O0):
define void @CRYPTOIntClear(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
store volatile i64 %3, i64* inttoptr (i64 1073891208 to i64*)
ret void
}

LLVM IR (-O2):
define void @CRYPTOIntClear(i64 %0) {
store volatile i64 %0, i64* inttoptr (i64 1073891208 to i64*)
ret void
}
/* Type definitions */
struct timeval {
  int tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long long get_timestamp() {
  long long ts;
  struct timeval tv;
  gettimeofday(&tv, NULL);
  ts = tv.tv_sec - 1262304000;
  return ts;
}


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

x86 assembly (clang, -O2):
<get_timestamp>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq (%rsp),%rax
add    $0xffffffffb4c2c500,%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i64 @get_timestamp() {
%1 = alloca i64
%2 = alloca %struct.timeval
%3 = call i32 @gettimeofday(%struct.timeval* %2, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i32 0, i32 0
%5 = load i32, i32* %4
%6 = sub nsw i32 %5, 1262304000
%7 = sext i32 %6 to i64
store i64 %7, i64* %1
%8 = load i64, i64* %1
ret i64 %8
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i64 @get_timestamp() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = add nsw i32 %5, -1262304000
%7 = sext i32 %6 to i64
ret i64 %7
}
void SwapInteger(int *p1, int *p2) {
  int tmp;
  tmp = *p1;
  *p1 = *p2;
  *p2 = tmp;
}


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

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

LLVM IR (-O0):
define void @SwapInteger(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32, i32* %6
store i32 %7, i32* %5
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
store i32 %11, i32* %12
ret void
}

LLVM IR (-O2):
define void @SwapInteger(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
int utime(const char *file, const struct utimbuf *times) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.utimbuf = type opaque
define i32 @utime(i8* nocapture readnone %0, %struct.utimbuf* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_thread_self() {
  printf("NOT IMPLEMENTED:"
         "pa_thread_self"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"NOT IMPLEMENTED:pa_thread_self\0A\00"
define i32 @pa_thread_self() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [31 x i8] c"NOT IMPLEMENTED:pa_thread_self\00"
define i32 @pa_thread_self() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
ret i32 undef
}