xunge/DecIR huggingface dataset:
/* Variables and functions */
float cosf(float);
float _cos(float n) { return cosf(n); }


x86 assembly (clang, -O0):
<_cos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <cosf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cos>:
jmp    1030 <cosf@plt>

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

LLVM IR (-O2):
define float @_cos(float %0) {
%2 = tail call float @cosf(float %0)
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalpha(int);
void t_isalpha_0x14() {
  Assert_real((isalpha(20) == 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_isalpha.c",
              105, ("isalpha should be 0 for 0x14"));
}


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

x86 assembly (clang, -O2):
<t_isalpha_0x14>:
push   %rax
mov    $0x14,%edi
call   1030 <isalpha@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x69,%edx
pop    %rax
jmp    1040 <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_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0x14\00"
define void @t_isalpha_0x14() {
%1 = call i64 @isalpha(i32 20)
%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 105, 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_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0x14\00"
define void @t_isalpha_0x14() {
%1 = tail call i64 @isalpha(i32 20)
%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 105, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int fsync(int);
int fsync_log(int fd) { return fsync(fd); }


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

x86 assembly (clang, -O2):
<fsync_log>:
jmp    1030 <fsync@plt>

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

LLVM IR (-O2):
define i32 @fsync_log(i32 %0) {
%2 = tail call i32 @fsync(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ strcmp(char const *, char const *);
bool __string_equal(const char *s1, const char *s2) {
  if (!s1 || !s2)
    return s1 == s2;
  return !strcmp(s1, s2);
}


x86 assembly (clang, -O0):
<__string_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1136 <__string_equal+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    114e <__string_equal+0x3e>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    116b <__string_equal+0x5b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__string_equal>:
test   %rdi,%rdi
je     112d <__string_equal+0x1d>
test   %rsi,%rsi
je     112d <__string_equal+0x1d>
push   %rax
call   1030 <strcmp@plt>
test   %eax,%eax
sete   %al
add    $0x8,%rsp
movzbl %al,%eax
ret
cmp    %rsi,%rdi
sete   %al
movzbl %al,%eax
ret

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

LLVM IR (-O2):
define i32 @__string_equal(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = icmp eq i8* %0, %1
br label %11
8: ; preds = %2
%9 = tail call i32 @strcmp(i8* %0, i8* %1)
%10 = icmp eq i32 %9, 0
br label %11
11: ; preds = %8, %6
%12 = phi i1 [ %10, %8 ], [ %7, %6 ]
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
int d34(int);
int d35(int a) { return d34(d34(a)); }


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

x86 assembly (clang, -O2):
<d35>:
push   %rax
call   1030 <d34@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <d34@plt>

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

LLVM IR (-O2):
define i32 @d35(i32 %0) {
%2 = tail call i32 @d34(i32 %0)
%3 = tail call i32 @d34(i32 %2)
ret i32 %3
}
/* Variables and functions */
char *StrDup(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
extern char *IntStrDup(int val) {
  char buff[20];
  sprintf(buff, "%d", val);
  return (StrDup(buff));
}


x86 assembly (clang, -O0):
<IntStrDup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xec7(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <StrDup@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IntStrDup>:
push   %rbx
sub    $0x20,%rsp
mov    %edi,%edx
lea    0xed2(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <StrDup@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i8* @IntStrDup(i32 %0) {
%2 = alloca i32
%3 = alloca [20 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%8 = call i8* @StrDup(i8* %7)
ret i8* %8
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i8* @IntStrDup(i32 %0) {
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = call i8* @StrDup(i8* %3)
ret i8* %5
}
void clear_intvector(int *vector, int size) {
  int i;
  for (i = 0; i < size; ++i)
    vector[i] = 0;
}


x86 assembly (clang, -O0):
<clear_intvector>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    113b <clear_intvector+0x3b>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <clear_intvector+0x12>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_intvector>:
test   %esi,%esi
jle    1126 <clear_intvector+0x16>
push   %rax
mov    %esi,%edx
shl    $0x2,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @clear_intvector(i32* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = bitcast i32* %0 to i8*
%6 = zext i32 %1 to i64
%7 = shl nuw nsw i64 %6, 2
br label %8
8: ; preds = %4, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stdout;
void uninit_fputc(void) {
  int i;
  FILE *fp;
  fputc('a', stdout);
  fputc(i, stdout);
  fputc('a', fp);
}


x86 assembly (clang, -O0):
<uninit_fputc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%rsi
mov    $0x61,%edi
call   1030 <fputc@plt>
mov    -0x4(%rbp),%eax
mov    0x2eaa(%rip),%rcx
mov    (%rcx),%rsi
movsbl %al,%edi
call   1030 <fputc@plt>
mov    -0x10(%rbp),%rsi
mov    $0x61,%edi
call   1030 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uninit_fputc>:
push   %rbx
mov    0x2ec8(%rip),%rbx
mov    (%rbx),%rsi
mov    $0x61,%edi
call   1030 <fputc@plt>
mov    (%rbx),%rsi
xor    %edi,%edi
call   1030 <fputc@plt>
mov    $0x61,%edi
pop    %rbx
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@stdout = global i32* null
define void @uninit_fputc() {
%1 = alloca i32
%2 = alloca i32*
%3 = load i32*, i32** @stdout
%4 = call i32 @fputc(i8 signext 97, i32* %3)
%5 = load i32, i32* %1
%6 = trunc i32 %5 to i8
%7 = load i32*, i32** @stdout
%8 = call i32 @fputc(i8 signext %6, i32* %7)
%9 = load i32*, i32** %2
%10 = call i32 @fputc(i8 signext 97, i32* %9)
ret void
}

LLVM IR (-O2):
@stdout = global i32* null
define void @uninit_fputc() {
%1 = load i32*, i32** @stdout
%2 = tail call i32 @fputc(i8 signext 97, i32* %1)
%3 = load i32*, i32** @stdout
%4 = tail call i32 @fputc(i8 signext undef, i32* %3)
%5 = tail call i32 @fputc(i8 signext 97, i32* undef)
ret void
}
int repeat(int n) {
  int num[10] = {0};
  while (n != 0) {
    int temp = n % 10;
    n = n / 10;
    num[temp]++;
    if (num[temp] > 1) {
      return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<repeat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
cmpl   $0x0,-0x8(%rbp)
je     1180 <repeat+0x70>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x34(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
movslq -0x34(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x30(%rbp,%rax,4)
movslq -0x34(%rbp),%rax
cmpl   $0x1,-0x30(%rbp,%rax,4)
jle    117b <repeat+0x6b>
movl   $0x1,-0x4(%rbp)
jmp    1187 <repeat+0x77>
jmp    112b <repeat+0x1b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<repeat>:
xorps  %xmm0,%xmm0
movaps %xmm0,-0x18(%rsp)
movaps %xmm0,-0x28(%rsp)
movq   $0x0,-0x8(%rsp)
cs nopw 0x0(%rax,%rax,1)
test   %edi,%edi
je     115d <repeat+0x5d>
movslq %edi,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
lea    (%rax,%rax,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%edi
movslq %edi,%rcx
mov    -0x28(%rsp,%rcx,4),%edx
lea    0x1(%rdx),%esi
mov    %esi,-0x28(%rsp,%rcx,4)
mov    %eax,%edi
test   %edx,%edx
jle    1120 <repeat+0x20>
mov    $0x1,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @repeat(i32 %0) {
%2 = alloca [10 x i32]
%3 = bitcast [10 x i32]* %2 to i8*
br label %4
4: ; preds = %7, %1
%5 = phi i32 [ %0, %1 ], [ %9, %7 ]
%6 = icmp eq i32 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %4
%8 = srem i32 %5, 10
%9 = sdiv i32 %5, 10
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = add nsw i32 %12, 1
store i32 %13, i32* %11
%14 = icmp sgt i32 %12, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %7
%16 = phi i32 [ 1, %7 ], [ 0, %4 ]
ret i32 %16
}
const char *loader_HS_get_name(void) { return "loader for HeaderSave images"; }


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"loader for HeaderSave images\00"
define i8* @loader_HS_get_name() {
ret i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [29 x i8] c"loader for HeaderSave images\00"
define i8* @loader_HS_get_name() {
ret i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ atoi(char const *);
int fib(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, const char *argv[]) {
  printf("%d\n", fib(atoi(argv[1])));
  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    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <fib@plt>
mov    %eax,%esi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <fib@plt>
lea    0xeb8(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\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 = load i8**, i8*** %5
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = call i32 @atoi(i8* %8)
%10 = call i32 @fib(i32 %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = tail call i32 @fib(i32 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
float tan(float);
float tangent(float a) {
  float b = tan(a);
  return b;
}


x86 assembly (clang, -O0):
<tangent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <tan@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tangent>:
jmp    1030 <tan@plt>

LLVM IR (-O0):
define float @tangent(float %0) {
%2 = alloca float
%3 = alloca float
store float %0, float* %2
%4 = load float, float* %2
%5 = call float @tan(float %4)
store float %5, float* %3
%6 = load float, float* %3
ret float %6
}

LLVM IR (-O2):
define float @tangent(float %0) {
%2 = tail call float @tan(float %0)
ret float %2
}
int getGlobalID(int dim, int groupID0, int groupID1, int localID0, int localID1,
                int localSize0, int localSize1) {
  return (dim == 0) ? localSize0 * groupID0 + localID0
                    : localSize1 * groupID1 + localID1;
}


x86 assembly (clang, -O0):
<getGlobalID>:
push   %rbp
mov    %rsp,%rbp
mov    0x10(%rbp),%eax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1137 <getGlobalID+0x37>
mov    -0x18(%rbp),%eax
imul   -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    1144 <getGlobalID+0x44>
mov    0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getGlobalID>:
imul   %r9d,%esi
add    %esi,%ecx
imul   0x8(%rsp),%edx
lea    (%rdx,%r8,1),%eax
test   %edi,%edi
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @getGlobalID(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = icmp eq i32 %0, 0
%9 = mul nsw i32 %5, %1
%10 = add nsw i32 %9, %3
%11 = mul nsw i32 %6, %2
%12 = add nsw i32 %11, %4
%13 = select i1 %8, i32 %10, i32 %12
ret i32 %13
}
/* Variables and functions */
scalar_t__ alloca(int);
int /*<<< orphan*/ test12a(char *);
void __attribute__((no)) __attribute__((noclone)) test12(void) {
  char *save = (char *)alloca(4);
  test12a(save);
}


x86 assembly (clang, -O0):
<test12>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <test12a@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test12>:
push   %rax
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%rdi
pop    %rax
jmp    1040 <test12a@plt>

LLVM IR (-O0):
define void @test12() {
%1 = alloca i8*
%2 = call i64 @alloca(i32 4)
%3 = inttoptr i64 %2 to i8*
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i32 @test12a(i8* %4)
ret void
}

LLVM IR (-O2):
define void @test12() {
%1 = tail call i64 @alloca(i32 4)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i32 @test12a(i8* %2)
ret void
}
void setMode(int fd) {}


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

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

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

LLVM IR (-O2):
define void @setMode(i32 %0) {
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int UINT32_C(int);
int UINT64_C(int);
void fiat_p256_msat(uint64_t out1[5]) {
  out1[0] = UINT64_C(0xffffffffffffffff);
  out1[1] = UINT32_C(0xffffffff);
  out1[2] = 0x0;
  out1[3] = UINT64_C(0xffffffff00000001);
  out1[4] = 0x0;
}


x86 assembly (clang, -O0):
<fiat_p256_msat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%edi
call   1040 <UINT32_C@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x8(%rax)
mov    $0x1,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x8(%rbp),%rax
movl   $0x0,0x10(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fiat_p256_msat>:
push   %rbx
mov    %rdi,%rbx
mov    $0xffffffff,%edi
call   1030 <UINT64_C@plt>
mov    %eax,(%rbx)
mov    $0xffffffff,%edi
call   1040 <UINT32_C@plt>
mov    %eax,0x4(%rbx)
movl   $0x0,0x8(%rbx)
mov    $0x1,%edi
call   1030 <UINT64_C@plt>
mov    %eax,0xc(%rbx)
movl   $0x0,0x10(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @fiat_p256_msat(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 @UINT64_C(i32 -1)
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 0
store i32 %3, i32* %5
%6 = call i32 @UINT32_C(i32 -1)
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 1
store i32 %6, i32* %8
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 2
store i32 0, i32* %10
%11 = call i32 @UINT64_C(i32 1)
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 3
store i32 %11, i32* %13
%14 = load i32*, i32** %2
%15 = getelementptr inbounds i32, i32* %14, i64 4
store i32 0, i32* %15
ret void
}

LLVM IR (-O2):
define void @fiat_p256_msat(i32* nocapture writeonly %0) {
%2 = tail call i32 @UINT64_C(i32 -1)
store i32 %2, i32* %0
%3 = tail call i32 @UINT32_C(i32 -1)
%4 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %3, i32* %4
%5 = getelementptr inbounds i32, i32* %0, i64 2
store i32 0, i32* %5
%6 = tail call i32 @UINT64_C(i32 1)
%7 = getelementptr inbounds i32, i32* %0, i64 3
store i32 %6, i32* %7
%8 = getelementptr inbounds i32, i32* %0, i64 4
store i32 0, i32* %8
ret void
}
int predict_sensors(int x, int y, int th, int tu, long *state, int *laser) {
  x = x;
  y = y;
  th = th;
  tu = tu;
  state[0] = state[0];
  laser[0] = laser[0];
  return (1);
}


x86 assembly (clang, -O0):
<predict_sensors>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @predict_sensors(i32 %0, i32 %1, i32 %2, i32 %3, i64* %4, i32* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i64*
%12 = alloca i32*
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i64* %4, i64** %11
store i32* %5, i32** %12
%13 = load i32, i32* %7
store i32 %13, i32* %7
%14 = load i32, i32* %8
store i32 %14, i32* %8
%15 = load i32, i32* %9
store i32 %15, i32* %9
%16 = load i32, i32* %10
store i32 %16, i32* %10
%17 = load i64*, i64** %11
%18 = getelementptr inbounds i64, i64* %17, i64 0
%19 = load i64, i64* %18
%20 = load i64*, i64** %11
%21 = getelementptr inbounds i64, i64* %20, i64 0
store i64 %19, i64* %21
%22 = load i32*, i32** %12
%23 = getelementptr inbounds i32, i32* %22, i64 0
%24 = load i32, i32* %23
%25 = load i32*, i32** %12
%26 = getelementptr inbounds i32, i32* %25, i64 0
store i32 %24, i32* %26
ret i32 1
}

LLVM IR (-O2):
define i32 @predict_sensors(i32 %0, i32 %1, i32 %2, i32 %3, i64* nocapture readnone %4, i32* nocapture readnone %5) {
ret i32 1
}
/* Variables and functions */
char *b();
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *c() {
  char *b_str = b();
  char *ret = (char *)malloc(strlen(b_str) + 2);
  strcpy(ret, b_str);
  strcat(ret, "!");
  return ret;
}


x86 assembly (clang, -O0):
<c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <b@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rdi
add    $0x2,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1070 <strcat@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <b@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1050 <strlen@plt>
lea    0x2(%rax),%rdi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xe7c(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"!\00"
define i8* @c() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i8* (...) @b()
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 2
%7 = call i64 @malloc(i64 %6)
%8 = inttoptr i64 %7 to i8*
store i8* %8, i8** %2
%9 = load i8*, i8** %2
%10 = load i8*, i8** %1
%11 = call i32 @strcpy(i8* %9, i8* %10)
%12 = load i8*, i8** %2
%13 = call i32 @strcat(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
@.str = [2 x i8] c"!\00"
define i8* @c() {
%1 = tail call i8* (...) @b()
%2 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%3 = add nsw i64 %2, 2
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @strcpy(i8* %5, i8* %1)
%7 = tail call i32 @strcat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void cetak(int data[], int top) {
  int i;
  for (i = 0; i < top; i++) {
    printf("%d\n", data[i]);
  }
}


x86 assembly (clang, -O0):
<cetak>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1157 <cetak+0x47>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <cetak+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cetak>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <cetak+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <cetak+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @cetak(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
void swaparr(int *x, int *y) {
  int tmp = *x;
  *x = *y;
  *y = tmp;
}


x86 assembly (clang, -O0):
<swaparr>:
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):
<swaparr>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
mov    %eax,(%rsi)
ret

LLVM IR (-O0):
define void @swaparr(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 @swaparr(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
}
const char *I_NoAppServicesLobbyMgrGetNameAt(unsigned int idx) { return ""; }


x86 assembly (clang, -O0):
<I_NoAppServicesLobbyMgrGetNameAt>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
lea    0xef2(%rip),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @I_NoAppServicesLobbyMgrGetNameAt(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @I_NoAppServicesLobbyMgrGetNameAt(i32 %0) {
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}
int coordinateNotInRange(char *c, int boardSize) {
  return *c < 97 || *c > 97 + boardSize - 1;
}


x86 assembly (clang, -O0):
<coordinateNotInRange>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x61,%ecx
mov    %al,-0xd(%rbp)
jl     1138 <coordinateNotInRange+0x38>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    -0xc(%rbp),%ecx
add    $0x61,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
setg   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<coordinateNotInRange>:
movsbl (%rdi),%eax
cmp    $0x61,%eax
setl   %cl
add    $0x60,%esi
cmp    %eax,%esi
setl   %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @coordinateNotInRange(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp slt i32 %7, 97
br i1 %8, label %17, label %9
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = load i32, i32* %4
%14 = add nsw i32 97, %13
%15 = sub nsw i32 %14, 1
%16 = icmp sgt i32 %12, %15
br label %17
17: ; preds = %9, %2
%18 = phi i1 [ true, %2 ], [ %16, %9 ]
%19 = zext i1 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @coordinateNotInRange(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp slt i8 %3, 97
%5 = sext i8 %3 to i32
%6 = add nsw i32 %1, 96
%7 = icmp slt i32 %6, %5
%8 = select i1 %4, i1 true, i1 %7
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fwrite(char *, int, int, int /*<<< orphan*/ *);
int vsnprintf(char *, int, char const *, int /*<<< orphan*/);
int vfprintf(FILE *stream, const char *format, va_list arg) {
  char buf[512];
  int error = 0;
  int len = vsnprintf(buf, 512, format, arg);
  error = fwrite(buf, 1, len, stream);
  if (!error) {
    error = len;
  }
  return error;
}


x86 assembly (clang, -O0):
<vfprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x224(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    $0x200,%esi
call   1030 <vsnprintf@plt>
mov    %eax,-0x228(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x228(%rbp),%edx
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fwrite@plt>
mov    %eax,-0x224(%rbp)
cmpl   $0x0,-0x224(%rbp)
jne    1198 <vfprintf+0x78>
mov    -0x228(%rbp),%eax
mov    %eax,-0x224(%rbp)
mov    -0x224(%rbp),%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vfprintf>:
push   %rbp
push   %r14
push   %rbx
sub    $0x200,%rsp
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x200,%esi
call   1030 <vsnprintf@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    $0x1,%esi
mov    %eax,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
test   %eax,%eax
cmove  %ebp,%eax
add    $0x200,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @vfprintf(i32* %0, i8* %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [512 x i8]
%8 = alloca i32
%9 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %8
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = call i32 @vsnprintf(i8* %10, i32 512, i8* %11, i32 %12)
store i32 %13, i32* %9
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%15 = load i32, i32* %9
%16 = load i32*, i32** %4
%17 = call i32 @fwrite(i8* %14, i32 1, i32 %15, i32* %16)
store i32 %17, i32* %8
%18 = load i32, i32* %8
%19 = icmp ne i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %3
%21 = load i32, i32* %9
store i32 %21, i32* %8
br label %22
22: ; preds = %20, %3
%23 = load i32, i32* %8
ret i32 %23
}

LLVM IR (-O2):
define i32 @vfprintf(i32* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%6 = call i32 @vsnprintf(i8* %5, i32 512, i8* %1, i32 %2)
%7 = call i32 @fwrite(i8* %5, i32 1, i32 %6, i32* %0)
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i32 %6, i32 %7
ret i32 %9
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int c, lc;
  lc = 0;
  while ((c = getchar()) != EOF) {
    if (c == '\n')
      lc += 1;
  }
  printf("%d\n", lc);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     1167 <main+0x47>
cmpl   $0xa,-0x8(%rbp)
jne    1162 <main+0x42>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <main+0x16>
mov    -0xc(%rbp),%esi
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb4(%rip),%r14
cmp    (%r14),%eax
je     1156 <main+0x36>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %ecx,%ecx
cmp    $0xa,%eax
sete   %cl
add    %ecx,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
jne    1140 <main+0x20>
lea    0xea3(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %14, %0
%5 = call i32 (...) @getchar()
store i32 %5, i32* %2
%6 = load i32, i32* @EOF
%7 = icmp ne i32 %5, %6
br i1 %7, label %8, label %15
8: ; preds = %4
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 10
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %14
14: ; preds = %11, %8
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %13, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %10, %4 ], [ %1, %0 ]
%6 = phi i32 [ %9, %4 ], [ 0, %0 ]
%7 = icmp eq i32 %5, 10
%8 = zext i1 %7 to i32
%9 = add nuw nsw i32 %6, %8
%10 = tail call i32 (...) @getchar()
%11 = load i32, i32* @EOF
%12 = icmp eq i32 %10, %11
br i1 %12, label %13, label %4
13: ; preds = %4, %0
%14 = phi i32 [ 0, %0 ], [ %9, %4 ]
%15 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ foo2(char);
int /*<<< orphan*/ print_int(char);
int /*<<< orphan*/ print_string(char *);
void foo1(char c) {
  print_int(c);
  print_string("\n");
  foo2(c);
}


x86 assembly (clang, -O0):
<foo1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1050 <print_int@plt>
lea    0xeb2(%rip),%rdi
call   1040 <print_string@plt>
movsbl -0x1(%rbp),%edi
call   1030 <foo2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo1>:
push   %rbx
mov    %edi,%ebx
call   1050 <print_int@plt>
lea    0xec1(%rip),%rdi
call   1040 <print_string@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <foo2@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @foo1(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @print_int(i8 signext %3)
%5 = call i32 @print_string(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = load i8, i8* %2
%7 = call i32 @foo2(i8 signext %6)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"\0A\00"
define void @foo1(i8 signext %0) {
%2 = tail call i32 @print_int(i8 signext %0)
%3 = tail call i32 @print_string(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @foo2(i8 signext %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ W_OK;
scalar_t__ access(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ dirname(char *);
int /*<<< orphan*/ strcpy(char *, char const *const);
int /*<<< orphan*/ strlen(char const *const);
bool parent_dir_is_writeable(const char *const path) {
  char copy[strlen(path) + 1];
  strcpy(copy, path);
  return access(dirname(copy), W_OK) == 0;
}


x86 assembly (clang, -O0):
<parent_dir_is_writeable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x20(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x20(%rbp),%rdi
call   1050 <dirname@plt>
mov    %eax,%edi
mov    0x2e52(%rip),%rax
mov    (%rax),%esi
call   1060 <access@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parent_dir_is_writeable>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
add    $0x1,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <dirname@plt>
mov    0x2e6b(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1060 <access@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@W_OK = global i32 0
define i32 @parent_dir_is_writeable(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
store i8* %9, i8** %3
%10 = alloca i8, i64 %8
store i64 %8, i64* %4
%11 = load i8*, i8** %2
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = call i32 @dirname(i8* %10)
%14 = load i32, i32* @W_OK
%15 = call i64 @access(i32 %13, i32 %14)
%16 = icmp eq i64 %15, 0
%17 = zext i1 %16 to i32
%18 = load i8*, i8** %3
ret i32 %17
}

LLVM IR (-O2):
@W_OK = global i32 0
define i32 @parent_dir_is_writeable(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = call i32 @strcpy(i8* %5, i8* %0)
%7 = call i32 @dirname(i8* %5)
%8 = load i32, i32* @W_OK
%9 = call i64 @access(i32 %7, i32 %8)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int j1() { return 255; }


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

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

LLVM IR (-O0):
define i32 @j1() {
ret i32 255
}

LLVM IR (-O2):
define i32 @j1() {
ret i32 255
}
void _gnat_builtin_longjmp(ptr) void *ptr;
{ __builtin_longjmp(ptr, 1); }


x86 assembly (clang, -O0):
<_gnat_builtin_longjmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    (%rcx),%rbp
mov    0x8(%rcx),%rax
mov    0x10(%rcx),%rsp
jmp    *%rax

x86 assembly (clang, -O2):
<_gnat_builtin_longjmp>:
push   %rbp
mov    (%rdi),%rbp
mov    0x8(%rdi),%rax
mov    0x10(%rdi),%rsp
jmp    *%rax

LLVM IR (-O0):
define void @_gnat_builtin_longjmp(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i8**
%5 = bitcast i8** %4 to i8*
unreachable
}

LLVM IR (-O2):
define void @_gnat_builtin_longjmp(i8* %0) {
tail call void @llvm.eh.sjlj.longjmp(i8* %0)
unreachable
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t lfs_popc(uint32_t a) {
  a = a - ((a >> 1) & 0x55555555);
  a = (a & 0x33333333) + ((a >> 2) & 0x33333333);
  return (((a + (a >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;
}


x86 assembly (clang, -O0):
<lfs_popc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x1,%ecx
and    $0x55555555,%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x33333333,%eax
mov    -0x4(%rbp),%ecx
sar    $0x2,%ecx
and    $0x33333333,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
sar    $0x4,%ecx
add    %ecx,%eax
and    $0xf0f0f0f,%eax
imul   $0x1010101,%eax,%eax
sar    $0x18,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lfs_popc>:
mov    %edi,%eax
shr    %eax
and    $0x55555555,%eax
sub    %eax,%edi
mov    %edi,%eax
and    $0x33333333,%eax
shr    $0x2,%edi
and    $0x33333333,%edi
add    %eax,%edi
mov    %edi,%eax
shr    $0x4,%eax
add    %edi,%eax
and    $0xf0f0f0f,%eax
imul   $0x1010101,%eax,%eax
shr    $0x18,%eax
ret

LLVM IR (-O0):
define i32 @lfs_popc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = ashr i32 %4, 1
%6 = and i32 %5, 1431655765
%7 = sub nsw i32 %3, %6
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = and i32 %8, 858993459
%10 = load i32, i32* %2
%11 = ashr i32 %10, 2
%12 = and i32 %11, 858993459
%13 = add nsw i32 %9, %12
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = ashr i32 %15, 4
%17 = add nsw i32 %14, %16
%18 = and i32 %17, 252645135
%19 = mul nsw i32 %18, 16843009
%20 = ashr i32 %19, 24
ret i32 %20
}

LLVM IR (-O2):
define i32 @lfs_popc(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 1431655765
%4 = sub nsw i32 %0, %3
%5 = and i32 %4, 858993459
%6 = lshr i32 %4, 2
%7 = and i32 %6, 858993459
%8 = add nuw nsw i32 %7, %5
%9 = lshr i32 %8, 4
%10 = add nuw nsw i32 %9, %8
%11 = and i32 %10, 252645135
%12 = mul nsw i32 %11, 16843009
%13 = lshr i32 %12, 24
ret i32 %13
}
int osrandom_rand_status(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @osrandom_rand_status() {
ret i32 1
}
/* Variables and functions */
int strcmp(char const *, char const *);
int StrCmp(const void *si, const void *sj) {
  const char **i = (const char **)si;
  const char **j = (const char **)sj;
  return (strcmp(*i, *j));
}


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

x86 assembly (clang, -O2):
<StrCmp>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @StrCmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
store i8** %8, i8*** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i8**
store i8** %10, i8*** %6
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %6
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* %12, i8* %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @StrCmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(1) %6)
ret i32 %7
}