xunge/DecIR huggingface dataset:
/* Type definitions */
struct hostent {
  int dummy;
};
typedef enum nss_status { ____Placeholder_nss_status } nss_status;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int _nss_etcd_gethostbyname2_r(char const *, int /*<<< orphan*/,
                               struct hostent *, char *, size_t, int *, int *);
enum nss_status _nss_etcd_gethostbyname_r(const char *name,
                                          struct hostent *result, char *buffer,
                                          size_t buflen, int *errnop,
                                          int *h_errnop) {
  return _nss_etcd_gethostbyname2_r(name, AF_INET, result, buffer, buflen,
                                    errnop, h_errnop);
}


x86 assembly (clang, -O0):
<_nss_etcd_gethostbyname_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
mov    -0x30(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <_nss_etcd_gethostbyname2_r@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_nss_etcd_gethostbyname_r>:
push   %rax
mov    %r8,%rax
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    0x2ec4(%rip),%rsi
mov    (%rsi),%esi
mov    %r9,(%rsp)
mov    %rax,%r9
call   1030 <_nss_etcd_gethostbyname2_r@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.hostent = type { i32 }
@AF_INET = global i32 0
define i32 @_nss_etcd_gethostbyname_r(i8* %0, %struct.hostent* %1, i8* %2, i64 %3, i32* %4, i32* %5) {
%7 = alloca i8*
%8 = alloca %struct.hostent*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32*
%12 = alloca i32*
store i8* %0, i8** %7
store %struct.hostent* %1, %struct.hostent** %8
store i8* %2, i8** %9
store i64 %3, i64* %10
store i32* %4, i32** %11
store i32* %5, i32** %12
%13 = load i8*, i8** %7
%14 = load i32, i32* @AF_INET
%15 = load %struct.hostent*, %struct.hostent** %8
%16 = load i8*, i8** %9
%17 = load i64, i64* %10
%18 = load i32*, i32** %11
%19 = load i32*, i32** %12
%20 = call i32 @_nss_etcd_gethostbyname2_r(i8* %13, i32 %14, %struct.hostent* %15, i8* %16, i64 %17, i32* %18, i32* %19)
ret i32 %20
}

LLVM IR (-O2):
%struct.hostent = type { i32 }
@AF_INET = global i32 0
define i32 @_nss_etcd_gethostbyname_r(i8* %0, %struct.hostent* %1, i8* %2, i64 %3, i32* %4, i32* %5) {
%7 = load i32, i32* @AF_INET
%8 = tail call i32 @_nss_etcd_gethostbyname2_r(i8* %0, i32 %7, %struct.hostent* %1, i8* %2, i64 %3, i32* %4, i32* %5)
ret i32 %8
}
unsigned long int_hash_value(void *integer) {
  return *(unsigned long *)integer;
}


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

x86 assembly (clang, -O2):
<int_hash_value>:
mov    (%rdi),%rax
ret

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

LLVM IR (-O2):
define i64 @int_hash_value(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ alloc_failed();
void *realloc(void *, size_t);
void *xrealloc(void *ptr, size_t size) {
  void *result = realloc(ptr, size);
  if (result == NULL && size > 0)
    alloc_failed();
  return result;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    115e <xrealloc+0x3e>
cmpq   $0x0,-0x10(%rbp)
jbe    115e <xrealloc+0x3e>
mov    $0x0,%al
call   1030 <alloc_failed@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1040 <realloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     1140 <xrealloc+0x20>
test   %r14,%r14
jne    1140 <xrealloc+0x20>
xor    %eax,%eax
call   1030 <alloc_failed@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %16
11: ; preds = %2
%12 = load i64, i64* %4
%13 = icmp ugt i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @alloc_failed()
br label %16
16: ; preds = %14, %11, %2
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
%5 = icmp ne i64 %1, 0
%6 = and i1 %5, %4
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 (...) @alloc_failed()
br label %9
9: ; preds = %7, %2
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ _unsupported();
void _Unwind_FindEnclosingFunction() { _unsupported(); }


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

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

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

LLVM IR (-O2):
define void @_Unwind_FindEnclosingFunction() {
%1 = tail call i32 (...) @_unsupported()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_assert(int);
int __VERIFIER_nondet_int();
int main() {
  while (1) {
    int x = __VERIFIER_nondet_int();
    int y = x;
    __VERIFIER_assert(x == y);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
sete   %al
and    $0x1,%al
mov    %al,-0xd(%rbp)
movzbl %al,%edi
call   1040 <__VERIFIER_assert@plt>
jmp    112f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    $0x1,%edi
call   1040 <__VERIFIER_assert@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %0, %4
%5 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %5, i32* %2
%6 = load i32, i32* %2
store i32 %6, i32* %3
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = icmp eq i32 %7, %8
%10 = zext i1 %9 to i32
%11 = call i32 @__VERIFIER_assert(i32 %10)
br label %4
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
%3 = tail call i32 @__VERIFIER_assert(i32 1)
br label %1
}
/* Variables and functions */
void *malloc(unsigned int);
void *fsl_alloc(unsigned int sz) { return malloc(sz); }


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

x86 assembly (clang, -O2):
<fsl_alloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @fsl_alloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *malloc(int);
int *myalloc();
int /*<<< orphan*/ myfoo(int *);
void mallocEscapeFreeCustomAlloc() {
  int *p = malloc(12);
  myfoo(p);
  free(p);
  p = myalloc();
  free(p);
}


x86 assembly (clang, -O0):
<mallocEscapeFreeCustomAlloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xc,%edi
call   1060 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <myfoo@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1040 <myalloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mallocEscapeFreeCustomAlloc>:
push   %rbx
mov    $0xc,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <myfoo@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1040 <myalloc@plt>
mov    %rax,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @mallocEscapeFreeCustomAlloc() {
%1 = alloca i32*
%2 = call i32* @malloc(i32 12)
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = call i32 @myfoo(i32* %3)
%5 = load i32*, i32** %1
%6 = call i32 @free(i32* %5)
%7 = call i32* (...) @myalloc()
store i32* %7, i32** %1
%8 = load i32*, i32** %1
%9 = call i32 @free(i32* %8)
ret void
}

LLVM IR (-O2):
define void @mallocEscapeFreeCustomAlloc() {
%1 = tail call i32* @malloc(i32 12)
%2 = tail call i32 @myfoo(i32* %1)
%3 = tail call i32 @free(i32* %1)
%4 = tail call i32* (...) @myalloc()
%5 = tail call i32 @free(i32* %4)
ret void
}
void foo453() {}


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

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

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

LLVM IR (-O2):
define void @foo453() {
ret void
}
int make_int_8(int value) {
  return (value & 0x80) ? value | ~0xff : value & 0xff;
}


x86 assembly (clang, -O0):
<make_int_8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
je     1128 <make_int_8+0x28>
mov    -0x4(%rbp),%eax
or     $0xffffff00,%eax
mov    %eax,-0x8(%rbp)
jmp    1133 <make_int_8+0x33>
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<make_int_8>:
movsbl %dil,%eax
movzbl %al,%ecx
and    $0xffffff00,%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define i32 @make_int_8(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 128
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = or i32 %7, -256
br label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = and i32 %10, 255
br label %12
12: ; preds = %9, %6
%13 = phi i32 [ %8, %6 ], [ %11, %9 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @make_int_8(i32 %0) {
%2 = and i32 %0, 128
%3 = icmp eq i32 %2, 0
%4 = and i32 %0, 255
%5 = select i1 %3, i32 0, i32 -256
%6 = or i32 %5, %4
ret i32 %6
}
void gtk_im_context_set_cursor_location() {}


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

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

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

LLVM IR (-O2):
define void @gtk_im_context_set_cursor_location() {
ret void
}
/* Type definitions */
typedef int time_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int time(int /*<<< orphan*/ *);
int main() {
  float swatch;
  time_t sec;
  sec = time(NULL);
  swatch = (float)(((sec + 3600) % 86400) * 1000) / 86400;
  printf("@%06.3f\n", swatch);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xe10,%eax
mov    $0x15180,%ecx
cltd
idiv   %ecx
imul   $0x3e8,%edx,%eax
cvtsi2ss %eax,%xmm0
movss  0xea3(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%ecx
add    $0xe10,%ecx
movslq %ecx,%rcx
imul   $0xffffffffc22e4507,%rcx,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
add    $0xe10,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x10,%ecx
add    %edx,%ecx
imul   $0x15180,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0xe10,%eax
imul   $0x3e8,%eax,%eax
cvtsi2ss %eax,%xmm0
divss  0xe8f(%rip),%xmm0
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"@%06.3f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @time(i32* null)
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = add nsw i32 %5, 3600
%7 = srem i32 %6, 86400
%8 = mul nsw i32 %7, 1000
%9 = sitofp i32 %8 to float
%10 = fdiv float %9, 8.640000e+04
store float %10, float* %2
%11 = load float, float* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"@%06.3f\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = add nsw i32 %1, 3600
%3 = srem i32 %2, 86400
%4 = mul nsw i32 %3, 1000
%5 = sitofp i32 %4 to float
%6 = fdiv float %5, 8.640000e+04
%7 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), float %6)
ret i32 0
}
/* Type definitions */
struct varmap {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int /*<<< orphan*/ varmap_append(struct varmap **, char const *,
                                 int /*<<< orphan*/, int const);
void varmap_append_nt(struct varmap **b, const char *ptr, const int sync) {
  varmap_append(b, ptr, strlen(ptr), sync);
}


x86 assembly (clang, -O0):
<varmap_append_nt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
mov    -0x14(%rbp),%ecx
call   1040 <varmap_append@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<varmap_append_nt>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
mov    %r14d,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <varmap_append@plt>

LLVM IR (-O0):
%struct.varmap = type { i32 }
define void @varmap_append_nt(%struct.varmap** %0, i8* %1, i32 %2) {
%4 = alloca %struct.varmap**
%5 = alloca i8*
%6 = alloca i32
store %struct.varmap** %0, %struct.varmap*** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load %struct.varmap**, %struct.varmap*** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %5
%10 = call i32 @strlen(i8* %9)
%11 = load i32, i32* %6
%12 = call i32 @varmap_append(%struct.varmap** %7, i8* %8, i32 %10, i32 %11)
ret void
}

LLVM IR (-O2):
%struct.varmap = type { i32 }
define void @varmap_append_nt(%struct.varmap** %0, i8* %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %1)
%5 = tail call i32 @varmap_append(%struct.varmap** %0, i8* %1, i32 %4, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float, float);
int main() {
  int a, b;
  float c, d;
  a = 13;
  b = 5;
  c = a / b;
  d = (float)a / (float)b;
  printf("[integers]\t a = %d\t b = %d\n", a, b);
  printf("[floats]\t c = %f\t d = %f\n", c, d);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xd,-0x8(%rbp)
movl   $0x5,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
cvtsi2ssl -0x8(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef8(%rip),%rdi
movss  0xee0(%rip),%xmm0
movss  0xedc(%rip),%xmm1
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
movss  0xecc(%rip),%xmm0
movss  0xec8(%rip),%xmm1
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"[integers]\09 a = %d\09 b = %d\0A\00"
@.str.1 = [26 x i8] c"[floats]\09 c = %f\09 d = %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
store i32 13, i32* %2
store i32 5, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = sdiv i32 %6, %7
%9 = sitofp i32 %8 to float
store float %9, float* %4
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to float
%12 = load i32, i32* %3
%13 = sitofp i32 %12 to float
%14 = fdiv float %11, %13
store float %14, float* %5
%15 = load i32, i32* %2
%16 = sitofp i32 %15 to float
%17 = load i32, i32* %3
%18 = sitofp i32 %17 to float
%19 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), float %16, float %18)
%20 = load float, float* %4
%21 = load float, float* %5
%22 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), float %20, float %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"[integers]\09 a = %d\09 b = %d\0A\00"
@.str.1 = [26 x i8] c"[floats]\09 c = %f\09 d = %f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), float 1.300000e+01, float 5.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), float 2.000000e+00, float 0x4004CCCCC0000000)
ret i32 0
}
int foo(int i) {
  int j = i;
  int k = 0;
  int l = j + k;
  int m = l - j;
  return m;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
store i32 %7, i32* %3
store i32 0, i32* %4
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = add nsw i32 %8, %9
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = load i32, i32* %3
%13 = sub nsw i32 %11, %12
store i32 %13, i32* %6
%14 = load i32, i32* %6
ret i32 %14
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
ret i32 0
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
int stat(char *, struct stat *);
int isRep(char *path) {
  struct stat st;
  if (stat(path, &st) == -1) {
    return 0;
  }
  if (S_ISDIR(st.st_mode)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<isRep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
jne    114e <isRep+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    1173 <isRep+0x53>
mov    -0x18(%rbp),%edi
call   1030 <S_ISDIR@plt>
cmp    $0x0,%rax
je     116c <isRep+0x4c>
movl   $0x1,-0x4(%rbp)
jmp    1173 <isRep+0x53>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isRep>:
push   %rax
mov    %rsp,%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
je     1143 <isRep+0x23>
mov    (%rsp),%edi
call   1030 <S_ISDIR@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @isRep(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @stat(i8* %5, %struct.stat* %4)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %16
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i32, i32* %10
%12 = call i64 @S_ISDIR(i32 %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %9
store i32 1, i32* %2
br label %16
15: ; preds = %9
store i32 0, i32* %2
br label %16
16: ; preds = %15, %14, %8
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @isRep(i8* nocapture %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %12, label %6
6: ; preds = %1
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i64 @S_ISDIR(i32 %8)
%10 = icmp ne i64 %9, 0
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %6, %1
%13 = phi i32 [ 0, %1 ], [ %11, %6 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void send_mail(char *response, char *host_id, char *sent_req) {
  printf(
      "\nThere appears to be a problem.  Please feel free to contact DD-UP "
      "Support Team by sending an e-mail to : support@ddup.org.\n\nThis will "
      "enter your query into a database and you will be contacted soon.\n\n");
}


x86 assembly (clang, -O0):
<send_mail>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [202 x i8] c"\0AThere appears to be a problem. Please feel free to contact DD-UP Support Team by sending an e-mail to : support@ddup.org.\0A\0AThis will enter your query into a database and you will be contacted soon.\0A\0A\00"
define void @send_mail(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = call i32 @printf(i8* getelementptr inbounds ([202 x i8], [202 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [201 x i8] c"\0AThere appears to be a problem. Please feel free to contact DD-UP Support Team by sending an e-mail to : support@ddup.org.\0A\0AThis will enter your query into a database and you will be contacted soon.\0A\00"
define void @send_mail(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([201 x i8], [201 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
void b_float_print_64(long idx, long *cells, int size) {
  float value = cells[idx] / 100.0;
  printf("%.2f", value);
}


x86 assembly (clang, -O0):
<b_float_print_64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
cvtsi2sdq (%rax,%rcx,8),%xmm0
movsd  0xec7(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_float_print_64>:
cvtsi2sdq (%rsi,%rdi,8),%xmm0
divsd  0xee2(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xedf(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%.2f\00"
define void @b_float_print_64(i64 %0, i64* %1, i32 %2) {
%4 = alloca i64
%5 = alloca i64*
%6 = alloca i32
%7 = alloca float
store i64 %0, i64* %4
store i64* %1, i64** %5
store i32 %2, i32* %6
%8 = load i64*, i64** %5
%9 = load i64, i64* %4
%10 = getelementptr inbounds i64, i64* %8, i64 %9
%11 = load i64, i64* %10
%12 = sitofp i64 %11 to double
%13 = fdiv double %12, 1.000000e+02
%14 = fptrunc double %13 to float
store float %14, float* %7
%15 = load float, float* %7
%16 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float %15)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.2f\00"
define void @b_float_print_64(i64 %0, i64* nocapture %1, i32 %2) {
%4 = getelementptr inbounds i64, i64* %1, i64 %0
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = fdiv double %6, 1.000000e+02
%8 = fptrunc double %7 to float
%9 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), float %8)
ret void
}
void rop3_252_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  stk1 = T | S;
  *D = stk1;
}


x86 assembly (clang, -O0):
<rop3_252_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
or     %ecx,%eax
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_252_0_0>:
or     %edx,%esi
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_252_0_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%8 = load i8, i8* %6
%9 = zext i8 %8 to i32
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = or i32 %9, %11
%13 = trunc i32 %12 to i8
store i8 %13, i8* %7
%14 = load i8, i8* %7
%15 = load i8*, i8** %4
store i8 %14, i8* %15
ret void
}

LLVM IR (-O2):
define void @rop3_252_0_0(i8* nocapture writeonly %0, i8 zeroext %1, i8 zeroext %2) {
%4 = or i8 %2, %1
store i8 %4, i8* %0
ret void
}
void f(int b[]) { b[0] = 0; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movl   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @f(i32* nocapture writeonly %0) {
store i32 0, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int yylex();
int main(void) {
  int first, second;
  first = yylex();
  second = yylex();
  printf("%d + %d = %d\n", first, second, first + second);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <yylex@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <yylex@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
add    -0xc(%rbp),%ecx
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <yylex@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <yylex@plt>
lea    (%rax,%rbx,1),%ecx
lea    0xec5(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%d + %d = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @yylex()
store i32 %4, i32* %2
%5 = call i32 (...) @yylex()
store i32 %5, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = add nsw i32 %8, %9
%11 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7, i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d + %d = %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @yylex()
%2 = tail call i32 (...) @yylex()
%3 = add nsw i32 %2, %1
%4 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2, i32 %3)
ret i32 0
}
/* Variables and functions */
char *_nvram_buf_get(char *, char *);
char *nvram_get(char *section, char *key) {
  ;
  return _nvram_buf_get(section, key);
}


x86 assembly (clang, -O0):
<nvram_get>:
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 <_nvram_buf_get@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvram_get>:
jmp    1030 <_nvram_buf_get@plt>

LLVM IR (-O0):
define i8* @nvram_get(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* @_nvram_buf_get(i8* %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @nvram_get(i8* %0, i8* %1) {
%3 = tail call i8* @_nvram_buf_get(i8* %0, i8* %1)
ret i8* %3
}
int ll_opt_favor(int flag) { return (flag & ((1 << 1) | (1 << 2))) >> 1; }


x86 assembly (clang, -O0):
<ll_opt_favor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x6,%eax
sar    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ll_opt_favor>:
mov    %edi,%eax
shr    %eax
and    $0x3,%eax
ret

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

LLVM IR (-O2):
define i32 @ll_opt_favor(i32 %0) {
%2 = lshr i32 %0, 1
%3 = and i32 %2, 3
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int getc(int /*<<< orphan*/ *);
int read_int32(FILE *in) {
  int i;
  i = getc(in);
  i |= getc(in) << 8;
  i |= getc(in) << 16;
  i |= getc(in) << 24;
  return i;
}


x86 assembly (clang, -O0):
<read_int32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
shl    $0x8,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
shl    $0x10,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getc@plt>
shl    $0x18,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_int32>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
call   1030 <getc@plt>
mov    %eax,%r14d
mov    %r15,%rdi
call   1030 <getc@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
or     %r14d,%ebp
mov    %r15,%rdi
call   1030 <getc@plt>
mov    %eax,%ebx
shl    $0x10,%ebx
mov    %r15,%rdi
call   1030 <getc@plt>
shl    $0x18,%eax
or     %ebx,%eax
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @read_int32(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @getc(i32* %4)
store i32 %5, i32* %3
%6 = load i32*, i32** %2
%7 = call i32 @getc(i32* %6)
%8 = shl i32 %7, 8
%9 = load i32, i32* %3
%10 = or i32 %9, %8
store i32 %10, i32* %3
%11 = load i32*, i32** %2
%12 = call i32 @getc(i32* %11)
%13 = shl i32 %12, 16
%14 = load i32, i32* %3
%15 = or i32 %14, %13
store i32 %15, i32* %3
%16 = load i32*, i32** %2
%17 = call i32 @getc(i32* %16)
%18 = shl i32 %17, 24
%19 = load i32, i32* %3
%20 = or i32 %19, %18
store i32 %20, i32* %3
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @read_int32(i32* nocapture %0) {
%2 = tail call i32 @getc(i32* %0)
%3 = tail call i32 @getc(i32* %0)
%4 = shl i32 %3, 8
%5 = or i32 %4, %2
%6 = tail call i32 @getc(i32* %0)
%7 = shl i32 %6, 16
%8 = or i32 %5, %7
%9 = tail call i32 @getc(i32* %0)
%10 = shl i32 %9, 24
%11 = or i32 %8, %10
ret i32 %11
}
/* Variables and functions */
long max(long, long);
long Max(long a, long b, long c, long d) { return max(max(a, b), max(c, d)); }


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

x86 assembly (clang, -O2):
<Max>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r15
call   1030 <max@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <max@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <max@plt>

LLVM IR (-O0):
define i64 @Max(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i64, i64* %5
%10 = load i64, i64* %6
%11 = call i64 @max(i64 %9, i64 %10)
%12 = load i64, i64* %7
%13 = load i64, i64* %8
%14 = call i64 @max(i64 %12, i64 %13)
%15 = call i64 @max(i64 %11, i64 %14)
ret i64 %15
}

LLVM IR (-O2):
define i64 @Max(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = tail call i64 @max(i64 %0, i64 %1)
%6 = tail call i64 @max(i64 %2, i64 %3)
%7 = tail call i64 @max(i64 %5, i64 %6)
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void programHeader1(void) {
  printf("Student Assignment Number 1\n"
         "Student: Don Retzlaff donr@unt.edu\n\n");
}


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

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

LLVM IR (-O0):
@.str = [65 x i8] c"Student Assignment Number 1\0AStudent: Don Retzlaff donr@unt.edu\0A\0A\00"
define void @programHeader1() {
%1 = call i32 @printf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [64 x i8] c"Student Assignment Number 1\0AStudent: Don Retzlaff donr@unt.edu\0A\00"
define void @programHeader1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @str, i64 0, i64 0))
ret void
}
void INI_CfgDepCtx() { ; }


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

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

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

LLVM IR (-O2):
define void @INI_CfgDepCtx() {
ret void
}
/* Type definitions */
typedef char const uint16_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *);
int strlen(char const *);
uint16_t get_reg_num(const char *reg) {
  if (strlen(reg) != 2) {
    printf("[!] Compile error: Invalid token [%s].\n", reg);
    exit(EXIT_FAILURE);
  }
  return reg[1] - '0';
}


x86 assembly (clang, -O0):
<get_reg_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
je     116c <get_reg_num+0x3c>
mov    -0x8(%rbp),%rsi
lea    0xea7(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
sub    $0x30,%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_reg_num>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x2,%eax
jne    1145 <get_reg_num+0x15>
mov    0x1(%rbx),%al
add    $0xd0,%al
pop    %rbx
ret
lea    0xeb4(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"[!] Compile error: Invalid token [%s].\0A\00"
@EXIT_FAILURE = global i32 0
define signext i8 @get_reg_num(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @strlen(i8* %3)
%5 = icmp ne i32 %4, 2
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %7)
%9 = load i32, i32* @EXIT_FAILURE
%10 = call i32 @exit(i32 %9)
unreachable
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = sub nsw i32 %15, 48
%17 = trunc i32 %16 to i8
ret i8 %17
}

LLVM IR (-O2):
@.str = [40 x i8] c"[!] Compile error: Invalid token [%s].\0A\00"
@EXIT_FAILURE = global i32 0
define signext i8 @get_reg_num(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp eq i32 %2, 2
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
%9 = getelementptr inbounds i8, i8* %0, i64 1
%10 = load i8, i8* %9
%11 = add i8 %10, -48
ret i8 %11
}
int test_imm_16int16_mem(short *val) {
  return ((*val) & (0x16 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_16int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 22
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int EOF;
scalar_t__ close(int);
scalar_t__ fsync(int);
int close_fd(int fd) {
  const int fsync_fail = (fsync(fd) != 0);
  const int close_fail = (close(fd) != 0);
  if (fsync_fail || close_fail) {
    return EOF;
  }
  return 0;
}


x86 assembly (clang, -O0):
<close_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <fsync@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <close@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    116d <close_fd+0x4d>
cmpl   $0x0,-0x10(%rbp)
je     117e <close_fd+0x5e>
mov    0x2e74(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1185 <close_fd+0x65>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_fd>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
call   1040 <fsync@plt>
mov    %rax,%r14
mov    %ebx,%edi
call   1030 <close@plt>
mov    %rax,%rcx
xor    %eax,%eax
or     %r14,%rcx
je     1148 <close_fd+0x28>
mov    0x2ea2(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @close_fd(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = call i64 @fsync(i32 %6)
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i32
store i32 %9, i32* %4
%10 = load i32, i32* %3
%11 = call i64 @close(i32 %10)
%12 = icmp ne i64 %11, 0
%13 = zext i1 %12 to i32
store i32 %13, i32* %5
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %1
%17 = load i32, i32* %5
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16, %1
%20 = load i32, i32* @EOF
store i32 %20, i32* %2
br label %22
21: ; preds = %16
store i32 0, i32* %2
br label %22
22: ; preds = %21, %19
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @close_fd(i32 %0) {
%2 = tail call i64 @fsync(i32 %0)
%3 = icmp ne i64 %2, 0
%4 = tail call i64 @close(i32 %0)
%5 = icmp ne i64 %4, 0
%6 = select i1 %3, i1 true, i1 %5
%7 = load i32, i32* @EOF
%8 = select i1 %6, i32 %7, i32 0
ret i32 %8
}
/* Type definitions */
typedef char *__m128d;

/* Variables and functions */
char *_mm_cvtsi64_sd(char *, long long);
__m128d __attribute__((no, unused)) test(__m128d p, long long b) {
  __asm("" : "+v"(p), "+r"(b));
  return _mm_cvtsi64_sd(p, b);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
movq   %rcx,%xmm0
movq   %xmm0,%rcx
mov    %rcx,-0x8(%rbp)
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <_mm_cvtsi64_sd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
movq   %rdi,%xmm0
movq   %xmm0,%rdi
jmp    1030 <_mm_cvtsi64_sd@plt>

LLVM IR (-O0):
define i8* @test(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call { i8*, i64 } asm "", "=v,=r,0,1,~{dirflag},~{fpsr},~{flags}"(i8* %5, i64 %6)
%8 = extractvalue { i8*, i64 } %7, 0
%9 = extractvalue { i8*, i64 } %7, 1
store i8* %8, i8** %3
store i64 %9, i64* %4
%10 = load i8*, i8** %3
%11 = load i64, i64* %4
%12 = call i8* @_mm_cvtsi64_sd(i8* %10, i64 %11)
ret i8* %12
}

LLVM IR (-O2):
define i8* @test(i8* %0, i64 %1) {
%3 = tail call { i8*, i64 } asm "", "=v,=r,0,1,~{dirflag},~{fpsr},~{flags}"(i8* %0, i64 %1)
%4 = extractvalue { i8*, i64 } %3, 0
%5 = extractvalue { i8*, i64 } %3, 1
%6 = tail call i8* @_mm_cvtsi64_sd(i8* %4, i64 %5)
ret i8* %6
}
/* Variables and functions */
int fnmatch(char const *, char const *, int);
__attribute__((__weak__, __always___)) int
softboundcets_fnmatch(const char *pattern, const char *string, int flags) {
  return fnmatch(pattern, string, flags);
}


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

x86 assembly (clang, -O2):
<softboundcets_fnmatch>:
jmp    1030 <fnmatch@plt>

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

LLVM IR (-O2):
define weak i32 @softboundcets_fnmatch(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @fnmatch(i8* %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int intel_ich_gpio_set(int, int);
int board_aopen_i975xa_ydg(void) {
  int ret;
  ret = intel_ich_gpio_set(33, 1);
  return ret;
}


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

x86 assembly (clang, -O2):
<board_aopen_i975xa_ydg>:
mov    $0x21,%edi
mov    $0x1,%esi
jmp    1030 <intel_ich_gpio_set@plt>

LLVM IR (-O0):
define i32 @board_aopen_i975xa_ydg() {
%1 = alloca i32
%2 = call i32 @intel_ich_gpio_set(i32 33, i32 1)
store i32 %2, i32* %1
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @board_aopen_i975xa_ydg() {
%1 = tail call i32 @intel_ich_gpio_set(i32 33, i32 1)
ret i32 %1
}
int do_784() { return 784; }


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

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

LLVM IR (-O0):
define i32 @do_784() {
ret i32 784
}

LLVM IR (-O2):
define i32 @do_784() {
ret i32 784
}
/* Variables and functions */
int /*<<< orphan*/ DriveSpinnerMotor(int /*<<< orphan*/);
void StopSpinnerMotor() { DriveSpinnerMotor(0); }


x86 assembly (clang, -O0):
<StopSpinnerMotor>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <DriveSpinnerMotor@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<StopSpinnerMotor>:
xor    %edi,%edi
jmp    1030 <DriveSpinnerMotor@plt>

LLVM IR (-O0):
define void @StopSpinnerMotor() {
%1 = call i32 @DriveSpinnerMotor(i32 0)
ret void
}

LLVM IR (-O2):
define void @StopSpinnerMotor() {
%1 = tail call i32 @DriveSpinnerMotor(i32 0)
ret void
}
/* Type definitions */
struct fc_memo {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;
typedef int /*<<< orphan*/ char32_t;

/* Variables and functions */
int /*<<< orphan*/ fc_memo_lcsubstr(struct fc_memo *,
                                    int /*<<< orphan*/ const *,
                                    int /*<<< orphan*/);
int32_t lcsubstr_compute(struct fc_memo *m, const char32_t *seq, int32_t len) {
  return -fc_memo_lcsubstr(m, seq, len);
}


x86 assembly (clang, -O0):
<lcsubstr_compute>:
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),%edx
call   1030 <fc_memo_lcsubstr@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcsubstr_compute>:
push   %rax
call   1030 <fc_memo_lcsubstr@plt>
neg    %eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.fc_memo = type { i32 }
define i32 @lcsubstr_compute(%struct.fc_memo* %0, i32* %1, i32 %2) {
%4 = alloca %struct.fc_memo*
%5 = alloca i32*
%6 = alloca i32
store %struct.fc_memo* %0, %struct.fc_memo** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load %struct.fc_memo*, %struct.fc_memo** %4
%8 = load i32*, i32** %5
%9 = load i32, i32* %6
%10 = call i32 @fc_memo_lcsubstr(%struct.fc_memo* %7, i32* %8, i32 %9)
%11 = sub nsw i32 0, %10
ret i32 %11
}

LLVM IR (-O2):
%struct.fc_memo = type { i32 }
define i32 @lcsubstr_compute(%struct.fc_memo* %0, i32* %1, i32 %2) {
%4 = tail call i32 @fc_memo_lcsubstr(%struct.fc_memo* %0, i32* %1, i32 %2)
%5 = sub nsw i32 0, %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ XIMStyles;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_XIMStyles(void) {
  XIMStyles *_p = (XIMStyles *)malloc(sizeof(XIMStyles));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_XIMStyles>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_XIMStyles+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_XIMStyles>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_XIMStyles+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @alloc_XIMStyles() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @alloc_XIMStyles() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ print_help();
int process_help(int arg, char **argv, int argc) {
  print_help();
  return 0;
}


x86 assembly (clang, -O0):
<process_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0x0,%al
call   1030 <print_help@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_help>:
push   %rax
xor    %eax,%eax
call   1030 <print_help@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @process_help(i32 %0, i8** %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%7 = call i32 (...) @print_help()
ret i32 0
}

LLVM IR (-O2):
define i32 @process_help(i32 %0, i8** nocapture readnone %1, i32 %2) {
%4 = tail call i32 (...) @print_help()
ret i32 0
}