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

/* Variables and functions */
scalar_t__ pthread_create(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          void *(*)(void *), void *);
scalar_t__ pthread_detach(int /*<<< orphan*/);
int lw_thread_start(void (*func)(void *), void *args) {
  pthread_t thread;
  int result = 0;
  if (pthread_create(&thread, NULL, (void *(*)(void *))func, args) == 0) {
    if (pthread_detach(thread) == 0) {
      result = 1;
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<lw_thread_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <pthread_create@plt>
cmp    $0x0,%rax
jne    1174 <lw_thread_start+0x54>
mov    -0x14(%rbp),%edi
call   1030 <pthread_detach@plt>
cmp    $0x0,%rax
jne    116f <lw_thread_start+0x4f>
movl   $0x1,-0x18(%rbp)
jmp    1174 <lw_thread_start+0x54>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lw_thread_start>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rcx
mov    %rdi,%rdx
xor    %ebx,%ebx
lea    0xc(%rsp),%rdi
xor    %esi,%esi
call   1040 <pthread_create@plt>
test   %rax,%rax
jne    114f <lw_thread_start+0x2f>
mov    0xc(%rsp),%edi
call   1030 <pthread_detach@plt>
xor    %ebx,%ebx
test   %rax,%rax
sete   %bl
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @lw_thread_start(void (i8*)* %0, i8* %1) {
%3 = alloca void (i8*)*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store void (i8*)* %0, void (i8*)** %3
store i8* %1, i8** %4
store i32 0, i32* %6
%7 = load void (i8*)*, void (i8*)** %3
%8 = bitcast void (i8*)* %7 to i8* (i8*)*
%9 = load i8*, i8** %4
%10 = call i64 @pthread_create(i32* %5, i32* null, i8* (i8*)* %8, i8* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* %5
%14 = call i64 @pthread_detach(i32 %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 1, i32* %6
br label %17
17: ; preds = %16, %12
br label %18
18: ; preds = %17, %2
%19 = load i32, i32* %6
ret i32 %19
}

LLVM IR (-O2):
define i32 @lw_thread_start(void (i8*)* %0, i8* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = bitcast void (i8*)* %0 to i8* (i8*)*
%6 = call i64 @pthread_create(i32* %3, i32* null, i8* (i8*)* %5, i8* %1)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* %3
%10 = call i64 @pthread_detach(i32 %9)
%11 = icmp eq i64 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %8, %2
%14 = phi i32 [ 0, %2 ], [ %12, %8 ]
ret i32 %14
}
/* Variables and functions */
scalar_t__ foo();
int main(void) {
  int a = 0, b = 0, i;
  for (i = 0; i < 100; i++) {
    a += foo();
    b += foo();
  }
  return a + b;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x64,-0x10(%rbp)
jge    1174 <main+0x64>
mov    $0x0,%al
call   1030 <foo@plt>
mov    %rax,%rcx
movslq -0x8(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <foo@plt>
mov    %rax,%rcx
movslq -0xc(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <main+0x24>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0x64,%r14d
xor    %ebx,%ebx
xor    %ebp,%ebp
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <foo@plt>
add    %eax,%ebp
xor    %eax,%eax
call   1030 <foo@plt>
add    %eax,%ebx
add    $0xffffffff,%r14d
jne    1120 <main+0x10>
add    %ebp,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
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* %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %19, %0
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 100
br i1 %7, label %8, label %22
8: ; preds = %5
%9 = call i64 (...) @foo()
%10 = load i32, i32* %2
%11 = sext i32 %10 to i64
%12 = add nsw i64 %11, %9
%13 = trunc i64 %12 to i32
store i32 %13, i32* %2
%14 = call i64 (...) @foo()
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = add nsw i64 %16, %14
%18 = trunc i64 %17 to i32
store i32 %18, i32* %3
br label %19
19: ; preds = %8
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 1
store i32 %21, i32* %4
br label %5
22: ; preds = %5
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = add nsw i32 %23, %24
ret i32 %25
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %11, %1 ]
%3 = phi i32 [ 0, %0 ], [ %10, %1 ]
%4 = phi i32 [ 0, %0 ], [ %7, %1 ]
%5 = tail call i64 (...) @foo()
%6 = trunc i64 %5 to i32
%7 = add i32 %4, %6
%8 = tail call i64 (...) @foo()
%9 = trunc i64 %8 to i32
%10 = add i32 %3, %9
%11 = add nuw nsw i32 %2, 1
%12 = icmp eq i32 %11, 100
br i1 %12, label %13, label %1
13: ; preds = %1
%14 = add nsw i32 %10, %7
ret i32 %14
}
int cmp_float(const void *vp, const void *vq) {
  float diff = *(float *)vp - *(float *)vq;
  return ((diff >= 0.0) ? ((diff > 0.0) ? +1 : 0) : -1);
}


x86 assembly (clang, -O0):
<cmp_float>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subss  (%rax),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1159 <cmp_float+0x59>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
xor    %eax,%eax
mov    $0x1,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x18(%rbp)
jmp    1166 <cmp_float+0x66>
mov    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1166 <cmp_float+0x66>
mov    -0x18(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @cmp_float(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca float
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to float*
%8 = load float, float* %7
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to float*
%11 = load float, float* %10
%12 = fsub float %8, %11
store float %12, float* %5
%13 = load float, float* %5
%14 = fpext float %13 to double
%15 = fcmp oge double %14, 0.000000e+00
br i1 %15, label %16, label %22
16: ; preds = %2
%17 = load float, float* %5
%18 = fpext float %17 to double
%19 = fcmp ogt double %18, 0.000000e+00
%20 = zext i1 %19 to i64
%21 = select i1 %19, i32 1, i32 0
br label %23
22: ; preds = %2
br label %23
23: ; preds = %22, %16
%24 = phi i32 [ %21, %16 ], [ -1, %22 ]
ret i32 %24
}

LLVM IR (-O2):
define i32 @cmp_float(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 = fsub float %4, %6
%8 = fcmp ult float %7, 0.000000e+00
%9 = fcmp ogt float %7, 0.000000e+00
%10 = zext i1 %9 to i32
%11 = select i1 %8, i32 -1, i32 %10
ret i32 %11
}
int strLen(char str[]) {
  int i;
  for (i = 0; str[i] != '\0'; i++) {
  }
  return i;
}


x86 assembly (clang, -O0):
<strLen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1137 <strLen+0x37>
jmp    1129 <strLen+0x29>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strLen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strLen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <strLen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strLen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
void __attribute__((always_))
__initialize_bss(unsigned int *section_begin, unsigned int *section_end) {
  unsigned int *p = section_begin;
  while (p < section_end)
    *p++ = 0;
}


x86 assembly (clang, -O0):
<__initialize_bss>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    113c <__initialize_bss+0x3c>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
movl   $0x0,(%rax)
jmp    1114 <__initialize_bss+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__initialize_bss>:
cmp    %rsi,%rdi
jae    113e <__initialize_bss+0x2e>
push   %rax
lea    0x4(%rdi),%rax
cmp    %rax,%rsi
cmova  %rsi,%rax
mov    %rdi,%rcx
not    %rcx
lea    (%rax,%rcx,1),%rdx
add    $0x4,%rdx
and    $0xfffffffffffffffc,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define void @__initialize_bss(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
store i32* %6, i32** %5
br label %7
7: ; preds = %11, %2
%8 = load i32*, i32** %5
%9 = load i32*, i32** %4
%10 = icmp ult i32* %8, %9
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = load i32*, i32** %5
%13 = getelementptr inbounds i32, i32* %12, i32 1
store i32* %13, i32** %5
store i32 0, i32* %12
br label %7
14: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @__initialize_bss(i32* writeonly %0, i32* readnone %1) {
%3 = ptrtoint i32* %0 to i64
%4 = icmp ult i32* %0, %1
br i1 %4, label %5, label %14
5: ; preds = %2
%6 = ptrtoint i32* %1 to i64
%7 = bitcast i32* %0 to i8*
%8 = add i64 %3, 4
%9 = call i64 @llvm.umax.i64(i64 %6, i64 %8)
%10 = xor i64 %3, -1
%11 = add i64 %9, %10
%12 = add i64 %11, 4
%13 = and i64 %12, -4
br label %14
14: ; preds = %5, %2
ret void
}
/* Variables and functions */
scalar_t__ isspace(int);
char *skip_space(char *str) {
  char *p;
  for (p = str; p != NULL && isspace((int)*p); p++)
    ;
  return p;
}


x86 assembly (clang, -O0):
<skip_space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     114a <skip_space+0x3a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    115a <skip_space+0x4a>
jmp    1170 <skip_space+0x60>
jmp    115f <skip_space+0x4f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <skip_space+0x14>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_space>:
push   %rbx
test   %rdi,%rdi
je     1134 <skip_space+0x24>
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   (%rax)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    1120 <skip_space+0x10>
jmp    1136 <skip_space+0x26>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @skip_space(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i8* [ %9, %3 ], [ %0, %1 ]
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = tail call i64 @isspace(i32 %6)
%8 = icmp eq i64 %7, 0
%9 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %8, label %10, label %3
10: ; preds = %3, %1
%11 = phi i8* [ null, %1 ], [ %4, %3 ]
ret i8* %11
}
int __test_and_set_bit(int nr, volatile unsigned long *addr) {
  unsigned long mask = (1UL << ((nr) % ((int)sizeof(unsigned long) * 8)));
  unsigned long *p =
      ((unsigned long *)addr) + ((nr) / ((int)sizeof(unsigned long) * 8));
  unsigned long old = *p;
  *p = old | mask;
  return (old & mask) != 0;
}


x86 assembly (clang, -O0):
<__test_and_set_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x30(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rcx
or     -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
and    -0x18(%rbp),%rax
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__test_and_set_bit>:
lea    0x3f(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
mov    %eax,%ecx
and    $0xffffffc0,%ecx
sub    %ecx,%edi
sar    $0x6,%eax
cltq
mov    (%rsi,%rax,8),%rcx
mov    %rcx,%rdx
bts    %rdi,%rdx
mov    %rdx,(%rsi,%rax,8)
xor    %eax,%eax
bt     %rdi,%rcx
setb   %al
ret

LLVM IR (-O0):
define i32 @__test_and_set_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64*
%7 = alloca i64
store i32 %0, i32* %3
store i64* %1, i64** %4
%8 = load i32, i32* %3
%9 = srem i32 %8, 64
%10 = zext i32 %9 to i64
%11 = shl i64 1, %10
store i64 %11, i64* %5
%12 = load i64*, i64** %4
%13 = load i32, i32* %3
%14 = sdiv i32 %13, 64
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i64, i64* %12, i64 %15
store i64* %16, i64** %6
%17 = load i64*, i64** %6
%18 = load i64, i64* %17
store i64 %18, i64* %7
%19 = load i64, i64* %7
%20 = load i64, i64* %5
%21 = or i64 %19, %20
%22 = load i64*, i64** %6
store i64 %21, i64* %22
%23 = load i64, i64* %7
%24 = load i64, i64* %5
%25 = and i64 %23, %24
%26 = icmp ne i64 %25, 0
%27 = zext i1 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
define i32 @__test_and_set_bit(i32 %0, i64* nocapture %1) {
%3 = srem i32 %0, 64
%4 = zext i32 %3 to i64
%5 = shl nuw i64 1, %4
%6 = sdiv i32 %0, 64
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i64, i64* %1, i64 %7
%9 = load i64, i64* %8
%10 = or i64 %9, %5
store i64 %10, i64* %8
%11 = and i64 %9, %5
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ handler_not_implemented(char *);
void defaultDataAbortHandler() {
  handler_not_implemented("DATA_ABORT_HANDLER");
}


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"DATA_ABORT_HANDLER\00"
define void @defaultDataAbortHandler() {
%1 = call i32 @handler_not_implemented(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"DATA_ABORT_HANDLER\00"
define void @defaultDataAbortHandler() {
%1 = tail call i32 @handler_not_implemented(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *strrchr(char const *, char);
char *__gnu_basename(const char *path) {
  char *p;
  if ((p = strrchr(path, '/')))
    return p + 1;
  return (char *)path;
}


x86 assembly (clang, -O0):
<__gnu_basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1149 <__gnu_basename+0x39>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1151 <__gnu_basename+0x41>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__gnu_basename>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @__gnu_basename(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
void ccc() {}


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

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

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

LLVM IR (-O2):
define void @ccc() {
ret void
}
int TransStste(int x, int y, int size) { return x * size + y; }


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

x86 assembly (clang, -O2):
<TransStste>:
imul   %edx,%edi
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @TransStste(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* %6
%9 = mul nsw i32 %7, %8
%10 = load i32, i32* %5
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @TransStste(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %2, %0
%5 = add nsw i32 %4, %1
ret i32 %5
}
/* Variables and functions */
int two_sensor_read(char *, int *, int *);
int get_motor_encoders(int *leftenc, int *rightenc) {
  int result;
  result = two_sensor_read("MELR", leftenc, rightenc);
  if (result < 0)
    return result;
  return 0;
}


x86 assembly (clang, -O0):
<get_motor_encoders>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xed1(%rip),%rdi
call   1030 <two_sensor_read@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    114c <get_motor_encoders+0x3c>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <get_motor_encoders+0x43>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_motor_encoders>:
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee2(%rip),%rdi
call   1030 <two_sensor_read@plt>
mov    %eax,%ecx
sar    $0x1f,%ecx
and    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"MELR\00"
define i32 @get_motor_encoders(i32* %0, i32* %1) {
%3 = tail call i32 @two_sensor_read(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %0, i32* %1)
%4 = icmp slt i32 %3, 0
%5 = select i1 %4, i32 %3, i32 0
ret i32 %5
}
/* Type definitions */
struct timespec {
  int tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ nanosleep(struct timespec *, int /*<<< orphan*/ *);
void nut_sleep_milliseconds(int millis) {
  struct timespec ts;
  ts.tv_sec = 0;
  ts.tv_nsec = millis * 1000000;
  nanosleep(&ts, NULL);
}


x86 assembly (clang, -O0):
<nut_sleep_milliseconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
imul   $0xf4240,-0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <nanosleep@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nut_sleep_milliseconds>:
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
imul   $0xf4240,%edi,%eax
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <nanosleep@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
define void @nut_sleep_milliseconds(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timespec
store i32 %0, i32* %2
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i64 0, i64* %4
%5 = load i32, i32* %2
%6 = mul nsw i32 %5, 1000000
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
store i32 %6, i32* %7
%8 = call i32 @nanosleep(%struct.timespec* %3, i32* null)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
define void @nut_sleep_milliseconds(i32 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i64 0, i64* %4
%5 = mul nsw i32 %0, 1000000
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i32 %5, i32* %6
%7 = call i32 @nanosleep(%struct.timespec* %2, i32* null)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
void testResult(int status) {
  if (status > 0)
    printf("found at %d\n", status);
  else
    puts("not found");
}


x86 assembly (clang, -O0):
<testResult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1149 <testResult+0x29>
mov    -0x4(%rbp),%esi
lea    0xec1(%rip),%rdi
call   1040 <printf@plt>
jmp    1155 <testResult+0x35>
lea    0xebd(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testResult>:
test   %edi,%edi
jle    1132 <testResult+0x12>
mov    %edi,%esi
lea    0xed3(%rip),%rdi
jmp    1040 <printf@plt>
lea    0xed4(%rip),%rdi
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"found at %d\0A\00"
@.str.1 = [10 x i8] c"not found\00"
define void @testResult(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %7
5: ; preds = %1
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %3
ret void
}
/* Variables and functions */
double sin(double);
double sinc(double x) {
  if (x > (-0.001) && x < (0.001)) {
    return 1;
  }
  double y = sin(3.141593 * x);
  y /= 3.141593 * x;
  return y;
}


x86 assembly (clang, -O0):
<sinc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1159 <sinc+0x49>
movsd  0xecc(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1159 <sinc+0x49>
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1195 <sinc+0x85>
movsd  0xeaf(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xe98(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinc>:
push   %rax
ucomisd 0xee7(%rip),%xmm0
jbe    1133 <sinc+0x23>
movsd  0xeed(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1133 <sinc+0x23>
movsd  0xed7(%rip),%xmm0
pop    %rax
ret
mulsd  0xedd(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1030 <sin@plt>
divsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @sinc(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %3
%5 = load double, double* %3
%6 = fcmp ogt double %5, -1.000000e-03
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load double, double* %3
%9 = fcmp olt double %8, 1.000000e-03
br i1 %9, label %10, label %11
10: ; preds = %7
store double 1.000000e+00, double* %2
br label %20
11: ; preds = %7, %1
%12 = load double, double* %3
%13 = fmul double 0x400921FB82C2BD7F, %12
%14 = call double @sin(double %13)
store double %14, double* %4
%15 = load double, double* %3
%16 = fmul double 0x400921FB82C2BD7F, %15
%17 = load double, double* %4
%18 = fdiv double %17, %16
store double %18, double* %4
%19 = load double, double* %4
store double %19, double* %2
br label %20
20: ; preds = %11, %10
%21 = load double, double* %2
ret double %21
}

LLVM IR (-O2):
define double @sinc(double %0) {
%2 = fcmp ogt double %0, -1.000000e-03
%3 = fcmp olt double %0, 1.000000e-03
%4 = and i1 %2, %3
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = fmul double %0, 0x400921FB82C2BD7F
%7 = tail call double @sin(double %6)
%8 = fdiv double %7, %6
br label %9
9: ; preds = %1, %5
%10 = phi double [ %8, %5 ], [ 1.000000e+00, %1 ]
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
void *func(void *fd) {
  printf("write fd = %d\n", *(int *)fd);
  char str[] = "hello everyone!";
  write(*(int *)fd, str, strlen(str));
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xeb7(%rip),%rdi
call   1050 <printf@plt>
mov    0xebb(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb8(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
mov    (%rdi),%esi
lea    0xebd(%rip),%rdi
call   1050 <printf@plt>
movaps 0xec1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    (%rbx),%ebx
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1030 <write@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [15 x i8] c"write fd = %d\0A\00"
@__const.func.str = [16 x i8] c"hello everyone!\00"
define i8* @func(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca [16 x i8]
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = bitcast [16 x i8]* %4 to i8*
%10 = load i8*, i8** %3
%11 = bitcast i8* %10 to i32*
%12 = load i32, i32* %11
%13 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%15 = call i32 @strlen(i8* %14)
%16 = call i32 @write(i32 %12, i8* %13, i32 %15)
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@.str = [15 x i8] c"write fd = %d\0A\00"
@__const.func.str = [16 x i8] c"hello everyone!\00"
define noalias i8* @func(i8* nocapture %0) {
%2 = alloca [16 x i8]
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* %3
%8 = call i32 @strlen(i8* %6)
%9 = call i32 @write(i32 %7, i8* %6, i32 %8)
ret i8* undef
}
/* Variables and functions */
int /*<<< orphan*/ fatal(char *);
char *malloc(scalar_t__);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *strDup(char const *str) {
  char *copy = malloc(strlen(str) + 1);
  if (!copy) {
    fatal("strdup failed");
  }
  strcpy(copy, str);
  return copy;
}


x86 assembly (clang, -O0):
<strDup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    117c <strDup+0x3c>
lea    0xe89(%rip),%rdi
call   1060 <fatal@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strDup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1169 <strDup+0x29>
lea    0xe9c(%rip),%rdi
call   1060 <fatal@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"strdup failed\00"
define i8* @strDup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %1
%11 = call i32 @fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@.str = [14 x i8] c"strdup failed\00"
define i8* @strDup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @fatal(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
int isLtParExpRex(char ch) { return (ch == '['); }


x86 assembly (clang, -O0):
<isLtParExpRex>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x5b,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLtParExpRex>:
xor    %eax,%eax
cmp    $0x5b,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @isLtParExpRex(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 91
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @isLtParExpRex(i8 signext %0) {
%2 = icmp eq i8 %0, 91
%3 = zext i1 %2 to i32
ret i32 %3
}
float lawofcosines2(float a, float b, float c) {
  return (b * b + c * c - a * a) / (2 * b * c);
}


x86 assembly (clang, -O0):
<lawofcosines2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x8(%rbp),%xmm2
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x4(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xeaa(%rip),%xmm1
mulss  -0x8(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<lawofcosines2>:
movaps %xmm1,%xmm3
addss  %xmm1,%xmm1
mulss  %xmm2,%xmm1
mulss  %xmm2,%xmm2
mulss  %xmm3,%xmm3
addss  %xmm2,%xmm3
mulss  %xmm0,%xmm0
subss  %xmm0,%xmm3
divss  %xmm1,%xmm3
movaps %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @lawofcosines2(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %5
%8 = load float, float* %5
%9 = load float, float* %6
%10 = load float, float* %6
%11 = fmul float %9, %10
%12 = call float @llvm.fmuladd.f32(float %7, float %8, float %11)
%13 = load float, float* %4
%14 = load float, float* %4
%15 = fneg float %13
%16 = call float @llvm.fmuladd.f32(float %15, float %14, float %12)
%17 = load float, float* %5
%18 = fmul float 2.000000e+00, %17
%19 = load float, float* %6
%20 = fmul float %18, %19
%21 = fdiv float %16, %20
ret float %21
}

LLVM IR (-O2):
define float @lawofcosines2(float %0, float %1, float %2) {
%4 = fmul float %2, %2
%5 = tail call float @llvm.fmuladd.f32(float %1, float %1, float %4)
%6 = fneg float %0
%7 = tail call float @llvm.fmuladd.f32(float %6, float %0, float %5)
%8 = fmul float %1, 2.000000e+00
%9 = fmul float %8, %2
%10 = fdiv float %7, %9
ret float %10
}
/* Variables and functions */
int /*<<< orphan*/ puti(long);
void putiu(unsigned long int x) { puti((signed long int)x); }


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

x86 assembly (clang, -O2):
<putiu>:
jmp    1030 <puti@plt>

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

LLVM IR (-O2):
define void @putiu(i64 %0) {
%2 = tail call i32 @puti(i64 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void show_help() {
  printf("=== Myfs Manager ===\n"
         "Command List:\n"
         "make\tformat\tdestroy\tmount\n"
         "umount\texit\tcreate\tdelete\n"
         "open\twrite\tread\tpush\n"
         "pull\tlist\tseek\thelp\n");
}


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

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

LLVM IR (-O0):
@.str = [129 x i8] c"=== Myfs Manager ===\0ACommand List:\0Amake\09format\09destroy\09mount\0Aumount\09exit\09create\09delete\0Aopen\09write\09read\09push\0Apull\09list\09seek\09help\0A\00"
define void @show_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([129 x i8], [129 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [128 x i8] c"=== Myfs Manager ===\0ACommand List:\0Amake\09format\09destroy\09mount\0Aumount\09exit\09create\09delete\0Aopen\09write\09read\09push\0Apull\09list\09seek\09help\00"
define void @show_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([128 x i8], [128 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int my_openpty(int *, int *);
int /*<<< orphan*/ stderr;
int my_forkpty(int *ptm, int *pts) {
  if ((my_openpty(ptm, pts)) == -1) {
    fprintf(stderr, "Error: my_openpty() failure\n");
    return (-1);
  }
  return (fork());
}


x86 assembly (clang, -O0):
<my_forkpty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <my_openpty@plt>
cmp    $0xffffffff,%eax
jne    1177 <my_forkpty+0x47>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1181 <my_forkpty+0x51>
mov    $0x0,%al
call   1050 <fork@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_forkpty>:
push   %rax
call   1030 <my_openpty@plt>
cmp    $0xffffffff,%eax
je     1143 <my_forkpty+0x13>
xor    %eax,%eax
pop    %rcx
jmp    1050 <fork@plt>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
lea    0xead(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [29 x i8] c"Error: my_openpty() failure\0A\00"
define i32 @my_forkpty(i32* %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
%6 = load i32*, i32** %4
%7 = load i32*, i32** %5
%8 = call i32 @my_openpty(i32* %6, i32* %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %15
13: ; preds = %2
%14 = call i32 (...) @fork()
store i32 %14, i32* %3
br label %15
15: ; preds = %13, %10
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"Error: my_openpty() failure\0A\00"
define i32 @my_forkpty(i32* %0, i32* %1) {
%3 = tail call i32 @my_openpty(i32* %0, i32* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %10
8: ; preds = %2
%9 = tail call i32 (...) @fork()
br label %10
10: ; preds = %8, %5
%11 = phi i32 [ -1, %5 ], [ %9, %8 ]
ret i32 %11
}
/* Variables and functions */
size_t strncat_s(char *, size_t, char const *, int);
size_t strcat_s(char *strDestination, size_t numberOfElements,
                const char *strSource) {
  return strncat_s(strDestination, numberOfElements, strSource, -1);
}


x86 assembly (clang, -O0):
<strcat_s>:
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    $0xffffffff,%ecx
call   1030 <strncat_s@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat_s>:
mov    $0xffffffff,%ecx
jmp    1030 <strncat_s@plt>

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

LLVM IR (-O2):
define i64 @strcat_s(i8* %0, i64 %1, i8* %2) {
%4 = tail call i64 @strncat_s(i8* %0, i64 %1, i8* %2, i32 -1)
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ foo(int *);
int main() {
  int i = 0;
  foo(&i);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <foo@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @foo(i32* %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __afl_manual_init();
scalar_t__ getenv(char *);
__attribute__((constructor(0))) void __afl_auto_init(void) {
  if (getenv("AFL_DEFER_FORKSRV"))
    return;
  __afl_manual_init();
}


x86 assembly (clang, -O0):
<__afl_auto_init>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     113f <__afl_auto_init+0x1f>
jmp    1146 <__afl_auto_init+0x26>
mov    $0x0,%al
call   1040 <__afl_manual_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__afl_auto_init>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1134 <__afl_auto_init+0x14>
pop    %rax
ret
xor    %eax,%eax
pop    %rcx
jmp    1040 <__afl_manual_init@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"AFL_DEFER_FORKSRV\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__afl_auto_init, i8* null }]
define void @__afl_auto_init() {
%1 = call i64 @getenv(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %4
3: ; preds = %0
br label %6
4: ; preds = %0
%5 = call i32 (...) @__afl_manual_init()
br label %6
6: ; preds = %4, %3
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"AFL_DEFER_FORKSRV\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @__afl_auto_init, i8* null }]
define void @__afl_auto_init() {
%1 = tail call i64 @getenv(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @__afl_manual_init()
br label %5
5: ; preds = %0, %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
int pthread_mutex_destroy(int /*<<< orphan*/ *);
void Thread_destroy_mutex(pthread_mutex_t *mutex) {
  int rc = 0;
  ;
  rc = pthread_mutex_destroy(mutex);
  free(mutex);
  ;
}


x86 assembly (clang, -O0):
<Thread_destroy_mutex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <pthread_mutex_destroy@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Thread_destroy_mutex>:
push   %rbx
mov    %rdi,%rbx
call   1040 <pthread_mutex_destroy@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @Thread_destroy_mutex(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
%4 = load i32*, i32** %2
%5 = call i32 @pthread_mutex_destroy(i32* %4)
store i32 %5, i32* %3
%6 = load i32*, i32** %2
%7 = call i32 @free(i32* %6)
ret void
}

LLVM IR (-O2):
define void @Thread_destroy_mutex(i32* %0) {
%2 = tail call i32 @pthread_mutex_destroy(i32* %0)
%3 = tail call i32 @free(i32* %0)
ret void
}
int clamp_pixel(int pixel, int min, int max) {
  if (pixel > max) {
    pixel = max;
  } else if (pixel < min) {
    pixel = min;
  }
  return pixel;
}


x86 assembly (clang, -O0):
<clamp_pixel>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1124 <clamp_pixel+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113b <clamp_pixel+0x3b>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1136 <clamp_pixel+0x36>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    113b <clamp_pixel+0x3b>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @clamp_pixel(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* %6
%9 = icmp sgt i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load i32, i32* %6
store i32 %11, i32* %4
br label %19
12: ; preds = %3
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load i32, i32* %5
store i32 %17, i32* %4
br label %18
18: ; preds = %16, %12
br label %19
19: ; preds = %18, %10
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
define i32 @clamp_pixel(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %2
%5 = icmp slt i32 %0, %1
%6 = select i1 %5, i32 %1, i32 %0
%7 = select i1 %4, i32 %2, i32 %6
ret i32 %7
}
/* Type definitions */
struct py_field {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ py_leapfrog(struct py_field *);
void py_timestep_leapfrog(struct py_field *f, double Nt) {
  for (long n = 0; n < Nt; ++n)
    py_leapfrog(f);
}


x86 assembly (clang, -O0):
<py_timestep_leapfrog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
cvtsi2sdq -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1158 <py_timestep_leapfrog+0x48>
mov    -0x8(%rbp),%rdi
call   1030 <py_leapfrog@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1129 <py_timestep_leapfrog+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<py_timestep_leapfrog>:
push   %r14
push   %rbx
push   %rax
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    114f <py_timestep_leapfrog+0x3f>
mov    %rdi,%r14
mov    $0x1,%ebx
movsd  %xmm0,(%rsp)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <py_leapfrog@plt>
movsd  (%rsp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %rbx,%xmm1
add    $0x1,%rbx
ucomisd %xmm1,%xmm0
ja     1130 <py_timestep_leapfrog+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.py_field = type { i32 }
define void @py_timestep_leapfrog(%struct.py_field* %0, double %1) {
%3 = alloca %struct.py_field*
%4 = alloca double
%5 = alloca i64
store %struct.py_field* %0, %struct.py_field** %3
store double %1, double* %4
store i64 0, i64* %5
br label %6
6: ; preds = %14, %2
%7 = load i64, i64* %5
%8 = sitofp i64 %7 to double
%9 = load double, double* %4
%10 = fcmp olt double %8, %9
br i1 %10, label %11, label %17
11: ; preds = %6
%12 = load %struct.py_field*, %struct.py_field** %3
%13 = call i32 @py_leapfrog(%struct.py_field* %12)
br label %14
14: ; preds = %11
%15 = load i64, i64* %5
%16 = add nsw i64 %15, 1
store i64 %16, i64* %5
br label %6
17: ; preds = %6
ret void
}

LLVM IR (-O2):
%struct.py_field = type { i32 }
define void @py_timestep_leapfrog(%struct.py_field* %0, double %1) {
%3 = fcmp ogt double %1, 0.000000e+00
br i1 %3, label %5, label %4
4: ; preds = %5, %2
ret void
5: ; preds = %2, %5
%6 = phi i64 [ %8, %5 ], [ 0, %2 ]
%7 = tail call i32 @py_leapfrog(%struct.py_field* %0)
%8 = add nuw nsw i64 %6, 1
%9 = sitofp i64 %8 to double
%10 = fcmp olt double %9, %1
br i1 %10, label %5, label %4
}
void fadeStrobeInit() {}


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

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

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

LLVM IR (-O2):
define void @fadeStrobeInit() {
ret void
}