xunge/DecIR huggingface dataset:
char *my_strcpy(const char *src, char *dest) {
  int i;
  i = 0;
  while (src[i]) {
    dest[i] = src[i];
    i++;
  }
  dest[i] = '\0';
  return (dest);
}


x86 assembly (clang, -O0):
<my_strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1149 <my_strcpy+0x49>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <my_strcpy+0x13>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strcpy>:
mov    %rsi,%rax
mov    (%rdi),%cl
test   %cl,%cl
je     1127 <my_strcpy+0x27>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rax,%rdx,1)
movzbl 0x1(%rdi,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <my_strcpy+0x10>
mov    %edx,%ecx
movb   $0x0,(%rax,%rcx,1)
ret
xor    %ecx,%ecx
movb   $0x0,(%rax,%rcx,1)
ret

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

LLVM IR (-O2):
define i8* @my_strcpy(i8* nocapture %0, i8* returned writeonly %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %9, %5 ], [ 0, %2 ]
%7 = phi i8 [ %11, %5 ], [ %3, %2 ]
%8 = getelementptr inbounds i8, i8* %1, i64 %6
store i8 %7, i8* %8
%9 = add nuw nsw i64 %6, 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5
%14 = and i64 %9, 4294967295
br label %15
15: ; preds = %13, %2
%16 = phi i64 [ 0, %2 ], [ %14, %13 ]
%17 = getelementptr inbounds i8, i8* %1, i64 %16
store i8 0, i8* %17
ret i8* %1
}
void g_date_valid() {}


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

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

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

LLVM IR (-O2):
define void @g_date_valid() {
ret void
}
/* Variables and functions */
scalar_t__ __builtin_j1f(float);
int /*<<< orphan*/ link_failure_builtin_j1f();
void test_builtin_j1f(float f) {
  if (__builtin_j1f(f) != __builtin_j1f(f))
    link_failure_builtin_j1f();
}


x86 assembly (clang, -O0):
<test_builtin_j1f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <__builtin_j1f@plt>
mov    %rax,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <__builtin_j1f@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     115c <test_builtin_j1f+0x3c>
mov    $0x0,%al
call   1030 <link_failure_builtin_j1f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_builtin_j1f>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
call   1040 <__builtin_j1f@plt>
mov    %rax,%rbx
movss  0xc(%rsp),%xmm0
call   1040 <__builtin_j1f@plt>
cmp    %rax,%rbx
jne    1149 <test_builtin_j1f+0x29>
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1030 <link_failure_builtin_j1f@plt>

LLVM IR (-O0):
define void @test_builtin_j1f(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i64 @__builtin_j1f(float %3)
%5 = load float, float* %2
%6 = call i64 @__builtin_j1f(float %5)
%7 = icmp ne i64 %4, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @link_failure_builtin_j1f()
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
define void @test_builtin_j1f(float %0) {
%2 = tail call i64 @__builtin_j1f(float %0)
%3 = tail call i64 @__builtin_j1f(float %0)
%4 = icmp eq i64 %2, %3
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @link_failure_builtin_j1f()
br label %7
7: ; preds = %5, %1
ret void
}
/* Variables and functions */
int ptrArraySortCompareVar(void *const, void *const);
int ptrArraySortCompare(const void *a0, const void *b0) {
  void *const *a = (void *const *)a0;
  void *const *b = (void *const *)b0;
  return ptrArraySortCompareVar(*a, *b);
}


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

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

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

LLVM IR (-O2):
define i32 @ptrArraySortCompare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = tail call i32 @ptrArraySortCompareVar(i8* %5, i8* %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ PrintError(char *);
void *malloc(size_t);
void *realloc(void *, size_t);
void *Realloc(void *ptr, size_t amt) {
  ptr = (ptr == NULL) ? malloc(amt) : realloc(ptr, amt);
  if (ptr != NULL)
    return (ptr);
  PrintError("Error: unable to allocate space.\n");
}


x86 assembly (clang, -O0):
<Realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115d <Realloc+0x2d>
mov    -0x18(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
jmp    116e <Realloc+0x3e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     118e <Realloc+0x5e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    119a <Realloc+0x6a>
lea    0xe6b(%rip),%rdi
call   1050 <PrintError@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Realloc>:
push   %rbx
test   %rdi,%rdi
je     113d <Realloc+0xd>
call   1040 <realloc@plt>
jmp    1145 <Realloc+0x15>
mov    %rsi,%rdi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1159 <Realloc+0x29>
lea    0xeac(%rip),%rdi
call   1050 <PrintError@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Error: unable to allocate space.\0A\00"
define i8* @Realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
%6 = load i8*, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i64, i64* %5
%10 = call i8* @malloc(i64 %9)
br label %15
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = load i64, i64* %5
%14 = call i8* @realloc(i8* %12, i64 %13)
br label %15
15: ; preds = %11, %8
%16 = phi i8* [ %10, %8 ], [ %14, %11 ]
store i8* %16, i8** %4
%17 = load i8*, i8** %4
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = load i8*, i8** %4
store i8* %20, i8** %3
br label %23
21: ; preds = %15
%22 = call i32 @PrintError(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
%24 = load i8*, i8** %3
ret i8* %24
}

LLVM IR (-O2):
@.str = [34 x i8] c"Error: unable to allocate space.\0A\00"
define i8* @Realloc(i8* %0, i64 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i8* @malloc(i64 %1)
br label %8
6: ; preds = %2
%7 = tail call i8* @realloc(i8* %0, i64 %1)
br label %8
8: ; preds = %6, %4
%9 = phi i8* [ %5, %4 ], [ %7, %6 ]
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @PrintError(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %8, %11
ret i8* %9
}
/* Variables and functions */
int max(int, int);
int maxOverlap(int, int);
int minOverlap(int a, int b, int N) {
  int x = (maxOverlap(a, b) - (N - max(a, b)));
  return x;
}


x86 assembly (clang, -O0):
<minOverlap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <maxOverlap@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <max@plt>
mov    -0x18(%rbp),%ecx
mov    %eax,%edx
mov    -0x14(%rbp),%eax
sub    %edx,%ecx
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<minOverlap>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %esi,%r15d
mov    %edi,%ebx
call   1040 <maxOverlap@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    %r15d,%esi
call   1030 <max@plt>
sub    %r14d,%ebp
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @minOverlap(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call i32 @maxOverlap(i32 %8, i32 %9)
%11 = load i32, i32* %6
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = call i32 @max(i32 %12, i32 %13)
%15 = sub nsw i32 %11, %14
%16 = sub nsw i32 %10, %15
store i32 %16, i32* %7
%17 = load i32, i32* %7
ret i32 %17
}

LLVM IR (-O2):
define i32 @minOverlap(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @maxOverlap(i32 %0, i32 %1)
%5 = tail call i32 @max(i32 %0, i32 %1)
%6 = sub i32 %4, %2
%7 = add i32 %6, %5
ret i32 %7
}
long cSunMiscSignal_atomicCompareAndSwap_long(volatile long *const ptr,
                                              long const oldval,
                                              long const newval) {
  return __sync_val_compare_and_swap(ptr, oldval, newval);
}


x86 assembly (clang, -O0):
<cSunMiscSignal_atomicCompareAndSwap_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rdx
lock cmpxchg %rdx,(%rcx)
sete   %cl
pop    %rbp
ret

x86 assembly (clang, -O2):
<cSunMiscSignal_atomicCompareAndSwap_long>:
mov    %rsi,%rax
lock cmpxchg %rdx,(%rdi)
ret

LLVM IR (-O0):
define i64 @cSunMiscSignal_atomicCompareAndSwap_long(i64* %0, i64 %1, i64 %2) {
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64
store i64* %0, i64** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64*, i64** %4
%8 = load i64, i64* %5
%9 = load i64, i64* %6
%10 = cmpxchg i64* %7, i64 %8, i64 %9 seq_cst seq_cst
%11 = extractvalue { i64, i1 } %10, 0
ret i64 %11
}

LLVM IR (-O2):
define i64 @cSunMiscSignal_atomicCompareAndSwap_long(i64* nocapture %0, i64 %1, i64 %2) {
%4 = cmpxchg i64* %0, i64 %1, i64 %2 seq_cst seq_cst
%5 = extractvalue { i64, i1 } %4, 0
ret i64 %5
}
void Dao_GetErrorDLL() {}


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

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

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

LLVM IR (-O2):
define void @Dao_GetErrorDLL() {
ret void
}
int vec4(int x[]) { return x[0] + x[1] + x[2] + x[3]; }


x86 assembly (clang, -O0):
<vec4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x8(%rbp),%rcx
add    0x4(%rcx),%eax
mov    -0x8(%rbp),%rcx
add    0x8(%rcx),%eax
mov    -0x8(%rbp),%rcx
add    0xc(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec4>:
movdqu (%rdi),%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @vec4(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 1
%8 = load i32, i32* %7
%9 = add nsw i32 %5, %8
%10 = load i32*, i32** %2
%11 = getelementptr inbounds i32, i32* %10, i64 2
%12 = load i32, i32* %11
%13 = add nsw i32 %9, %12
%14 = load i32*, i32** %2
%15 = getelementptr inbounds i32, i32* %14, i64 3
%16 = load i32, i32* %15
%17 = add nsw i32 %13, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @vec4(i32* nocapture %0) {
%2 = bitcast i32* %0 to <4 x i32>*
%3 = load <4 x i32>, <4 x i32>* %2
%4 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ insort_index(double *, int *, int);
int /*<<< orphan*/ partial_quickersort_index(double *, int *,
                                             int /*<<< orphan*/, int);
void sedgesort_index(double *a, int *index, int len) {
  partial_quickersort_index(a, index, 0, len - 1);
  insort_index(a, index, len);
}


x86 assembly (clang, -O0):
<sedgesort_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
xor    %edx,%edx
call   1040 <partial_quickersort_index@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <insort_index@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sedgesort_index>:
push   %r15
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbx
lea    -0x1(%r14),%ecx
xor    %edx,%edx
call   1040 <partial_quickersort_index@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <insort_index@plt>

LLVM IR (-O0):
define void @sedgesort_index(double* %0, i32* %1, i32 %2) {
%4 = alloca double*
%5 = alloca i32*
%6 = alloca i32
store double* %0, double** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load double*, double** %4
%8 = load i32*, i32** %5
%9 = load i32, i32* %6
%10 = sub nsw i32 %9, 1
%11 = call i32 @partial_quickersort_index(double* %7, i32* %8, i32 0, i32 %10)
%12 = load double*, double** %4
%13 = load i32*, i32** %5
%14 = load i32, i32* %6
%15 = call i32 @insort_index(double* %12, i32* %13, i32 %14)
ret void
}

LLVM IR (-O2):
define void @sedgesort_index(double* %0, i32* %1, i32 %2) {
%4 = add nsw i32 %2, -1
%5 = tail call i32 @partial_quickersort_index(double* %0, i32* %1, i32 0, i32 %4)
%6 = tail call i32 @insort_index(double* %0, i32* %1, i32 %2)
ret void
}
int ft_toupper(int c) {
  if (c >= 'a' && c <= 'z')
    c -= 32;
  return (c);
}


x86 assembly (clang, -O0):
<ft_toupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x61,-0x4(%rbp)
jl     1124 <ft_toupper+0x24>
cmpl   $0x7a,-0x4(%rbp)
jg     1124 <ft_toupper+0x24>
mov    -0x4(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_toupper>:
lea    -0x61(%rdi),%ecx
lea    -0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

LLVM IR (-O0):
define i32 @ft_toupper(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 97
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 122
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sub nsw i32 %9, 32
store i32 %10, i32* %2
br label %11
11: ; preds = %8, %5, %1
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @ft_toupper(i32 %0) {
%2 = add i32 %0, -97
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Variables and functions */
char *ext_split(char *, size_t, char const *, char, int /*<<< orphan*/);
char *filename_body(char *buffer, size_t buflen, const char *pattern) {
  return (ext_split(buffer, buflen, pattern, '.', 0));
}


x86 assembly (clang, -O0):
<filename_body>:
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    $0x2e,%ecx
xor    %r8d,%r8d
call   1030 <ext_split@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filename_body>:
mov    $0x2e,%ecx
xor    %r8d,%r8d
jmp    1030 <ext_split@plt>

LLVM IR (-O0):
define i8* @filename_body(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 i8* @ext_split(i8* %7, i64 %8, i8* %9, i8 signext 46, i32 0)
ret i8* %10
}

LLVM IR (-O2):
define i8* @filename_body(i8* %0, i64 %1, i8* %2) {
%4 = tail call i8* @ext_split(i8* %0, i64 %1, i8* %2, i8 signext 46, i32 0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void mem_free(void *ptr) {
  if (ptr)
    free(ptr);
}


x86 assembly (clang, -O0):
<mem_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <mem_free+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_free>:
test   %rdi,%rdi
je     111a <mem_free+0xa>
jmp    1030 <free@plt>
ret

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

LLVM IR (-O2):
define void @mem_free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int SIG_BLOCK;
int SIG_SETMASK;
int SIG_UNBLOCK;
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int sigprocmask(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int test(void) {
  int how;
  sigset_t set;
  sigset_t oset;
  int result;
  how = SIG_BLOCK;
  how = SIG_UNBLOCK;
  how = SIG_SETMASK;
  (void)sigemptyset(&set);
  result = sigprocmask(how, &set, &oset);
  return result;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    0x2e99(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <sigemptyset@plt>
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1030 <sigprocmask@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %r14
push   %rbx
push   %rax
mov    0x2ebd(%rip),%rax
mov    (%rax),%ebx
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1040 <sigemptyset@plt>
mov    %rsp,%rdx
mov    %ebx,%edi
mov    %r14,%rsi
call   1030 <sigprocmask@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SIG_BLOCK = global i32 0
@SIG_UNBLOCK = global i32 0
@SIG_SETMASK = global i32 0
define i32 @test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = load i32, i32* @SIG_BLOCK
store i32 %5, i32* %1
%6 = load i32, i32* @SIG_UNBLOCK
store i32 %6, i32* %1
%7 = load i32, i32* @SIG_SETMASK
store i32 %7, i32* %1
%8 = call i32 @sigemptyset(i32* %2)
%9 = load i32, i32* %1
%10 = call i32 @sigprocmask(i32 %9, i32* %2, i32* %3)
store i32 %10, i32* %4
%11 = load i32, i32* %4
ret i32 %11
}

LLVM IR (-O2):
@SIG_BLOCK = global i32 0
@SIG_UNBLOCK = global i32 0
@SIG_SETMASK = global i32 0
define i32 @test() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = load i32, i32* @SIG_SETMASK
%6 = call i32 @sigemptyset(i32* %1)
%7 = call i32 @sigprocmask(i32 %5, i32* %1, i32* %2)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ EMLINK;
int _stub(int /*<<< orphan*/);
int __wrap_link(const char *old_name, const char *new_name) {
  return _stub(EMLINK);
}


x86 assembly (clang, -O0):
<__wrap_link>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
call   1030 <_stub@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__wrap_link>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <_stub@plt>

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

LLVM IR (-O2):
@EMLINK = global i32 0
define i32 @__wrap_link(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @EMLINK
%4 = tail call i32 @_stub(i32 %3)
ret i32 %4
}
/* Variables and functions */
int wr_test(char const *, int, int, int /*<<< orphan*/, int);
int test_wr_long_exist(const char *file) {
  return wr_test(file, 1024, 5, 0, 0777);
}


x86 assembly (clang, -O0):
<test_wr_long_exist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x400,%esi
mov    $0x5,%edx
xor    %ecx,%ecx
mov    $0x1ff,%r8d
call   1030 <wr_test@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_wr_long_exist>:
mov    $0x400,%esi
mov    $0x5,%edx
xor    %ecx,%ecx
mov    $0x1ff,%r8d
jmp    1030 <wr_test@plt>

LLVM IR (-O0):
define i32 @test_wr_long_exist(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @wr_test(i8* %3, i32 1024, i32 5, i32 0, i32 511)
ret i32 %4
}

LLVM IR (-O2):
define i32 @test_wr_long_exist(i8* %0) {
%2 = tail call i32 @wr_test(i8* %0, i32 1024, i32 5, i32 0, i32 511)
ret i32 %2
}
/* Variables and functions */
size_t _sl4_hash_func_int(const void *key) { return (size_t)(*(int *)key); }


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

x86 assembly (clang, -O2):
<_sl4_hash_func_int>:
movslq (%rdi),%rax
ret

LLVM IR (-O0):
define i64 @_sl4_hash_func_int(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load i32, i32* %4
%6 = sext i32 %5 to i64
ret i64 %6
}

LLVM IR (-O2):
define i64 @_sl4_hash_func_int(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
ret i64 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, void const *, int);
int /*<<< orphan*/ ntohl(int /*<<< orphan*/);
int32_t readInt32(const void *p) {
  int32_t v;
  memcpy(&v, p, 4);
  return ntohl(v);
}


x86 assembly (clang, -O0):
<readInt32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0xc(%rbp),%edi
call   1040 <ntohl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readInt32>:
push   %rax
mov    %rdi,%rsi
lea    0x4(%rsp),%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    0x4(%rsp),%edi
call   1040 <ntohl@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @readInt32(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @memcpy(i32* %2, i8* %0, i32 4)
%5 = load i32, i32* %2
%6 = call i32 @ntohl(i32 %5)
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef scalar_t__ uint16_t;
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int8_t readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length,
                 uint16_t *data) {
  int8_t count = 0;
  printf("ReadWords() not implemented\n");
  *data = 0;
  return count;
}


x86 assembly (clang, -O0):
<readWords>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readWords>:
push   %rbx
mov    %rcx,%rbx
lea    0xee5(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"ReadWords() not implemented\0A\00"
define i32 @readWords(i32 %0, i32 %1, i32 %2, i64* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64*
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i64* %3, i64** %8
store i32 0, i32* %9
%10 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%11 = load i64*, i64** %8
store i64 0, i64* %11
%12 = load i32, i32* %9
ret i32 %12
}

LLVM IR (-O2):
@str = [28 x i8] c"ReadWords() not implemented\00"
define i32 @readWords(i32 %0, i32 %1, i32 %2, i64* nocapture writeonly %3) {
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
store i64 0, i64* %3
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ finn_mat4_translate(float *, float *);
void finn_mat4_translate_xyz(float *mat, float x, float y, float z) {
  float vec[3] = {x, y, z};
  finn_mat4_translate(mat, vec);
}


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

x86 assembly (clang, -O2):
<finn_mat4_translate_xyz>:
sub    $0x18,%rsp
movss  %xmm0,0xc(%rsp)
movss  %xmm1,0x10(%rsp)
movss  %xmm2,0x14(%rsp)
lea    0xc(%rsp),%rsi
call   1030 <finn_mat4_translate@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @finn_mat4_translate_xyz(float* %0, float %1, float %2, float %3) {
%5 = alloca float*
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca [3 x float]
store float* %0, float** %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%10 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
%11 = load float, float* %6
store float %11, float* %10
%12 = getelementptr inbounds float, float* %10, i64 1
%13 = load float, float* %7
store float %13, float* %12
%14 = getelementptr inbounds float, float* %12, i64 1
%15 = load float, float* %8
store float %15, float* %14
%16 = load float*, float** %5
%17 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
%18 = call i32 @finn_mat4_translate(float* %16, float* %17)
ret void
}

LLVM IR (-O2):
define void @finn_mat4_translate_xyz(float* %0, float %1, float %2, float %3) {
%5 = alloca [3 x float]
%6 = bitcast [3 x float]* %5 to i8*
%7 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
store float %1, float* %7
%8 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 1
store float %2, float* %8
%9 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 2
store float %3, float* %9
%10 = call i32 @finn_mat4_translate(float* %0, float* %7)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ recv_byte();
int /*<<< orphan*/ send_byte(int);
uint8_t read_status(void) {
  send_byte(0x34);
  return recv_byte();
}


x86 assembly (clang, -O0):
<read_status>:
push   %rbp
mov    %rsp,%rbp
mov    $0x34,%edi
call   1040 <send_byte@plt>
mov    $0x0,%al
call   1030 <recv_byte@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_status>:
push   %rax
mov    $0x34,%edi
call   1040 <send_byte@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <recv_byte@plt>

LLVM IR (-O0):
define i32 @read_status() {
%1 = call i32 @send_byte(i32 52)
%2 = call i32 (...) @recv_byte()
ret i32 %2
}

LLVM IR (-O2):
define i32 @read_status() {
%1 = tail call i32 @send_byte(i32 52)
%2 = tail call i32 (...) @recv_byte()
ret i32 %2
}
struct servent *getservent() {
  anvil_syslog(0, "%s unimplemented\n", __FUNCTION__);
  while (1)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<getservent>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
lea    0xeee(%rip),%rdx
mov    $0x0,%al
call   1030 <anvil_syslog@plt>
jmp    112b <getservent+0x1b>

x86 assembly (clang, -O2):
<getservent>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0xef3(%rip),%rdx
xor    %edi,%edi
xor    %eax,%eax
call   1030 <anvil_syslog@plt>
nopl   0x0(%rax,%rax,1)
jmp    1130 <getservent+0x20>

LLVM IR (-O0):
%struct.servent = type opaque
@.str = [18 x i8] c"%s unimplemented\0A\00"
@__FUNCTION__.getservent = [11 x i8] c"getservent\00"
define %struct.servent* @getservent() {
%1 = call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @anvil_syslog to i32 (i32, i8*, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__FUNCTION__.getservent, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
%struct.servent = type opaque
@.str = [18 x i8] c"%s unimplemented\0A\00"
@__FUNCTION__.getservent = [11 x i8] c"getservent\00"
define %struct.servent* @getservent() {
%1 = tail call i32 (i32, i8*, i8*, ...) bitcast (i32 (...)* @anvil_syslog to i32 (i32, i8*, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__FUNCTION__.getservent, i64 0, i64 0))
br label %2
2: ; preds = %0, %2
br label %2
}
/* Type definitions */
typedef int /*<<< orphan*/ name;

/* Variables and functions */
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ lock_build(char const *, char *, int);
int /*<<< orphan*/ unlink(char *);
void closetty(const char *dev, int fd) {
  char name[256];
  close(fd);
  lock_build(dev, name, sizeof(name));
  unlink(name);
}


x86 assembly (clang, -O0):
<closetty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <close@plt>
mov    -0x8(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    $0x100,%edx
call   1050 <lock_build@plt>
lea    -0x110(%rbp),%rdi
call   1030 <unlink@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<closetty>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%rbx
mov    %esi,%edi
call   1040 <close@plt>
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x100,%edx
call   1050 <lock_build@plt>
mov    %r14,%rdi
call   1030 <unlink@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @closetty(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [256 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = call i32 @close(i32 %6)
%8 = load i8*, i8** %3
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%10 = call i32 @lock_build(i8* %8, i8* %9, i32 256)
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%12 = call i32 @unlink(i8* %11)
ret void
}

LLVM IR (-O2):
define void @closetty(i8* %0, i32 %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @close(i32 %1)
%6 = call i32 @lock_build(i8* %0, i8* %4, i32 256)
%7 = call i32 @unlink(i8* %4)
ret void
}
int diag_l0_dumb_getflags(struct diag_l0_device *dl0d __attribute__((unused))) {
  return 0x01 | 0x02 | 0x08 | 0x10;
}


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

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

LLVM IR (-O0):
%struct.diag_l0_device = type opaque
define i32 @diag_l0_dumb_getflags(%struct.diag_l0_device* %0) {
%2 = alloca %struct.diag_l0_device*
store %struct.diag_l0_device* %0, %struct.diag_l0_device** %2
ret i32 27
}

LLVM IR (-O2):
%struct.diag_l0_device = type opaque
define i32 @diag_l0_dumb_getflags(%struct.diag_l0_device* nocapture readnone %0) {
ret i32 27
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int int_input(void) {
  int temp_value = 0;
  scanf("%d", &temp_value);
  return temp_value;
}


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

x86 assembly (clang, -O2):
<int_input>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xee0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @int_input() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_bus_creds_has_effective_cap(void *c, int capability) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_bus_creds_has_effective_cap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
mov    0x2ecc(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_bus_creds_has_effective_cap>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_bus_creds_has_effective_cap(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_bus_creds_has_effective_cap(i8* nocapture readnone %0, i32 %1) {
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}
/* Variables and functions */
char *strtok(char *, char const *);
char *c_strtok(char *arg0, const char *arg1) { return strtok(arg0, arg1); }


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

x86 assembly (clang, -O2):
<c_strtok>:
jmp    1030 <strtok@plt>

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

LLVM IR (-O2):
define i8* @c_strtok(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strtok(i8* %0, i8* %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ assemble(char *, char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, const char **argv) {
  char *in = argv[1];
  char *out = argv[2];
  assemble(in, out);
  printf("\nDone!\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
mov    0x10(%rsi),%rsi
call   1040 <assemble@plt>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"\0ADone!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
store i8* %10, i8** %6
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 2
%13 = load i8*, i8** %12
store i8* %13, i8** %7
%14 = load i8*, i8** %6
%15 = load i8*, i8** %7
%16 = call i32 @assemble(i8* %14, i8* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [7 x i8] c"\0ADone!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8*, i8** %1, i64 2
%6 = load i8*, i8** %5
%7 = tail call i32 @assemble(i8* %4, i8* %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct timeval {
  int tv_sec;
  unsigned long long tv_usec;
};

/* Variables and functions */
unsigned long long tv_to_usec(const struct timeval *v) {
  return v->tv_sec * (1000 * 1000) + v->tv_usec;
}


x86 assembly (clang, -O0):
<tv_to_usec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   $0xf4240,(%rax),%eax
cltq
mov    -0x8(%rbp),%rcx
add    0x8(%rcx),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tv_to_usec>:
movslq (%rdi),%rax
imul   $0xf4240,%rax,%rax
add    0x8(%rdi),%rax
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i64 @tv_to_usec(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %2
%3 = load %struct.timeval*, %struct.timeval** %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = sext i32 %6 to i64
%8 = load %struct.timeval*, %struct.timeval** %2
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 1
%10 = load i64, i64* %9
%11 = add i64 %7, %10
ret i64 %11
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i64 @tv_to_usec(%struct.timeval* nocapture %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000000
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%7 = load i64, i64* %6
%8 = add i64 %7, %5
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ spawn(char *, char **);
int main() {
  char *arg_list[] = {"ls", "-l", "/", NULL};
  spawn("ls", arg_list);
  printf("done with main program\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2cca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0x2cc7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2cc4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0x2cc1(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x30(%rbp),%rsi
lea    0xe9a(%rip),%rdi
call   1040 <spawn@plt>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movaps 0x2ce5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0x2cc9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xebe(%rip),%rdi
mov    %rsp,%rsi
call   1040 <spawn@plt>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"ls\00"
@.str.1 = [3 x i8] c"-l\00"
@.str.2 = [2 x i8] c"/\00"
@__const.main.arg_list = [4 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* null]
@.str.3 = [24 x i8] c"done with main program\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8*]
store i32 0, i32* %1
%3 = bitcast [4 x i8*]* %2 to i8*
%4 = getelementptr inbounds [4 x i8*], [4 x i8*]* %2, i64 0, i64 0
%5 = call i32 @spawn(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"ls\00"
@.str.1 = [3 x i8] c"-l\00"
@.str.2 = [2 x i8] c"/\00"
@__const.main.arg_list = [4 x i8*] [i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i32 0, i32 0), i8* null]
@str = [23 x i8] c"done with main program\00"
define i32 @main() {
%1 = alloca [4 x i8*]
%2 = bitcast [4 x i8*]* %1 to i8*
%3 = getelementptr inbounds [4 x i8*], [4 x i8*]* %1, i64 0, i64 0
%4 = call i32 @spawn(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %3)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int SOCK_DGRAM;
int sock_dgram() { return SOCK_DGRAM; }


x86 assembly (clang, -O0):
<sock_dgram>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sock_dgram>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@SOCK_DGRAM = global i32 0
define i32 @sock_dgram() {
%1 = load i32, i32* @SOCK_DGRAM
ret i32 %1
}

LLVM IR (-O2):
@SOCK_DGRAM = global i32 0
define i32 @sock_dgram() {
%1 = load i32, i32* @SOCK_DGRAM
ret i32 %1
}
int lxc_caps_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @lxc_caps_init() {
ret i32 0
}
/* Variables and functions */
int read_char();
int tonum(int);
char read_hex() {
  int a = read_char();
  int b = read_char();
  return tonum(a) * 16 + tonum(b);
}


x86 assembly (clang, -O0):
<read_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <read_char@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <read_char@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <tonum@plt>
shl    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <tonum@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_hex>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <read_char@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <read_char@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <tonum@plt>
mov    %eax,%ebx
shl    $0x4,%ebx
mov    %ebp,%edi
call   1030 <tonum@plt>
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define signext i8 @read_hex() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @read_char()
store i32 %3, i32* %1
%4 = call i32 (...) @read_char()
store i32 %4, i32* %2
%5 = load i32, i32* %1
%6 = call i32 @tonum(i32 %5)
%7 = mul nsw i32 %6, 16
%8 = load i32, i32* %2
%9 = call i32 @tonum(i32 %8)
%10 = add nsw i32 %7, %9
%11 = trunc i32 %10 to i8
ret i8 %11
}

LLVM IR (-O2):
define signext i8 @read_hex() {
%1 = tail call i32 (...) @read_char()
%2 = tail call i32 (...) @read_char()
%3 = tail call i32 @tonum(i32 %1)
%4 = shl nsw i32 %3, 4
%5 = tail call i32 @tonum(i32 %2)
%6 = add nsw i32 %4, %5
%7 = trunc i32 %6 to i8
ret i8 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int x, y;
  x = 2;
  y = 3;
  if ((x > 1) && (y < 6)) {
    printf("true");
  }
  if ((x == 2) || (y == 2)) {
    printf("true");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    114d <main+0x3d>
cmpl   $0x6,-0xc(%rbp)
jge    114d <main+0x3d>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
je     1161 <main+0x51>
cmpl   $0x2,-0xc(%rbp)
jne    116d <main+0x5d>
lea    0xe98(%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),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"true\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 0
}