xunge/DecIR huggingface dataset:
/* Variables and functions */
int tan(double);
double ap_coeff(double freq) {
  if (freq > 0.49)
    freq = 0.49;
  double w_digital = 2 * 3.141592 * freq;
  double w_analog = 2 * tan(w_digital / 2);
  double apcoeff = -(w_analog - 2) / (w_analog + 2);
  return apcoeff;
}


x86 assembly (clang, -O0):
<ap_coeff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1141 <ap_coeff+0x31>
movsd  0xec4(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xec7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xea8(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <tan@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe86(%rip),%xmm1
subsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe63(%rip),%xmm1
addsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ap_coeff>:
push   %rax
movsd  0xee7(%rip),%xmm1
minsd  %xmm0,%xmm1
mulsd  0xee3(%rip),%xmm1
mulsd  0xee3(%rip),%xmm1
movapd %xmm1,%xmm0
call   1030 <tan@plt>
add    %eax,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0xed1(%rip),%xmm0
addsd  %xmm1,%xmm0
xorpd  0xedd(%rip),%xmm0
addsd  0xec5(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @ap_coeff(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %2
%6 = load double, double* %2
%7 = fcmp ogt double %6, 4.900000e-01
br i1 %7, label %8, label %9
8: ; preds = %1
store double 4.900000e-01, double* %2
br label %9
9: ; preds = %8, %1
%10 = load double, double* %2
%11 = fmul double 0x401921FAFC8B007A, %10
store double %11, double* %3
%12 = load double, double* %3
%13 = fdiv double %12, 2.000000e+00
%14 = call i32 @tan(double %13)
%15 = mul nsw i32 2, %14
%16 = sitofp i32 %15 to double
store double %16, double* %4
%17 = load double, double* %4
%18 = fsub double %17, 2.000000e+00
%19 = fneg double %18
%20 = load double, double* %4
%21 = fadd double %20, 2.000000e+00
%22 = fdiv double %19, %21
store double %22, double* %5
%23 = load double, double* %5
ret double %23
}

LLVM IR (-O2):
define double @ap_coeff(double %0) {
%2 = fcmp ogt double %0, 4.900000e-01
%3 = select i1 %2, double 4.900000e-01, double %0
%4 = fmul double %3, 0x401921FAFC8B007A
%5 = fmul double %4, 5.000000e-01
%6 = tail call i32 @tan(double %5)
%7 = shl nsw i32 %6, 1
%8 = sitofp i32 %7 to double
%9 = fadd double %8, -2.000000e+00
%10 = fneg double %9
%11 = fadd double %8, 2.000000e+00
%12 = fdiv double %10, %11
ret double %12
}
void test_vsprintf() {}


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

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

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

LLVM IR (-O2):
define void @test_vsprintf() {
ret void
}
long atomic_inc(volatile long *pAddr) {
  register long result;
  __asm__ __volatile__("lock/xaddq %q0, %1"
                       : "=r"(result), "=m"(*pAddr)
                       : "0"((long)(1)), "m"(*pAddr));
  return *pAddr;
}


x86 assembly (clang, -O0):
<atomic_inc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x8(%rbp),%rdx
mov    $0x1,%eax
lock xadd %rax,(%rcx)
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<atomic_inc>:
mov    $0x1,%eax
lock xadd %rax,(%rdi)
mov    (%rdi),%rax
ret

LLVM IR (-O0):
define i64 @atomic_inc(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
store i64* %0, i64** %2
%4 = load i64*, i64** %2
%5 = load i64*, i64** %2
%6 = call i64 asm sideeffect "lock/xaddq ${0:q}, $1", "=r,=*m,0,*m,~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %4, i64 1, i64* elementtype(i64) %5)
store i64 %6, i64* %3
%7 = load i64*, i64** %2
%8 = load volatile i64, i64* %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @atomic_inc(i64* %0) {
%2 = tail call i64 asm sideeffect "lock/xaddq ${0:q}, $1", "=r,=*m,0,*m,~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %0, i64 1, i64* elementtype(i64) %0)
%3 = load volatile i64, i64* %0
ret i64 %3
}
unsigned u_addlim(unsigned augend, unsigned addend, unsigned limit) {
  unsigned x;
  if (augend > limit)
    return limit;
  if (addend > limit)
    return limit;
  x = augend + addend;
  if (x < addend)
    return limit;
  if (x < limit)
    return x;
  else
    return limit;
}


x86 assembly (clang, -O0):
<u_addlim>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jbe    1124 <u_addlim+0x24>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1178 <u_addlim+0x78>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jbe    113b <u_addlim+0x3b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1178 <u_addlim+0x78>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    115b <u_addlim+0x5b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1178 <u_addlim+0x78>
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    1172 <u_addlim+0x72>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1178 <u_addlim+0x78>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<u_addlim>:
mov    %edx,%eax
cmp    %edx,%edi
ja     1113 <u_addlim+0x13>
cmp    %eax,%esi
ja     1113 <u_addlim+0x13>
add    %edi,%esi
jb     1113 <u_addlim+0x13>
cmp    %eax,%esi
cmovb  %esi,%eax
ret

LLVM IR (-O0):
define i32 @u_addlim(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %5
%10 = load i32, i32* %7
%11 = icmp ugt i32 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %3
%13 = load i32, i32* %7
store i32 %13, i32* %4
br label %37
14: ; preds = %3
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = icmp ugt i32 %15, %16
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = load i32, i32* %7
store i32 %19, i32* %4
br label %37
20: ; preds = %14
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = add i32 %21, %22
store i32 %23, i32* %8
%24 = load i32, i32* %8
%25 = load i32, i32* %6
%26 = icmp ult i32 %24, %25
br i1 %26, label %27, label %29
27: ; preds = %20
%28 = load i32, i32* %7
store i32 %28, i32* %4
br label %37
29: ; preds = %20
%30 = load i32, i32* %8
%31 = load i32, i32* %7
%32 = icmp ult i32 %30, %31
br i1 %32, label %33, label %35
33: ; preds = %29
%34 = load i32, i32* %8
store i32 %34, i32* %4
br label %37
35: ; preds = %29
%36 = load i32, i32* %7
store i32 %36, i32* %4
br label %37
37: ; preds = %35, %33, %27, %18, %12
%38 = load i32, i32* %4
ret i32 %38
}

LLVM IR (-O2):
define i32 @u_addlim(i32 %0, i32 %1, i32 %2) {
%4 = icmp ugt i32 %0, %2
%5 = icmp ugt i32 %1, %2
%6 = or i1 %4, %5
br i1 %6, label %13, label %7
7: ; preds = %3
%8 = add i32 %1, %0
%9 = icmp ult i32 %8, %1
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = icmp ult i32 %8, %2
%12 = select i1 %11, i32 %8, i32 %2
br label %13
13: ; preds = %10, %7, %3
%14 = phi i32 [ %2, %3 ], [ %2, %7 ], [ %12, %10 ]
ret i32 %14
}
/* Variables and functions */
int gen_conncmp(void *, void *, int /*<<< orphan*/);
int conncmp(void *o1, void *o2) { return gen_conncmp(o1, o2, 0); }


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

x86 assembly (clang, -O2):
<conncmp>:
xor    %edx,%edx
jmp    1030 <gen_conncmp@plt>

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

LLVM IR (-O2):
define i32 @conncmp(i8* %0, i8* %1) {
%3 = tail call i32 @gen_conncmp(i8* %0, i8* %1, i32 0)
ret i32 %3
}
void *car_get_var_ptr(void *var) { return var; }


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

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

LLVM IR (-O0):
define i8* @car_get_var_ptr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret i8* %3
}

LLVM IR (-O2):
define i8* @car_get_var_ptr(i8* readnone returned %0) {
ret i8* %0
}
void pthread_attr_setstack() {}


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

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

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

LLVM IR (-O2):
define void @pthread_attr_setstack() {
ret void
}
/* Variables and functions */
void hprint2(int, int, unsigned long, int);
void hprint(int y, int x, unsigned long val) { return hprint2(y, x, val, 8); }


x86 assembly (clang, -O0):
<hprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    $0x8,%ecx
call   1030 <hprint2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hprint>:
mov    $0x8,%ecx
jmp    1030 <hprint2@plt>

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

LLVM IR (-O2):
define void @hprint(i32 %0, i32 %1, i64 %2) {
tail call void @hprint2(i32 %0, i32 %1, i64 %2, i32 8)
ret void
}
int till_revision(unsigned int flags) {
  int till = (((flags) >> 16) & 0xff);
  if (!till)
    return 0xff;
  return till;
}


x86 assembly (clang, -O0):
<till_revision>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x10,%eax
and    $0xff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    112b <till_revision+0x2b>
movl   $0xff,-0x4(%rbp)
jmp    1131 <till_revision+0x31>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<till_revision>:
shr    $0x10,%edi
movzbl %dil,%ecx
test   %ecx,%ecx
mov    $0xff,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @till_revision(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = lshr i32 %5, 16
%7 = and i32 %6, 255
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br i1 %9, label %11, label %10
10: ; preds = %1
store i32 255, i32* %2
br label %13
11: ; preds = %1
%12 = load i32, i32* %4
store i32 %12, i32* %2
br label %13
13: ; preds = %11, %10
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @till_revision(i32 %0) {
%2 = lshr i32 %0, 16
%3 = and i32 %2, 255
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 255, i32 %3
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ key_t;

/* Variables and functions */
int sem_create(int /*<<< orphan*/, int);
int sem_mutex_create(key_t key) { return sem_create(key, 1); }


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

x86 assembly (clang, -O2):
<sem_mutex_create>:
mov    $0x1,%esi
jmp    1030 <sem_create@plt>

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

LLVM IR (-O2):
define i32 @sem_mutex_create(i32 %0) {
%2 = tail call i32 @sem_create(i32 %0, i32 1)
ret i32 %2
}
/* Variables and functions */
int GL_COLOR_BUFFER_BIT;
int GL_DEPTH_BUFFER_BIT;
int /*<<< orphan*/ glClear(int);
void display(void) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); }


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    0x2ec4(%rip),%rax
or     (%rax),%edi
call   1030 <glClear@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
mov    0x2ec1(%rip),%rax
mov    0x2eca(%rip),%rcx
mov    (%rcx),%edi
or     (%rax),%edi
jmp    1030 <glClear@plt>

LLVM IR (-O0):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%3 = or i32 %1, %2
%4 = call i32 @glClear(i32 %3)
ret void
}

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
@GL_DEPTH_BUFFER_BIT = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = load i32, i32* @GL_DEPTH_BUFFER_BIT
%3 = or i32 %2, %1
%4 = tail call i32 @glClear(i32 %3)
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int strncmp(char *s, char *t, int n) {
  char t2[n];
  strncpy(&t2[0], t, n);
  return strcmp(s, &t2[0]);
}


x86 assembly (clang, -O0):
<strncmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x30(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x30(%rbp),%rsi
mov    -0x8(%rbp),%rdi
call   1040 <strcmp@plt>
mov    -0x20(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncmp>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %rdi,%r14
mov    %edx,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
call   1030 <strncpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcmp@plt>
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @strncmp(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %7
%12 = alloca i8, i64 %10
store i64 %10, i64* %8
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8*, i8** %5
%15 = load i32, i32* %6
%16 = call i32 @strncpy(i8* %13, i8* %14, i32 %15)
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %12, i64 0
%19 = call i32 @strcmp(i8* %17, i8* %18)
%20 = load i8*, i8** %7
ret i32 %19
}

LLVM IR (-O2):
define i32 @strncmp(i8* nocapture %0, i8* %1, i32 %2) {
%4 = zext i32 %2 to i64
%5 = alloca i8, i64 %4
%6 = call i32 @strncpy(i8* %5, i8* %1, i32 %2)
%7 = call i32 @strcmp(i8* dereferenceable(1) %0, i8* %5)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ NVIC_SystemReset();
void board_reset() { NVIC_SystemReset(); }


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

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

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

LLVM IR (-O2):
define void @board_reset() {
%1 = tail call i32 (...) @NVIC_SystemReset()
ret void
}
void rho_ruby_add_to_array(unsigned long ar, unsigned long val) {}


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

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

LLVM IR (-O0):
define void @rho_ruby_add_to_array(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
ret void
}

LLVM IR (-O2):
define void @rho_ruby_add_to_array(i64 %0, i64 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int syscall(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
            int /*<<< orphan*/ *);
int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid) {
  return syscall(171, rgid, egid, sgid);
}


x86 assembly (clang, -O0):
<getresgid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0xab,%edi
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getresgid>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0xab,%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
define i32 @getresgid(i32* %0, i32* %1, i32* %2) {
%4 = tail call i32 @syscall(i32 171, i32* %0, i32* %1, i32* %2)
ret i32 %4
}
/* Variables and functions */
int bar();
int /*<<< orphan*/ baz(int, int);
scalar_t__ equals(int, int);
void foo(int x) {
  int i = 0, j = bar();
  if (x == 1)
    i = 2;
  if (j && equals(i, j))
    baz(8, i);
  else
    baz(4, i);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <bar@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    115d <foo+0x2d>
movl   $0x2,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     118e <foo+0x5e>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <equals@plt>
cmp    $0x0,%rax
je     118e <foo+0x5e>
mov    -0x8(%rbp),%esi
mov    $0x8,%edi
call   1030 <baz@plt>
jmp    119b <foo+0x6b>
mov    -0x8(%rbp),%esi
mov    $0x4,%edi
call   1030 <baz@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <bar@plt>
xor    %ebx,%ebx
cmp    $0x1,%ebp
sete   %bl
add    %ebx,%ebx
test   %eax,%eax
je     115d <foo+0x2d>
mov    %ebx,%edi
mov    %eax,%esi
call   1050 <equals@plt>
mov    $0x8,%edi
test   %rax,%rax
jne    1162 <foo+0x32>
mov    $0x4,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <baz@plt>

LLVM IR (-O0):
define void @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%5 = call i32 (...) @bar()
store i32 %5, i32* %4
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 2, i32* %3
br label %9
9: ; preds = %8, %1
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = call i64 @equals(i32 %13, i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = load i32, i32* %3
%19 = call i32 @baz(i32 8, i32 %18)
br label %23
20: ; preds = %12, %9
%21 = load i32, i32* %3
%22 = call i32 @baz(i32 4, i32 %21)
br label %23
23: ; preds = %20, %17
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = tail call i32 (...) @bar()
%3 = icmp eq i32 %0, 1
%4 = select i1 %3, i32 2, i32 0
%5 = icmp eq i32 %2, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = tail call i64 @equals(i32 %4, i32 %2)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6, %1
br label %10
10: ; preds = %6, %9
%11 = phi i32 [ 4, %9 ], [ 8, %6 ]
%12 = tail call i32 @baz(i32 %11, i32 %4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SIGKILL;
int /*<<< orphan*/ SIGTERM;
int kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ usleep(int);
int end_script(pid_t pid) {
  if (kill(pid, SIGTERM) == -1)
    return -1;
  usleep(100000);
  kill(pid, SIGKILL);
  return 0;
}


x86 assembly (clang, -O0):
<end_script>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
cmp    $0xffffffff,%eax
jne    1151 <end_script+0x31>
movl   $0xffffffff,-0x4(%rbp)
jmp    1173 <end_script+0x53>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
mov    -0x8(%rbp),%edi
mov    0x2e73(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<end_script>:
push   %rbx
mov    %edi,%ebx
mov    0x2ebe(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
cmp    $0xffffffff,%eax
je     1154 <end_script+0x34>
mov    $0x186a0,%edi
call   1040 <usleep@plt>
mov    0x2e91(%rip),%rax
mov    (%rax),%esi
mov    %ebx,%edi
call   1030 <kill@plt>
xor    %eax,%eax
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@SIGTERM = global i32 0
@SIGKILL = global i32 0
define i32 @end_script(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* @SIGTERM
%6 = call i32 @kill(i32 %4, i32 %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %14
9: ; preds = %1
%10 = call i32 @usleep(i32 100000)
%11 = load i32, i32* %3
%12 = load i32, i32* @SIGKILL
%13 = call i32 @kill(i32 %11, i32 %12)
store i32 0, i32* %2
br label %14
14: ; preds = %9, %8
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@SIGTERM = global i32 0
@SIGKILL = global i32 0
define i32 @end_script(i32 %0) {
%2 = load i32, i32* @SIGTERM
%3 = tail call i32 @kill(i32 %0, i32 %2)
%4 = icmp eq i32 %3, -1
br i1 %4, label %9, label %5
5: ; preds = %1
%6 = tail call i32 @usleep(i32 100000)
%7 = load i32, i32* @SIGKILL
%8 = tail call i32 @kill(i32 %0, i32 %7)
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ 0, %5 ], [ -1, %1 ]
ret i32 %10
}
int main() {
  int a, b;
  a = b + b + b + b + b + b;
  return a;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ nl_item;

/* Variables and functions */
char *__nl_langinfo_l(int /*<<< orphan*/, int /*<<< orphan*/);
char *__nl_langinfo(nl_item item) { return __nl_langinfo_l(item, 0); }


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

x86 assembly (clang, -O2):
<__nl_langinfo>:
xor    %esi,%esi
jmp    1030 <__nl_langinfo_l@plt>

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

LLVM IR (-O2):
define i8* @__nl_langinfo(i32 %0) {
%2 = tail call i8* @__nl_langinfo_l(i32 %0, i32 0)
ret i8* %2
}
/* Variables and functions */
int fsync(int);
int tosFile_sync(int fd) {
  int res = fsync(fd);
  return res;
}


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

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

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

LLVM IR (-O2):
define i32 @tosFile_sync(i32 %0) {
%2 = tail call i32 @fsync(i32 %0)
ret i32 %2
}
I0RX1(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{
  if (22 <= (p1[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<I0RX1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movslq -0x10(%rbp),%rcx
movswl (%rax,%rcx,2),%ecx
mov    $0x16,%eax
cmp    %ecx,%eax
jg     1144 <I0RX1+0x44>
movl   $0x1,-0x4(%rbp)
jmp    114b <I0RX1+0x4b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<I0RX1>:
movslq %ecx,%rcx
xor    %eax,%eax
cmpw   $0x16,(%r9,%rcx,2)
setge  %al
ret

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

LLVM IR (-O2):
define i32 @I0RX1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture readnone %4, i16* nocapture %5) {
%7 = sext i32 %3 to i64
%8 = getelementptr inbounds i16, i16* %5, i64 %7
%9 = load i16, i16* %8
%10 = icmp sgt i16 %9, 21
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int ArgNum();
int GetFlag(int);
int Cnd_Gt(void) {
  int v = ArgNum();
  return (GetFlag(v) > ArgNum());
}


x86 assembly (clang, -O0):
<Cnd_Gt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <ArgNum@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <GetFlag@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <ArgNum@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
cmp    %ecx,%eax
setg   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cnd_Gt>:
push   %rbx
xor    %eax,%eax
call   1040 <ArgNum@plt>
mov    %eax,%edi
call   1030 <GetFlag@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <ArgNum@plt>
xor    %ecx,%ecx
cmp    %eax,%ebx
setg   %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @Cnd_Gt() {
%1 = alloca i32
%2 = call i32 (...) @ArgNum()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @GetFlag(i32 %3)
%5 = call i32 (...) @ArgNum()
%6 = icmp sgt i32 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @Cnd_Gt() {
%1 = tail call i32 (...) @ArgNum()
%2 = tail call i32 @GetFlag(i32 %1)
%3 = tail call i32 (...) @ArgNum()
%4 = icmp sgt i32 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
void ZamienNaPodkreslenie(char *Tekst) {
  for (; *Tekst; ++Tekst)
    if (*Tekst == ' ')
      *Tekst = '_';
}


x86 assembly (clang, -O0):
<ZamienNaPodkreslenie>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1142 <ZamienNaPodkreslenie+0x42>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    112c <ZamienNaPodkreslenie+0x2c>
mov    -0x8(%rbp),%rax
movb   $0x5f,(%rax)
jmp    1131 <ZamienNaPodkreslenie+0x31>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <ZamienNaPodkreslenie+0x8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ZamienNaPodkreslenie>:
jmp    1117 <ZamienNaPodkreslenie+0x17>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x5f,(%rdi)
add    $0x1,%rdi
movzbl (%rdi),%eax
cmp    $0x20,%al
je     1110 <ZamienNaPodkreslenie+0x10>
test   %al,%al
jne    1113 <ZamienNaPodkreslenie+0x13>
ret

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

LLVM IR (-O2):
define void @ZamienNaPodkreslenie(i8* nocapture %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = load i8, i8* %3
switch i8 %4, label %6 [
i8 0, label %8
i8 32, label %5
]
5: ; preds = %2
store i8 95, i8* %3
br label %6
6: ; preds = %2, %5
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
8: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ klogctl(int, int /*<<< orphan*/, int /*<<< orphan*/);
void clear_dmesg(void) { klogctl(5, 0, 0); }


x86 assembly (clang, -O0):
<clear_dmesg>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <klogctl@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_dmesg>:
mov    $0x5,%edi
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <klogctl@plt>

LLVM IR (-O0):
define void @clear_dmesg() {
%1 = call i32 @klogctl(i32 5, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @clear_dmesg() {
%1 = tail call i32 @klogctl(i32 5, i32 0, i32 0)
ret void
}
/* Variables and functions */
char *GetCRDelineatedString(char *, char *, int);
const char *GetNetSourceString(int iSource) {
  const char *p = GetCRDelineatedString("INGAMETEXT", "NET_SOURCES", iSource);
  return p ? p : "??";
}


x86 assembly (clang, -O0):
<GetNetSourceString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xedb(%rip),%rdi
lea    0xedf(%rip),%rsi
call   1030 <GetCRDelineatedString@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114d <GetNetSourceString+0x3d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    115d <GetNetSourceString+0x4d>
lea    0xec3(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    115d <GetNetSourceString+0x4d>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetNetSourceString>:
push   %rax
mov    %edi,%edx
lea    0xee6(%rip),%rdi
lea    0xeea(%rip),%rsi
call   1030 <GetCRDelineatedString@plt>
test   %rax,%rax
lea    0xee7(%rip),%rcx
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"INGAMETEXT\00"
@.str.1 = [12 x i8] c"NET_SOURCES\00"
@.str.2 = [3 x i8] c"??\00"
define i8* @GetNetSourceString(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @GetCRDelineatedString(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8*, i8** %3
br label %11
10: ; preds = %1
br label %11
11: ; preds = %10, %8
%12 = phi i8* [ %9, %8 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), %10 ]
ret i8* %12
}

LLVM IR (-O2):
@.str = [11 x i8] c"INGAMETEXT\00"
@.str.1 = [12 x i8] c"NET_SOURCES\00"
@.str.2 = [3 x i8] c"??\00"
define i8* @GetNetSourceString(i32 %0) {
%2 = tail call i8* @GetCRDelineatedString(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %0)
%3 = icmp eq i8* %2, null
%4 = select i1 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2
ret i8* %4
}
double PSItoATM(double PSI) {
  double ATM = 0.0680457 * PSI;
  return ATM;
}


x86 assembly (clang, -O0):
<PSItoATM>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<PSItoATM>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @PSItoATM(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = fmul double 6.804570e-02, %4
store double %5, double* %3
%6 = load double, double* %3
ret double %6
}

LLVM IR (-O2):
define double @PSItoATM(double %0) {
%2 = fmul double %0, 6.804570e-02
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  printf("course : EG1302A - spring2014\n");
  printf("name : Hassan Almotairi\n");
  printf("date created: %d/%d/%d\n", 1, 28, 2014);
  printf("assignment: assignment05\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
mov    $0x1,%esi
mov    $0x1c,%edx
mov    $0x7de,%ecx
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
lea    0xec0(%rip),%rdi
mov    $0x1,%esi
mov    $0x1c,%edx
mov    $0x7de,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"course : EG1302A - spring2014\0A\00"
@.str.1 = [25 x i8] c"name : Hassan Almotairi\0A\00"
@.str.2 = [24 x i8] c"date created: %d/%d/%d\0A\00"
@.str.3 = [26 x i8] c"assignment: assignment05\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 28, i32 2014)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [24 x i8] c"date created: %d/%d/%d\0A\00"
@str = [30 x i8] c"course : EG1302A - spring2014\00"
@str.4 = [24 x i8] c"name : Hassan Almotairi\00"
@str.5 = [25 x i8] c"assignment: assignment05\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 1, i32 28, i32 2014)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ReverseSegment(char *, char *);
void ReverseString(char string[]) {
  char *cp = string;
  if (cp) {
    while (*cp) {
      cp++;
    }
    ReverseSegment(string, cp - 1);
  }
}


x86 assembly (clang, -O0):
<ReverseString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1163 <ReverseString+0x53>
jmp    1134 <ReverseString+0x24>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1152 <ReverseString+0x42>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <ReverseString+0x24>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0xffffffffffffffff,%rsi
call   1030 <ReverseSegment@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReverseString>:
test   %rdi,%rdi
je     112f <ReverseString+0x1f>
lea    -0x2(%rdi),%rsi
nopl   0x0(%rax)
cmpb   $0x0,0x2(%rsi)
lea    0x1(%rsi),%rsi
jne    1120 <ReverseString+0x10>
jmp    1030 <ReverseSegment@plt>
ret

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

LLVM IR (-O2):
define void @ReverseString(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i8* [ %7, %3 ], [ %0, %1 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = getelementptr inbounds i8, i8* %4, i64 -1
%10 = tail call i32 @ReverseSegment(i8* %0, i8* %9)
br label %11
11: ; preds = %8, %1
ret void
}
void foo8(struct cell *c) {}


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

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

LLVM IR (-O0):
%struct.cell = type opaque
define void @foo8(%struct.cell* %0) {
%2 = alloca %struct.cell*
store %struct.cell* %0, %struct.cell** %2
ret void
}

LLVM IR (-O2):
%struct.cell = type opaque
define void @foo8(%struct.cell* nocapture %0) {
ret void
}
void __put(char c, char **_buf, char *ebuf, int *pcount) {
  char *buf = *_buf;
  if (ebuf > buf) {
    *buf++ = (c);
    *_buf = buf;
    *pcount += 1;
  } else
    *buf = '\0';
}


x86 assembly (clang, -O0):
<__put>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x28(%rbp),%rax
jbe    115e <__put+0x5e>
mov    -0x1(%rbp),%cl
mov    -0x28(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x28(%rbp)
mov    %cl,(%rax)
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    1165 <__put+0x65>
mov    -0x28(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__put>:
mov    (%rsi),%rax
cmp    %rdx,%rax
jae    1116 <__put+0x16>
mov    %dil,(%rax)
add    $0x1,%rax
mov    %rax,(%rsi)
addl   $0x1,(%rcx)
ret
movb   $0x0,(%rax)
ret

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

LLVM IR (-O2):
define void @__put(i8 signext %0, i8** nocapture %1, i8* readnone %2, i32* nocapture %3) {
%5 = load i8*, i8** %1
%6 = icmp ult i8* %5, %2
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %0, i8* %5
store i8* %8, i8** %1
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
store i32 %10, i32* %3
br label %12
11: ; preds = %4
store i8 0, i8* %5
br label %12
12: ; preds = %11, %7
ret void
}
/* Variables and functions */
unsigned long long rdmsr(int);
int /*<<< orphan*/ wrmsr(int, unsigned long long);
void apic2_enable(void) {
  wrmsr(0x1b, rdmsr(0x1b) | (1ULL << 10) | (1ULL << 11));
}


x86 assembly (clang, -O0):
<apic2_enable>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1b,%edi
call   1030 <rdmsr@plt>
mov    %rax,%rsi
or     $0x400,%rsi
or     $0x800,%rsi
mov    $0x1b,%edi
call   1040 <wrmsr@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<apic2_enable>:
push   %rax
mov    $0x1b,%edi
call   1030 <rdmsr@plt>
or     $0xc00,%rax
mov    $0x1b,%edi
mov    %rax,%rsi
pop    %rax
jmp    1040 <wrmsr@plt>

LLVM IR (-O0):
define void @apic2_enable() {
%1 = call i64 @rdmsr(i32 27)
%2 = or i64 %1, 1024
%3 = or i64 %2, 2048
%4 = call i32 @wrmsr(i32 27, i64 %3)
ret void
}

LLVM IR (-O2):
define void @apic2_enable() {
%1 = tail call i64 @rdmsr(i32 27)
%2 = or i64 %1, 3072
%3 = tail call i32 @wrmsr(i32 27, i64 %2)
ret void
}
int ls_cost_nm3_n_in(void) { return 2; }


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

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

LLVM IR (-O0):
define i32 @ls_cost_nm3_n_in() {
ret i32 2
}

LLVM IR (-O2):
define i32 @ls_cost_nm3_n_in() {
ret i32 2
}
int fun963() { return 963; }


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

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

LLVM IR (-O0):
define i32 @fun963() {
ret i32 963
}

LLVM IR (-O2):
define i32 @fun963() {
ret i32 963
}
void set_king(char *p) { *p |= (1 << 5); }


x86 assembly (clang, -O0):
<set_king>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
or     $0x20,%ecx
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_king>:
orb    $0x20,(%rdi)
ret

LLVM IR (-O0):
define void @set_king(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = or i32 %5, 32
%7 = trunc i32 %6 to i8
store i8 %7, i8* %3
ret void
}

LLVM IR (-O2):
define void @set_king(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = or i8 %2, 32
store i8 %3, i8* %0
ret void
}
/* Variables and functions */
int _eml_str_append_n(char **, char const *, int);
int _eml_str_append_range(char **to, const char *b, const char *e) {
  return _eml_str_append_n(to, b, e - b);
}


x86 assembly (clang, -O0):
<_eml_str_append_range>:
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),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1030 <_eml_str_append_n@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_eml_str_append_range>:
sub    %esi,%edx
jmp    1030 <_eml_str_append_n@plt>

LLVM IR (-O0):
define i32 @_eml_str_append_range(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 = load i8**, i8*** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = load i8*, i8** %5
%11 = ptrtoint i8* %9 to i64
%12 = ptrtoint i8* %10 to i64
%13 = sub i64 %11, %12
%14 = trunc i64 %13 to i32
%15 = call i32 @_eml_str_append_n(i8** %7, i8* %8, i32 %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @_eml_str_append_range(i8** %0, i8* %1, i8* %2) {
%4 = ptrtoint i8* %2 to i64
%5 = ptrtoint i8* %1 to i64
%6 = sub i64 %4, %5
%7 = trunc i64 %6 to i32
%8 = tail call i32 @_eml_str_append_n(i8** %0, i8* %1, i32 %7)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_gettimeofday() {
  printf("NOT IMPLEMENTED:"
         "pa_gettimeofday"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"NOT IMPLEMENTED:pa_gettimeofday\0A\00"
define i32 @pa_gettimeofday() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [32 x i8] c"NOT IMPLEMENTED:pa_gettimeofday\00"
define i32 @pa_gettimeofday() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() { printf("\nusage: pbs (NO ARGUMENTS)\n\n"); }


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

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

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

LLVM IR (-O2):
@str = [28 x i8] c"\0Ausage: pbs (NO ARGUMENTS)\0A\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ IO_get_byte();
int /*<<< orphan*/ put_argument2(char *, int /*<<< orphan*/, char *);
int am_absolute8(void) {
  put_argument2(" $", IO_get_byte(), "");
  return 2;
}


x86 assembly (clang, -O0):
<am_absolute8>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <IO_get_byte@plt>
mov    %eax,%esi
lea    0xecc(%rip),%rdi
lea    0xec7(%rip),%rdx
call   1040 <put_argument2@plt>
mov    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<am_absolute8>:
push   %rax
xor    %eax,%eax
call   1030 <IO_get_byte@plt>
lea    0xed1(%rip),%rdi
lea    0xecc(%rip),%rdx
mov    %eax,%esi
call   1040 <put_argument2@plt>
mov    $0x2,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c" $\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @am_absolute8() {
%1 = call i32 (...) @IO_get_byte()
%2 = call i32 @put_argument2(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret i32 2
}

LLVM IR (-O2):
@.str = [3 x i8] c" $\00"
@.str.1 = [1 x i8] zeroinitializer
define i32 @am_absolute8() {
%1 = tail call i32 (...) @IO_get_byte()
%2 = tail call i32 @put_argument2(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
ret i32 2
}