xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ cnfImprt(char *const, int, char *);
int /*<<< orphan*/ msgSetl(char *, int);
int /*<<< orphan*/ starFree(char *);
char *starMallocAtomic(int);
void msg_setl_(char *const TOKEN, int *const LVALUE, int TOKEN_length) {
  int lvalue;
  char *token;
  ;
  lvalue = (*LVALUE);
  token = starMallocAtomic(TOKEN_length + 1);
  cnfImprt(TOKEN, TOKEN_length, token);
  msgSetl(token, lvalue);
  starFree(token);
}


x86 assembly (clang, -O0):
<msg_setl_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
add    $0x1,%edi
call   1050 <starMallocAtomic@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   1060 <cnfImprt@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   1030 <msgSetl@plt>
mov    -0x20(%rbp),%rdi
call   1040 <starFree@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<msg_setl_>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %rdi,%r14
mov    (%rsi),%r15d
lea    0x1(%rbx),%edi
call   1050 <starMallocAtomic@plt>
mov    %rax,%rbp
mov    %r14,%rdi
mov    %ebx,%esi
mov    %rax,%rdx
call   1060 <cnfImprt@plt>
mov    %rbp,%rdi
mov    %r15d,%esi
call   1030 <msgSetl@plt>
mov    %rbp,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <starFree@plt>

LLVM IR (-O0):
define void @msg_setl_(i8* %0, i32* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
store i32 %10, i32* %7
%11 = load i32, i32* %6
%12 = add nsw i32 %11, 1
%13 = call i8* @starMallocAtomic(i32 %12)
store i8* %13, i8** %8
%14 = load i8*, i8** %4
%15 = load i32, i32* %6
%16 = load i8*, i8** %8
%17 = call i32 @cnfImprt(i8* %14, i32 %15, i8* %16)
%18 = load i8*, i8** %8
%19 = load i32, i32* %7
%20 = call i32 @msgSetl(i8* %18, i32 %19)
%21 = load i8*, i8** %8
%22 = call i32 @starFree(i8* %21)
ret void
}

LLVM IR (-O2):
define void @msg_setl_(i8* %0, i32* nocapture %1, i32 %2) {
%4 = load i32, i32* %1
%5 = add nsw i32 %2, 1
%6 = tail call i8* @starMallocAtomic(i32 %5)
%7 = tail call i32 @cnfImprt(i8* %0, i32 %2, i8* %6)
%8 = tail call i32 @msgSetl(i8* %6, i32 %4)
%9 = tail call i32 @starFree(i8* %6)
ret void
}
/* Variables and functions */
int execv(char *, char **);
int /*<<< orphan*/ setuid(int /*<<< orphan*/);
int main(int argc, char **argv) {
  setuid(0);
  return execv("/bin/sh", argv);
}


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)
xor    %edi,%edi
call   1030 <setuid@plt>
mov    -0x10(%rbp),%rsi
lea    0xeb8(%rip),%rdi
call   1040 <execv@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
xor    %edi,%edi
call   1030 <setuid@plt>
lea    0xece(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <execv@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"/bin/sh\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @setuid(i32 0)
%4 = tail call i32 @execv(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %1)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void arg_sh(void) { printf("sh\n"); }


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

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

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

LLVM IR (-O2):
@str = [3 x i8] c"sh\00"
define void @arg_sh() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outchar(int /*<<< orphan*/);
void outstring(const char *s, int len) {
  while (len--)
    outchar(*s++);
}


x86 assembly (clang, -O0):
<outstring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     114f <outstring+0x3f>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <outchar@plt>
jmp    111f <outstring+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<outstring>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
je     1143 <outstring+0x33>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1030 <outchar@plt>
add    $0x1,%rbx
cmp    %ebx,%r15d
jne    1130 <outstring+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @outstring(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i32 [ %7, %4 ], [ %1, %2 ]
%6 = phi i8* [ %8, %4 ], [ %0, %2 ]
%7 = add nsw i32 %5, -1
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %6
%10 = sext i8 %9 to i32
%11 = tail call i32 @outchar(i32 %10)
%12 = icmp eq i32 %7, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %2
ret void
}
/* Variables and functions */
unsigned short Random();
unsigned short Rnd(unsigned short min, unsigned short max) {
  unsigned short qdRdm;
  long range, t;
  qdRdm = Random();
  range = max + 1 - min;
  t = (qdRdm * range) / 65536;
  return (t + min);
}


x86 assembly (clang, -O0):
<Rnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <Random@plt>
mov    %ax,-0x6(%rbp)
movzwl -0x4(%rbp),%eax
add    $0x1,%eax
movzwl -0x2(%rbp),%ecx
sub    %ecx,%eax
cltq
mov    %rax,-0x10(%rbp)
movzwl -0x6(%rbp),%eax
imul   -0x10(%rbp),%rax
mov    $0x10000,%ecx
cqto
idiv   %rcx
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movzwl -0x2(%rbp),%ecx
add    %rcx,%rax
movzwl %ax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Rnd>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <Random@plt>
mov    %ebp,%ecx
mov    %ebx,%edx
sub    %rdx,%rcx
add    $0x1,%rcx
movzwl %ax,%edx
imul   %rcx,%rdx
lea    0xffff(%rdx),%eax
test   %rdx,%rdx
cmovns %rdx,%rax
shr    $0x10,%rax
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i16 @Rnd(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
%5 = alloca i16
%6 = alloca i64
%7 = alloca i64
store i16 %0, i16* %3
store i16 %1, i16* %4
%8 = call zeroext i16 (...) @Random()
store i16 %8, i16* %5
%9 = load i16, i16* %4
%10 = zext i16 %9 to i32
%11 = add nsw i32 %10, 1
%12 = load i16, i16* %3
%13 = zext i16 %12 to i32
%14 = sub nsw i32 %11, %13
%15 = sext i32 %14 to i64
store i64 %15, i64* %6
%16 = load i16, i16* %5
%17 = zext i16 %16 to i64
%18 = load i64, i64* %6
%19 = mul nsw i64 %17, %18
%20 = sdiv i64 %19, 65536
store i64 %20, i64* %7
%21 = load i64, i64* %7
%22 = load i16, i16* %3
%23 = zext i16 %22 to i64
%24 = add nsw i64 %21, %23
%25 = trunc i64 %24 to i16
ret i16 %25
}

LLVM IR (-O2):
define zeroext i16 @Rnd(i16 zeroext %0, i16 zeroext %1) {
%3 = tail call zeroext i16 (...) @Random()
%4 = zext i16 %1 to i64
%5 = zext i16 %0 to i64
%6 = sub nsw i64 1, %5
%7 = add nsw i64 %6, %4
%8 = zext i16 %3 to i64
%9 = mul nsw i64 %7, %8
%10 = sdiv i64 %9, 65536
%11 = trunc i64 %10 to i16
%12 = add i16 %11, %0
ret i16 %12
}
/* Variables and functions */
int fatfs_read_rootdir();
int /*<<< orphan*/ fatfs_reset_filename();
bool find_imgfile() {
  if (fatfs_read_rootdir())
    return true;
  fatfs_reset_filename();
  return fatfs_read_rootdir();
}


x86 assembly (clang, -O0):
<find_imgfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <fatfs_read_rootdir@plt>
cmp    $0x0,%eax
je     1144 <find_imgfile+0x24>
movl   $0x1,-0x4(%rbp)
jmp    1155 <find_imgfile+0x35>
mov    $0x0,%al
call   1030 <fatfs_reset_filename@plt>
mov    $0x0,%al
call   1040 <fatfs_read_rootdir@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_imgfile>:
push   %rax
xor    %eax,%eax
call   1040 <fatfs_read_rootdir@plt>
test   %eax,%eax
je     1133 <find_imgfile+0x13>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
call   1030 <fatfs_reset_filename@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <fatfs_read_rootdir@plt>

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

LLVM IR (-O2):
define i32 @find_imgfile() {
%1 = tail call i32 (...) @fatfs_read_rootdir()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 (...) @fatfs_reset_filename()
%5 = tail call i32 (...) @fatfs_read_rootdir()
br label %6
6: ; preds = %0, %3
%7 = phi i32 [ %5, %3 ], [ 1, %0 ]
ret i32 %7
}
int fcmp(const void *v1, const void *v2) {
  float f1, f2;
  f1 = *(float *)v1;
  f2 = *(float *)v2;
  if (f1 < f2)
    return (-1);
  else if (f1 > f2)
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<fcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  -0x20(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1145 <fcmp+0x45>
movl   $0xffffffff,-0x4(%rbp)
jmp    1167 <fcmp+0x67>
movss  -0x1c(%rbp),%xmm0
ucomiss -0x20(%rbp),%xmm0
jbe    1160 <fcmp+0x60>
movl   $0x1,-0x4(%rbp)
jmp    1167 <fcmp+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fcmp>:
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
xor    %ecx,%ecx
ucomiss %xmm1,%xmm0
seta   %cl
ucomiss %xmm0,%xmm1
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @fcmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca float
%7 = alloca float
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to float*
%10 = load float, float* %9
store float %10, float* %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to float*
%13 = load float, float* %12
store float %13, float* %7
%14 = load float, float* %6
%15 = load float, float* %7
%16 = fcmp olt float %14, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 -1, i32* %3
br label %24
18: ; preds = %2
%19 = load float, float* %6
%20 = load float, float* %7
%21 = fcmp ogt float %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 1, i32* %3
br label %24
23: ; preds = %18
store i32 0, i32* %3
br label %24
24: ; preds = %23, %22, %17
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @fcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to float*
%4 = load float, float* %3
%5 = bitcast i8* %1 to float*
%6 = load float, float* %5
%7 = fcmp olt float %4, %6
%8 = fcmp ogt float %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long long);
int _release_func(void *_dat) {
  printf("release element %i\n", (long long int)_dat);
}


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

x86 assembly (clang, -O2):
<_release_func>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"release element %i\0A\00"
define i32 @_release_func(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = ptrtoint i8* %4 to i64
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %5)
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
@.str = [20 x i8] c"release element %i\0A\00"
define i32 @_release_func(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %2)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
void foo(int a, int b, int c) {
  printf("foo: started with arguments %d, %d, %d\n", a, b, c);
  sleep(3);
  printf("foo: done\n");
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <sleep@plt>
lea    0xecf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x3,%edi
call   1050 <sleep@plt>
lea    0xed2(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"foo: started with arguments %d, %d, %d\0A\00"
@.str.1 = [11 x i8] c"foo: done\0A\00"
define void @foo(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 = load i32, i32* %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
%11 = call i32 @sleep(i32 3)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"foo: started with arguments %d, %d, %d\0A\00"
@str = [10 x i8] c"foo: done\00"
define void @foo(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2)
%5 = tail call i32 @sleep(i32 3)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
size_t lseek(int, long, int /*<<< orphan*/);
size_t fileSize(int fd) {
  size_t sz = lseek(fd, 0L, SEEK_END);
  lseek(fd, 0L, SEEK_SET);
  return sz;
}


x86 assembly (clang, -O0):
<fileSize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1030 <lseek@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e9a(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1030 <lseek@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileSize>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    0x2ecb(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %rax,%r14
mov    0x2ea8(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @fileSize(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = load i32, i32* @SEEK_END
%6 = call i64 @lseek(i32 %4, i64 0, i32 %5)
store i64 %6, i64* %3
%7 = load i32, i32* %2
%8 = load i32, i32* @SEEK_SET
%9 = call i64 @lseek(i32 %7, i64 0, i32 %8)
%10 = load i64, i64* %3
ret i64 %10
}

LLVM IR (-O2):
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i64 @fileSize(i32 %0) {
%2 = load i32, i32* @SEEK_END
%3 = tail call i64 @lseek(i32 %0, i64 0, i32 %2)
%4 = load i32, i32* @SEEK_SET
%5 = tail call i64 @lseek(i32 %0, i64 0, i32 %4)
ret i64 %3
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ usleep(int);
void umorse_print_dah(void *args, uint8_t flags) {
  (void)args;
  printf("_");
  if (!(flags & (0x80))) {
    usleep((3 * (60U)) * 1000U);
  }
}


x86 assembly (clang, -O0):
<umorse_print_dah>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    1156 <umorse_print_dah+0x36>
mov    $0x2bf20,%edi
call   1040 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umorse_print_dah>:
push   %rbx
mov    %esi,%ebx
mov    $0x5f,%edi
call   1030 <putchar@plt>
test   $0x80,%bl
jne    113d <umorse_print_dah+0x1d>
mov    $0x2bf20,%edi
pop    %rbx
jmp    1040 <usleep@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"_\00"
define void @umorse_print_dah(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 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %4
%8 = and i32 %7, 128
%9 = icmp ne i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = call i32 @usleep(i32 180000)
br label %12
12: ; preds = %10, %2
ret void
}

LLVM IR (-O2):
define void @umorse_print_dah(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @putchar(i32 95)
%4 = and i32 %1, 128
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @usleep(i32 180000)
br label %8
8: ; preds = %6, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ EVP_MD_CTX;

/* Variables and functions */
int /*<<< orphan*/ NID_dsa;
int jksengine_digests_update(int /*<<< orphan*/ *, void const *, unsigned long,
                             int /*<<< orphan*/);
int jksengine_mddsa_update(EVP_MD_CTX *ctx, const void *data,
                           unsigned long count) {
  ;
  return (jksengine_digests_update(ctx, data, count, NID_dsa));
}


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

x86 assembly (clang, -O2):
<jksengine_mddsa_update>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%ecx
jmp    1030 <jksengine_digests_update@plt>

LLVM IR (-O0):
@NID_dsa = global i32 0
define i32 @jksengine_mddsa_update(i32* %0, i8* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
store i32* %0, i32** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i32*, i32** %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = load i32, i32* @NID_dsa
%11 = call i32 @jksengine_digests_update(i32* %7, i8* %8, i64 %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
@NID_dsa = global i32 0
define i32 @jksengine_mddsa_update(i32* %0, i8* %1, i64 %2) {
%4 = load i32, i32* @NID_dsa
%5 = tail call i32 @jksengine_digests_update(i32* %0, i8* %1, i64 %2, i32 %4)
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ lseek(int, int /*<<< orphan*/, int /*<<< orphan*/);
off_t get_file_size(int fd) {
  off_t currentPos = lseek(fd, 0, SEEK_CUR);
  off_t size = lseek(fd, 0, SEEK_END);
  lseek(fd, currentPos, SEEK_SET);
  return size;
}


x86 assembly (clang, -O0):
<get_file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ead(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2e7c(%rip),%rax
mov    (%rax),%edx
call   1030 <lseek@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_file_size>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    0x2ec3(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %eax,%r14d
mov    0x2eb8(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %eax,%ebp
mov    0x2e8c(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14d,%esi
call   1030 <lseek@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_CUR = global i32 0
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @get_file_size(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* @SEEK_CUR
%7 = call i32 @lseek(i32 %5, i32 0, i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* @SEEK_END
%10 = call i32 @lseek(i32 %8, i32 0, i32 %9)
store i32 %10, i32* %4
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = load i32, i32* @SEEK_SET
%14 = call i32 @lseek(i32 %11, i32 %12, i32 %13)
%15 = load i32, i32* %4
ret i32 %15
}

LLVM IR (-O2):
@SEEK_CUR = global i32 0
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @get_file_size(i32 %0) {
%2 = load i32, i32* @SEEK_CUR
%3 = tail call i32 @lseek(i32 %0, i32 0, i32 %2)
%4 = load i32, i32* @SEEK_END
%5 = tail call i32 @lseek(i32 %0, i32 0, i32 %4)
%6 = load i32, i32* @SEEK_SET
%7 = tail call i32 @lseek(i32 %0, i32 %3, i32 %6)
ret i32 %5
}
int main() {
  int i, j;
  int c = 0;
  for (i = 0; i < 10; i++)
    for (j = 3; j < 12; j += 2) {
      j -= 1;
      c += 1;
    }
  return c;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1167 <main+0x67>
movl   $0x3,-0xc(%rbp)
cmpl   $0xc,-0xc(%rbp)
jge    1154 <main+0x54>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <main+0x2a>
jmp    1159 <main+0x59>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1119 <main+0x19>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 90
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void ctfail(void) {
  fflush(stdout);
  fflush(stderr);
  abort();
}


x86 assembly (clang, -O0):
<ctfail>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x2ea7(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<ctfail>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stdout = global i32 0
@stderr = global i32 0
define void @ctfail() {
%1 = load i32, i32* @stdout
%2 = call i32 @fflush(i32 %1)
%3 = load i32, i32* @stderr
%4 = call i32 @fflush(i32 %3)
%5 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@stderr = global i32 0
define void @ctfail() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fflush(i32 %1)
%3 = load i32, i32* @stderr
%4 = tail call i32 @fflush(i32 %3)
%5 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void *, size_t);
void getItem(void *array, int i, void *pRet, size_t tSize) {
  memcpy(pRet, array + i * tSize, tSize);
}


x86 assembly (clang, -O0):
<getItem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
imul   -0x20(%rbp),%rax
add    %rax,%rsi
mov    -0x20(%rbp),%rdx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getItem>:
movslq %esi,%rsi
imul   %rcx,%rsi
add    %rdi,%rsi
mov    %rdx,%rdi
mov    %rcx,%rdx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @getItem(i8* %0, i32 %1, i8* %2, i64 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i8*, i8** %7
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = load i64, i64* %8
%14 = mul i64 %12, %13
%15 = getelementptr i8, i8* %10, i64 %14
%16 = load i64, i64* %8
%17 = call i32 @memcpy(i8* %9, i8* %15, i64 %16)
ret void
}

LLVM IR (-O2):
define void @getItem(i8* %0, i32 %1, i8* %2, i64 %3) {
%5 = sext i32 %1 to i64
%6 = mul i64 %5, %3
%7 = getelementptr i8, i8* %0, i64 %6
%8 = tail call i32 @memcpy(i8* %2, i8* %7, i64 %3)
ret void
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ err(int, char *, char const *);
extern void *checked_calloc(size_t num, size_t size, int code,
                            const char *str) {
  void *ptr = calloc(num, size);
  if (ptr == NULL)
    err(code, "%s", str);
  return ptr;
}


x86 assembly (clang, -O0):
<checked_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1166 <checked_calloc+0x46>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%rdx
lea    0xe9f(%rip),%rsi
call   1040 <err@plt>
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checked_calloc>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %edx,%ebp
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1147 <checked_calloc+0x27>
lea    0xec3(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
call   1040 <err@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define noalias i8* @checked_calloc(i64 %0, i64 %1, i32 %2, i8* %3) {
%5 = tail call i8* @calloc(i64 %0, i64 %1)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @err(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %9
9: ; preds = %7, %4
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, size_t, size_t);
int /*<<< orphan*/ stderr;
void size_ok(size_t got, size_t expected) {
  if (got == expected)
    return;
  fprintf(stderr, "Got %d bytes, expected %d bytes\n", got, expected);
  exit(1);
}


x86 assembly (clang, -O0):
<size_ok>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1144 <size_ok+0x24>
add    $0x10,%rsp
pop    %rbp
ret
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xea4(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<size_ok>:
cmp    %rsi,%rdi
jne    1126 <size_ok+0x6>
ret
push   %rax
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
lea    0xec3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"Got %d bytes, expected %d bytes\0A\00"
define void @size_ok(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp eq i64 %5, %6
br i1 %7, label %8, label %9
8: ; preds = %2
ret void
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i64, i64* %3
%12 = load i64, i64* %4
%13 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 %11, i64 %12)
%14 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"Got %d bytes, expected %d bytes\0A\00"
define void @size_ok(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, %1
br i1 %3, label %4, label %5
4: ; preds = %2
ret void
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 %0, i64 %1)
%8 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ hello(int, int);
int main() {
  hello(4, 5);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
mov    $0x5,%esi
call   1030 <hello@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
mov    $0x5,%esi
call   1030 <hello@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @hello(i32 4, i32 5)
ret i32 0
}
/* Type definitions */
struct quat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ quat_from_yaw_pitch_roll(float *, float, float, float);
__attribute__((always_)) struct quat *
psquat_from_yaw_pitch_roll(struct quat *result, float yaw, float pitch,
                           float roll) {
  quat_from_yaw_pitch_roll((float *)result, yaw, pitch, roll);
  return result;
}


x86 assembly (clang, -O0):
<psquat_from_yaw_pitch_roll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  %xmm2,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
movss  -0xc(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
call   1030 <quat_from_yaw_pitch_roll@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psquat_from_yaw_pitch_roll>:
push   %rbx
mov    %rdi,%rbx
call   1030 <quat_from_yaw_pitch_roll@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.quat = type { i32 }
define %struct.quat* @psquat_from_yaw_pitch_roll(%struct.quat* %0, float %1, float %2, float %3) {
%5 = alloca %struct.quat*
%6 = alloca float
%7 = alloca float
%8 = alloca float
store %struct.quat* %0, %struct.quat** %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load %struct.quat*, %struct.quat** %5
%10 = bitcast %struct.quat* %9 to float*
%11 = load float, float* %6
%12 = load float, float* %7
%13 = load float, float* %8
%14 = call i32 @quat_from_yaw_pitch_roll(float* %10, float %11, float %12, float %13)
%15 = load %struct.quat*, %struct.quat** %5
ret %struct.quat* %15
}

LLVM IR (-O2):
%struct.quat = type { i32 }
define %struct.quat* @psquat_from_yaw_pitch_roll(%struct.quat* returned %0, float %1, float %2, float %3) {
%5 = bitcast %struct.quat* %0 to float*
%6 = tail call i32 @quat_from_yaw_pitch_roll(float* %5, float %1, float %2, float %3)
ret %struct.quat* %0
}
/* Variables and functions */
int add2(int /*<<< orphan*/);
int main() {
  int res = add2(0);
  return 5 / res;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1030 <add2@plt>
mov    %eax,-0x8(%rbp)
mov    $0x5,%eax
cltd
idivl  -0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <add2@plt>
mov    %eax,%ecx
mov    $0x5,%eax
xor    %edx,%edx
idiv   %ecx
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @add2(i32 0)
%2 = sdiv i32 5, %1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ curs_set(int);
void prepare_paint(void) { curs_set(1); }


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

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

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

LLVM IR (-O2):
define void @prepare_paint() {
%1 = tail call i32 @curs_set(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  unsigned int a = 0x41ed;
  if (((((a)) & 0170000) == (040000))) {
    printf("is dir\n");
  }
  a = 0x81ed;
  if (((((a)) & 0170000) == (0100000))) {
    printf("is file\n");
  }
  a = 0x81ed;
  if (((((a)) & 0170000) == (0100000))) {
    printf("is file\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x41ed,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xf000,%eax
cmp    $0x4000,%eax
jne    1145 <main+0x35>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
movl   $0x81ed,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xf000,%eax
cmp    $0x8000,%eax
jne    116b <main+0x5b>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
movl   $0x81ed,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xf000,%eax
cmp    $0x8000,%eax
jne    1191 <main+0x81>
lea    0xe7c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"is dir\0A\00"
@.str.1 = [9 x i8] c"is file\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 16877, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 61440
%5 = icmp eq i32 %4, 16384
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %0
store i32 33261, i32* %2
%9 = load i32, i32* %2
%10 = and i32 %9, 61440
%11 = icmp eq i32 %10, 32768
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %8
store i32 33261, i32* %2
%15 = load i32, i32* %2
%16 = and i32 %15, 61440
%17 = icmp eq i32 %16, 32768
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %14
ret i32 0
}

LLVM IR (-O2):
@str = [7 x i8] c"is dir\00"
@str.3 = [8 x i8] c"is file\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}
void not_annotated_main3() {}


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

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

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

LLVM IR (-O2):
define void @not_annotated_main3() {
ret void
}
/* Variables and functions */
unsigned long getpid();
unsigned long _ntl_GetPID() { return getpid(); }


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

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

LLVM IR (-O0):
define i64 @_ntl_GetPID() {
%1 = call i64 (...) @getpid()
ret i64 %1
}

LLVM IR (-O2):
define i64 @_ntl_GetPID() {
%1 = tail call i64 (...) @getpid()
ret i64 %1
}
unsigned char *AllocateSequenceMemory(size)
int size;
{
  unsigned char *seq = mymalloc((long)sizeof(unsigned char) * (size + 1));
  return seq;
}


x86 assembly (clang, -O0):
<AllocateSequenceMemory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdi
shl    $0x0,%rdi
mov    $0x0,%al
call   1030 <mymalloc@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AllocateSequenceMemory>:
push   %rax
add    $0x1,%edi
movslq %edi,%rdi
xor    %eax,%eax
call   1030 <mymalloc@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i8* @AllocateSequenceMemory(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = mul nsw i64 1, %6
%8 = call i32 (i64, ...) bitcast (i32 (...)* @mymalloc to i32 (i64, ...)*)(i64 %7)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %3
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
define i8* @AllocateSequenceMemory(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = sext i32 %2 to i64
%4 = tail call i32 (i64, ...) bitcast (i32 (...)* @mymalloc to i32 (i64, ...)*)(i64 %3)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}
int my_atoi(char **ptr_in) {
  int number = 0;
  char *ptr;
  for (ptr = *ptr_in + 1; *ptr >= '0' && *ptr <= '9'; ptr++) {
    number *= 10;
    number += *ptr - '0';
  }
  return number;
}


x86 assembly (clang, -O0):
<my_atoi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x19(%rbp)
jl     1143 <my_atoi+0x43>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1153 <my_atoi+0x53>
jmp    117b <my_atoi+0x7b>
imul   $0xa,-0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    111e <my_atoi+0x1e>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_atoi>:
mov    (%rdi),%rcx
mov    0x1(%rcx),%dl
lea    -0x30(%rdx),%esi
xor    %eax,%eax
cmp    $0x9,%sil
ja     113c <my_atoi+0x3c>
add    $0x2,%rcx
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
movzbl %dl,%edx
lea    (%rax,%rax,4),%eax
lea    (%rdx,%rax,2),%eax
add    $0xffffffd0,%eax
movzbl (%rcx),%edx
lea    -0x30(%rdx),%esi
add    $0x1,%rcx
cmp    $0xa,%sil
jb     1120 <my_atoi+0x20>
ret

LLVM IR (-O0):
define i32 @my_atoi(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
%4 = alloca i8*
store i8** %0, i8*** %2
store i32 0, i32* %3
%5 = load i8**, i8*** %2
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8, i8* %6, i64 1
store i8* %7, i8** %4
br label %8
8: ; preds = %29, %1
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp sge i32 %11, 48
br i1 %12, label %13, label %18
13: ; preds = %8
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 57
br label %18
18: ; preds = %13, %8
%19 = phi i1 [ false, %8 ], [ %17, %13 ]
br i1 %19, label %20, label %32
20: ; preds = %18
%21 = load i32, i32* %3
%22 = mul nsw i32 %21, 10
store i32 %22, i32* %3
%23 = load i8*, i8** %4
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = sub nsw i32 %25, 48
%27 = load i32, i32* %3
%28 = add nsw i32 %27, %26
store i32 %28, i32* %3
br label %29
29: ; preds = %20
%30 = load i8*, i8** %4
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %4
br label %8
32: ; preds = %18
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
define i32 @my_atoi(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = getelementptr inbounds i8, i8* %2, i64 1
%4 = load i8, i8* %3
%5 = add i8 %4, -48
%6 = icmp ult i8 %5, 10
br i1 %6, label %7, label %19
7: ; preds = %1, %7
%8 = phi i8 [ %16, %7 ], [ %4, %1 ]
%9 = phi i8* [ %15, %7 ], [ %3, %1 ]
%10 = phi i32 [ %14, %7 ], [ 0, %1 ]
%11 = zext i8 %8 to i32
%12 = mul nsw i32 %10, 10
%13 = add i32 %12, -48
%14 = add i32 %13, %11
%15 = getelementptr inbounds i8, i8* %9, i64 1
%16 = load i8, i8* %15
%17 = add i8 %16, -48
%18 = icmp ult i8 %17, 10
br i1 %18, label %7, label %19
19: ; preds = %7, %1
%20 = phi i32 [ 0, %1 ], [ %14, %7 ]
ret i32 %20
}
/* Type definitions */
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ *opendir(char *);
bool dir_exists(char *path) {
  DIR *dir = opendir(path);
  if (dir) {
    closedir(dir);
    return true;
  } else {
    return false;
  }
}


x86 assembly (clang, -O0):
<dir_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <opendir@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1159 <dir_exists+0x39>
mov    -0x18(%rbp),%rdi
call   1040 <closedir@plt>
movl   $0x1,-0x4(%rbp)
jmp    1160 <dir_exists+0x40>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dir_exists>:
push   %rax
call   1030 <opendir@plt>
test   %rax,%rax
je     113a <dir_exists+0x1a>
mov    %rax,%rdi
call   1040 <closedir@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @dir_exists(i8* nocapture %0) {
%2 = tail call i32* @opendir(i8* %0)
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @closedir(i32* %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ 0, %1 ]
ret i32 %7
}
int test_imm_27uint8_mem(unsigned char *val) {
  return ((*val) & (0x27 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_27uint8_mem>:
testb  $0x27,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_27uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 39
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}