xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void *zzz() { printf("\rPLEASE TYPE 'quit' TO EXIT\n"); }


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"\0DPLEASE TYPE 'quit' TO EXIT\0A\00"
define i8* @zzz() {
%1 = alloca i8*
%2 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%3 = load i8*, i8** %1
ret i8* %3
}

LLVM IR (-O2):
@str = [28 x i8] c"\0DPLEASE TYPE 'quit' TO EXIT\00"
define noalias i8* @zzz() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret i8* undef
}
/* Variables and functions */
double domain(char *, char *);
double getanswer(char *to, char *from, double value) {
  double f = 1.0;
  int i;
  f *= domain(to, from);
  value *= f;
  return value;
}


x86 assembly (clang, -O0):
<getanswer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  0xed3(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <domain@plt>
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getanswer>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <domain@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @getanswer(i8* %0, i8* %1, double %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
%7 = alloca double
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store double %2, double* %6
store double 1.000000e+00, double* %7
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = call double @domain(i8* %9, i8* %10)
%12 = load double, double* %7
%13 = fmul double %12, %11
store double %13, double* %7
%14 = load double, double* %7
%15 = load double, double* %6
%16 = fmul double %15, %14
store double %16, double* %6
%17 = load double, double* %6
ret double %17
}

LLVM IR (-O2):
define double @getanswer(i8* %0, i8* %1, double %2) {
%4 = tail call double @domain(i8* %0, i8* %1)
%5 = fmul double %4, %2
ret double %5
}
/* Variables and functions */
double vec3d_norm(double *);
int /*<<< orphan*/ vec3d_scalarDiv(double *, double);
void vec3d_normalize(double v[3]) {
  double len = vec3d_norm(v);
  vec3d_scalarDiv(v, len);
}


x86 assembly (clang, -O0):
<vec3d_normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <vec3d_norm@plt>
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
call   1030 <vec3d_scalarDiv@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec3d_normalize>:
push   %rbx
mov    %rdi,%rbx
call   1040 <vec3d_norm@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <vec3d_scalarDiv@plt>

LLVM IR (-O0):
define void @vec3d_normalize(double* %0) {
%2 = alloca double*
%3 = alloca double
store double* %0, double** %2
%4 = load double*, double** %2
%5 = call double @vec3d_norm(double* %4)
store double %5, double* %3
%6 = load double*, double** %2
%7 = load double, double* %3
%8 = call i32 @vec3d_scalarDiv(double* %6, double %7)
ret void
}

LLVM IR (-O2):
define void @vec3d_normalize(double* %0) {
%2 = tail call double @vec3d_norm(double* %0)
%3 = tail call i32 @vec3d_scalarDiv(double* %0, double %2)
ret void
}
void vAltHold(void) {}


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

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

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

LLVM IR (-O2):
define void @vAltHold() {
ret void
}
void dma_memcpy(void *source, void *dest, unsigned count, unsigned mode) {
  if (mode != (0x80000000 | 0x00000000 | 0x00000000) &&
      mode != (0x80000000 | 0x00000000 | 0x04000000)) {
    return;
  }
  *(volatile unsigned int *)0x40000D4 = (unsigned int)source;
  *(volatile unsigned int *)0x40000D8 = (unsigned int)dest;
  *(volatile unsigned int *)0x40000DC = count | mode;
}


x86 assembly (clang, -O0):
<dma_memcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
cmpl   $0x80000000,-0x18(%rbp)
je     1131 <dma_memcpy+0x31>
cmpl   $0x84000000,-0x18(%rbp)
je     1131 <dma_memcpy+0x31>
jmp    1158 <dma_memcpy+0x58>
mov    -0x8(%rbp),%rax
mov    %eax,%ecx
mov    $0x40000d4,%eax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    $0x40000d8,%eax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%ecx
or     -0x18(%rbp),%ecx
mov    $0x40000dc,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<dma_memcpy>:
mov    %ecx,%eax
and    $0xfbffffff,%eax
cmp    $0x80000000,%eax
jne    1125 <dma_memcpy+0x25>
mov    %edi,0x40000d4
mov    %esi,0x40000d8
or     %edx,%ecx
mov    %ecx,0x40000dc
ret

LLVM IR (-O0):
define void @dma_memcpy(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, -2147483648
br i1 %10, label %11, label %15
11: ; preds = %4
%12 = load i32, i32* %8
%13 = icmp ne i32 %12, -2080374784
br i1 %13, label %14, label %15
14: ; preds = %11
br label %23
15: ; preds = %11, %4
%16 = load i8*, i8** %5
%17 = ptrtoint i8* %16 to i32
store volatile i32 %17, i32* inttoptr (i64 67109076 to i32*)
%18 = load i8*, i8** %6
%19 = ptrtoint i8* %18 to i32
store volatile i32 %19, i32* inttoptr (i64 67109080 to i32*)
%20 = load i32, i32* %7
%21 = load i32, i32* %8
%22 = or i32 %20, %21
store volatile i32 %22, i32* inttoptr (i64 67109084 to i32*)
br label %23
23: ; preds = %15, %14
ret void
}

LLVM IR (-O2):
define void @dma_memcpy(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = and i32 %3, -67108865
%6 = icmp eq i32 %5, -2147483648
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = ptrtoint i8* %0 to i64
%9 = trunc i64 %8 to i32
store volatile i32 %9, i32* inttoptr (i64 67109076 to i32*)
%10 = ptrtoint i8* %1 to i64
%11 = trunc i64 %10 to i32
store volatile i32 %11, i32* inttoptr (i64 67109080 to i32*)
%12 = or i32 %3, %2
store volatile i32 %12, i32* inttoptr (i64 67109084 to i32*)
br label %13
13: ; preds = %4, %7
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __enable_irq();
int /*<<< orphan*/ __set_BASEPRI(int /*<<< orphan*/);
void port_enable(void) {
  __set_BASEPRI(0);
  __enable_irq();
}


x86 assembly (clang, -O0):
<port_enable>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1040 <__set_BASEPRI@plt>
mov    $0x0,%al
call   1030 <__enable_irq@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<port_enable>:
push   %rax
xor    %edi,%edi
call   1040 <__set_BASEPRI@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <__enable_irq@plt>

LLVM IR (-O0):
define void @port_enable() {
%1 = call i32 @__set_BASEPRI(i32 0)
%2 = call i32 (...) @__enable_irq()
ret void
}

LLVM IR (-O2):
define void @port_enable() {
%1 = tail call i32 @__set_BASEPRI(i32 0)
%2 = tail call i32 (...) @__enable_irq()
ret void
}
void ux500_ci_dbg_console_check_uart(void) {}


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
define void @ux500_ci_dbg_console_check_uart() {
ret void
}
int _sign(float value) {
  if (value < 0.0f) {
    return -1;
  }
  if (value > 0.0f) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<_sign>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomiss -0x8(%rbp),%xmm0
jbe    1122 <_sign+0x22>
movl   $0xffffffff,-0x4(%rbp)
jmp    1146 <_sign+0x46>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    113f <_sign+0x3f>
movl   $0x1,-0x4(%rbp)
jmp    1146 <_sign+0x46>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @_sign(float %0) {
%2 = alloca i32
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = fcmp olt float %4, 0.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 -1, i32* %2
br label %12
7: ; preds = %1
%8 = load float, float* %3
%9 = fcmp ogt float %8, 0.000000e+00
br i1 %9, label %10, label %11
10: ; preds = %7
store i32 1, i32* %2
br label %12
11: ; preds = %7
store i32 0, i32* %2
br label %12
12: ; preds = %11, %10, %6
%13 = load i32, i32* %2
ret i32 %13
}

LLVM IR (-O2):
define i32 @_sign(float %0) {
%2 = fcmp olt float %0, 0.000000e+00
%3 = fcmp ogt float %0, 0.000000e+00
%4 = zext i1 %3 to i32
%5 = select i1 %2, i32 -1, i32 %4
ret i32 %5
}
/* Type definitions */
typedef scalar_t__ uid_t;

/* Variables and functions */
scalar_t__ geteuid();
int i_am_superuser(void) { return (geteuid() == (uid_t)0); }


x86 assembly (clang, -O0):
<i_am_superuser>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <geteuid@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<i_am_superuser>:
push   %rax
xor    %eax,%eax
call   1030 <geteuid@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @i_am_superuser() {
%1 = call i64 (...) @geteuid()
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}

LLVM IR (-O2):
define i32 @i_am_superuser() {
%1 = tail call i64 (...) @geteuid()
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int update_osii(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int invalidate_osii(char *destination) {
  return update_osii(destination, 0, 0);
}


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

x86 assembly (clang, -O2):
<invalidate_osii>:
xor    %esi,%esi
xor    %edx,%edx
jmp    1030 <update_osii@plt>

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

LLVM IR (-O2):
define i32 @invalidate_osii(i8* %0) {
%2 = tail call i32 @update_osii(i8* %0, i32 0, i32 0)
ret i32 %2
}
int f5(int e) { return (12 - (e & 7)) & 15; }


x86 assembly (clang, -O0):
<f5>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
and    $0x7,%ecx
mov    $0xc,%eax
sub    %ecx,%eax
and    $0xf,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f5>:
and    $0x7,%edi
mov    $0xc,%eax
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @f5(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 7
%5 = sub nsw i32 12, %4
%6 = and i32 %5, 15
ret i32 %6
}

LLVM IR (-O2):
define i32 @f5(i32 %0) {
%2 = and i32 %0, 7
%3 = sub nuw nsw i32 12, %2
ret i32 %3
}
void GaussCol_NEON() {}


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

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

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

LLVM IR (-O2):
define void @GaussCol_NEON() {
ret void
}
_prinum(i) int i;
{
  char buffer[40];
  _asschn();
  if (i >= 0)
    sprintf(buffer, " %d ", i);
  else
    sprintf(buffer, "-%d ", -i);
  _out(buffer);
}


x86 assembly (clang, -O0):
<_prinum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <_asschn@plt>
cmpl   $0x0,-0x8(%rbp)
jl     1166 <_prinum+0x36>
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xea6(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
jmp    117d <_prinum+0x4d>
lea    -0x30(%rbp),%rdi
xor    %edx,%edx
sub    -0x8(%rbp),%edx
lea    0xe8f(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x0,%al
call   1030 <_out@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_prinum>:
push   %rbx
sub    $0x30,%rsp
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <_asschn@plt>
test   %ebx,%ebx
js     114b <_prinum+0x1b>
lea    0xeb7(%rip),%rsi
jmp    1154 <_prinum+0x24>
neg    %ebx
lea    0xeb1(%rip),%rsi
mov    %rsp,%rdi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rsp,%rdi
xor    %eax,%eax
call   1030 <_out@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c" %d \00"
@.str.1 = [5 x i8] c"-%d \00"
define i32 @_prinum(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [40 x i8]
store i32 %0, i32* %3
%5 = call i32 (...) @_asschn()
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 0
%10 = load i32, i32* %3
%11 = call i32 (i8*, i8*, ...) @sprintf(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %10)
br label %17
12: ; preds = %1
%13 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 0
%14 = load i32, i32* %3
%15 = sub nsw i32 0, %14
%16 = call i32 (i8*, i8*, ...) @sprintf(i8* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %12, %8
%18 = getelementptr inbounds [40 x i8], [40 x i8]* %4, i64 0, i64 0
%19 = call i32 (i8*, ...) bitcast (i32 (...)* @_out to i32 (i8*, ...)*)(i8* %18)
%20 = load i32, i32* %2
ret i32 %20
}

LLVM IR (-O2):
@.str = [5 x i8] c" %d \00"
@.str.1 = [5 x i8] c"-%d \00"
define i32 @_prinum(i32 %0) {
%2 = alloca [40 x i8]
%3 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%4 = tail call i32 (...) @_asschn()
%5 = icmp sgt i32 %0, -1
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (i8*, i8*, ...) @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %11
8: ; preds = %1
%9 = sub nsw i32 0, %0
%10 = call i32 (i8*, i8*, ...) @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %8, %6
%12 = call i32 (i8*, ...) bitcast (i32 (...)* @_out to i32 (i8*, ...)*)(i8* %3)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ lab09();
int main(void) {
  lab09();
  return 1;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <lab09@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @lab09()
ret i32 1
}
int ph_http_post_deinit(void *handler) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ph_http_post_deinit(i8* nocapture readnone %0) {
ret i32 0
}
void parse_not(void *arg, struct Source *src, struct Result *res) {}


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

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

LLVM IR (-O0):
%struct.Source = type opaque
%struct.Result = type opaque
define void @parse_not(i8* %0, %struct.Source* %1, %struct.Result* %2) {
%4 = alloca i8*
%5 = alloca %struct.Source*
%6 = alloca %struct.Result*
store i8* %0, i8** %4
store %struct.Source* %1, %struct.Source** %5
store %struct.Result* %2, %struct.Result** %6
ret void
}

LLVM IR (-O2):
%struct.Source = type opaque
%struct.Result = type opaque
define void @parse_not(i8* nocapture %0, %struct.Source* nocapture %1, %struct.Result* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int x;
  printf("Please enter the integer you wish to calculate: ");
  scanf("%d", &x);
  int formula = (4 - x) / (4 + x);
  printf("\n Your result is %d: ", formula);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x4,%eax
sub    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xec9(%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    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xefb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
mov    $0x4,%eax
sub    %ecx,%eax
add    $0x4,%ecx
cltd
idiv   %ecx
lea    0xedc(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Please enter the integer you wish to calculate: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"\0A Your result is %d: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = sub nsw i32 4, %6
%8 = load i32, i32* %2
%9 = add nsw i32 4, %8
%10 = sdiv i32 %7, %9
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [49 x i8] c"Please enter the integer you wish to calculate: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [22 x i8] c"\0A Your result is %d: \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = sub nsw i32 4, %5
%7 = add nsw i32 %5, 4
%8 = sdiv i32 %6, %7
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %8)
ret i32 0
}
void board_startcmdwrite(void) {}


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

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

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

LLVM IR (-O2):
define void @board_startcmdwrite() {
ret void
}
/* Type definitions */
struct Node {
  int dummy;
};

/* Variables and functions */
struct Node *deleteAtPos(struct Node **, int /*<<< orphan*/);
struct Node *deleteFirst(struct Node **start) {
  return deleteAtPos(start, 0);
}


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

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

LLVM IR (-O0):
%struct.Node = type { i32 }
define %struct.Node* @deleteFirst(%struct.Node** %0) {
%2 = alloca %struct.Node**
store %struct.Node** %0, %struct.Node*** %2
%3 = load %struct.Node**, %struct.Node*** %2
%4 = call %struct.Node* @deleteAtPos(%struct.Node** %3, i32 0)
ret %struct.Node* %4
}

LLVM IR (-O2):
%struct.Node = type { i32 }
define %struct.Node* @deleteFirst(%struct.Node** %0) {
%2 = tail call %struct.Node* @deleteAtPos(%struct.Node** %0, i32 0)
ret %struct.Node* %2
}
/* Type definitions */
struct cs1550_sem {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ syscall(int, struct cs1550_sem *);
void down(struct cs1550_sem *sem) { syscall(326, sem); }


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

x86 assembly (clang, -O2):
<down>:
mov    %rdi,%rsi
mov    $0x146,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.cs1550_sem = type { i32 }
define void @down(%struct.cs1550_sem* %0) {
%2 = alloca %struct.cs1550_sem*
store %struct.cs1550_sem* %0, %struct.cs1550_sem** %2
%3 = load %struct.cs1550_sem*, %struct.cs1550_sem** %2
%4 = call i32 @syscall(i32 326, %struct.cs1550_sem* %3)
ret void
}

LLVM IR (-O2):
%struct.cs1550_sem = type { i32 }
define void @down(%struct.cs1550_sem* %0) {
%2 = tail call i32 @syscall(i32 326, %struct.cs1550_sem* %0)
ret void
}
/* Variables and functions */
char *memchr(char const *, char, size_t);
size_t strnlen(const char *string, size_t maxlen) {
  const char *end = memchr(string, '\0', maxlen);
  return end ? end - string : maxlen;
}


x86 assembly (clang, -O0):
<strnlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <memchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1152 <strnlen+0x42>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    115a <strnlen+0x4a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnlen>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %esi,%esi
mov    %r14,%rdx
call   1030 <memchr@plt>
mov    %rax,%rcx
sub    %rbx,%rcx
test   %rax,%rax
cmove  %r14,%rcx
mov    %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @strnlen(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* @memchr(i8* %6, i8 signext 0, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i8*, i8** %5
%13 = load i8*, i8** %3
%14 = ptrtoint i8* %12 to i64
%15 = ptrtoint i8* %13 to i64
%16 = sub i64 %14, %15
br label %19
17: ; preds = %2
%18 = load i64, i64* %4
br label %19
19: ; preds = %17, %11
%20 = phi i64 [ %16, %11 ], [ %18, %17 ]
ret i64 %20
}

LLVM IR (-O2):
define i64 @strnlen(i8* %0, i64 %1) {
%3 = tail call i8* @memchr(i8* %0, i8 signext 0, i64 %1)
%4 = icmp eq i8* %3, null
%5 = ptrtoint i8* %3 to i64
%6 = ptrtoint i8* %0 to i64
%7 = sub i64 %5, %6
%8 = select i1 %4, i64 %1, i64 %7
ret i64 %8
}
unsigned xrop3_154_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = ~S;
  stk2 = T & stk3;
  stk1 = D ^ stk2;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_154_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
and    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_154_1_0>:
mov    %edi,%eax
shl    $0x8,%eax
or     %edi,%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     %esi,%ecx
not    %eax
and    %ecx,%eax
xor    %edi,%eax
xor    $0xff,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_154_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = xor i32 %23, -1
store i32 %24, i32* %10
%25 = load i32, i32* %7
%26 = load i32, i32* %10
%27 = and i32 %25, %26
store i32 %27, i32* %9
%28 = load i32, i32* %5
%29 = load i32, i32* %9
%30 = xor i32 %28, %29
store i32 %30, i32* %8
%31 = load i32, i32* %8
%32 = load i32, i32* %6
%33 = xor i32 %32, -1
%34 = and i32 %31, %33
%35 = load i32, i32* %5
%36 = load i32, i32* %6
%37 = and i32 %35, %36
%38 = or i32 %34, %37
ret i32 %38
}

LLVM IR (-O2):
define i32 @xrop3_154_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = xor i32 %4, -1
%8 = and i32 %6, %7
%9 = xor i32 %8, %3
%10 = xor i32 %9, 255
%11 = or i32 %10, %3
ret i32 %11
}
float rintf(float x) {
  __asm__("frndint" : "+t"(x));
  return x;
}


x86 assembly (clang, -O0):
<rintf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
flds   -0x8(%rbp)
frndint
fstps  -0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rintf>:
movss  %xmm0,-0x4(%rsp)
flds   -0x4(%rsp)
frndint
fstps  -0x8(%rsp)
movss  -0x8(%rsp),%xmm0
ret

LLVM IR (-O0):
define float @rintf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float asm "frndint", "={st},0,~{dirflag},~{fpsr},~{flags}"(float %3)
store float %4, float* %2
%5 = load float, float* %2
ret float %5
}

LLVM IR (-O2):
define float @rintf(float %0) {
%2 = tail call float asm "frndint", "={st},0,~{dirflag},~{fpsr},~{flags}"(float %0)
ret float %2
}
void av_hash_names() {}


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

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

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

LLVM IR (-O2):
define void @av_hash_names() {
ret void
}
int test_imm_32int8_mem(signed char *val) {
  return ((*val) & (-0x32 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_32int8_mem(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 = and i32 %5, -50
%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_32int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -50
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int test_imm_8Auint8_reg(unsigned char val) {
  return ((val) & (-0x8A << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_8Auint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xffffff76,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_8Auint8_reg>:
test   $0x76,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_8Auint8_reg(i8 zeroext %0) {
%2 = and i8 %0, 118
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ iothub_client_sample_http_run();
int main(void) {
  iothub_client_sample_http_run();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @iothub_client_sample_http_run()
ret i32 0
}
void g_ascii_strtod() {}


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

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

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

LLVM IR (-O2):
define void @g_ascii_strtod() {
ret void
}
/* Variables and functions */
int Q_strncasecmp(char const *, char const *, int);
int Q_stricmp(const char *s1, const char *s2) {
  return Q_strncasecmp(s1, s2, 99999);
}


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

x86 assembly (clang, -O2):
<Q_stricmp>:
mov    $0x1869f,%edx
jmp    1030 <Q_strncasecmp@plt>

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

LLVM IR (-O2):
define i32 @Q_stricmp(i8* %0, i8* %1) {
%3 = tail call i32 @Q_strncasecmp(i8* %0, i8* %1, i32 99999)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ kprintf(char *, int);
void isrHandle5() { kprintf("ISR %d.\n", 5); }


x86 assembly (clang, -O0):
<isrHandle5>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x5,%esi
call   1030 <kprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<isrHandle5>:
lea    0xee9(%rip),%rdi
mov    $0x5,%esi
jmp    1030 <kprintf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"ISR %d.\0A\00"
define void @isrHandle5() {
%1 = call i32 @kprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 5)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"ISR %d.\0A\00"
define void @isrHandle5() {
%1 = tail call i32 @kprintf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("usage: enter values p q e\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"usage: enter values p q e\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [26 x i8] c"usage: enter values p q e\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ bcm2835_gpio_clr(scalar_t__);
int /*<<< orphan*/ bcm2835_gpio_set(scalar_t__);
void bcm2835_gpio_write(uint8_t pin, uint8_t on) {
  if (on)
    bcm2835_gpio_set(pin);
  else
    bcm2835_gpio_clr(pin);
}


x86 assembly (clang, -O0):
<bcm2835_gpio_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1149 <bcm2835_gpio_write+0x29>
mov    -0x8(%rbp),%rdi
call   1030 <bcm2835_gpio_set@plt>
jmp    1152 <bcm2835_gpio_write+0x32>
mov    -0x8(%rbp),%rdi
call   1040 <bcm2835_gpio_clr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bcm2835_gpio_write>:
test   %rsi,%rsi
je     112a <bcm2835_gpio_write+0xa>
jmp    1030 <bcm2835_gpio_set@plt>
jmp    1040 <bcm2835_gpio_clr@plt>

LLVM IR (-O0):
define void @bcm2835_gpio_write(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i64, i64* %3
%9 = call i32 @bcm2835_gpio_set(i64 %8)
br label %13
10: ; preds = %2
%11 = load i64, i64* %3
%12 = call i32 @bcm2835_gpio_clr(i64 %11)
br label %13
13: ; preds = %10, %7
ret void
}

LLVM IR (-O2):
define void @bcm2835_gpio_write(i64 %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @bcm2835_gpio_set(i64 %0)
br label %8
6: ; preds = %2
%7 = tail call i32 @bcm2835_gpio_clr(i64 %0)
br label %8
8: ; preds = %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
int puts(const char *str) {
  print(str, strlen(str));
  return 0;
}


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%esi
call   1040 <print@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <print@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @puts(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @print(i8* %0, i32 %2)
ret i32 0
}
/* Type definitions */
struct can_frame {
  int can_dlc;
};

/* Variables and functions */
int nmt_is_valid(const struct can_frame *frame) { return frame->can_dlc == 2; }


x86 assembly (clang, -O0):
<nmt_is_valid>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x2,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nmt_is_valid>:
xor    %eax,%eax
cmpl   $0x2,(%rdi)
sete   %al
ret

LLVM IR (-O0):
%struct.can_frame = type { i32 }
define i32 @nmt_is_valid(%struct.can_frame* %0) {
%2 = alloca %struct.can_frame*
store %struct.can_frame* %0, %struct.can_frame** %2
%3 = load %struct.can_frame*, %struct.can_frame** %2
%4 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %3, i32 0, i32 0
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 2
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
%struct.can_frame = type { i32 }
define i32 @nmt_is_valid(%struct.can_frame* nocapture %0) {
%2 = getelementptr inbounds %struct.can_frame, %struct.can_frame* %0, i64 0, i32 0
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 2
%5 = zext i1 %4 to i32
ret i32 %5
}
double adjust_bank_balance(double bank_balance, double wager_amount,
                           int add_or_subtract) {
  double temp_balance = bank_balance;
  if (add_or_subtract == 1) {
    temp_balance = bank_balance + wager_amount;
  } else if (add_or_subtract == 0) {
    temp_balance = bank_balance - wager_amount;
  }
  return temp_balance;
}


x86 assembly (clang, -O0):
<adjust_bank_balance>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    1139 <adjust_bank_balance+0x39>
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1157 <adjust_bank_balance+0x57>
cmpl   $0x0,-0x14(%rbp)
jne    1152 <adjust_bank_balance+0x52>
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1157 <adjust_bank_balance+0x57>
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<adjust_bank_balance>:
test   %edi,%edi
je     110e <adjust_bank_balance+0xe>
cmp    $0x1,%edi
jne    1112 <adjust_bank_balance+0x12>
addsd  %xmm1,%xmm0
ret
subsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @adjust_bank_balance(double %0, double %1, i32 %2) {
switch i32 %2, label %8 [
i32 1, label %4
i32 0, label %6
]
4: ; preds = %3
%5 = fadd double %0, %1
br label %8
6: ; preds = %3
%7 = fsub double %0, %1
br label %8
8: ; preds = %3, %6, %4
%9 = phi double [ %5, %4 ], [ %7, %6 ], [ %0, %3 ]
ret double %9
}
/* Variables and functions */
int drand48();
double vf() { return 1 - drand48() * 2; }


x86 assembly (clang, -O0):
<vf>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <drand48@plt>
mov    %eax,%ecx
shl    $0x1,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<vf>:
push   %rax
xor    %eax,%eax
call   1030 <drand48@plt>
add    %eax,%eax
mov    $0x1,%ecx
sub    %eax,%ecx
cvtsi2sd %ecx,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @vf() {
%1 = call i32 (...) @drand48()
%2 = mul nsw i32 %1, 2
%3 = sub nsw i32 1, %2
%4 = sitofp i32 %3 to double
ret double %4
}

LLVM IR (-O2):
define double @vf() {
%1 = tail call i32 (...) @drand48()
%2 = mul i32 %1, -2
%3 = or i32 %2, 1
%4 = sitofp i32 %3 to double
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int test4() {
  unsigned long long result = 1;
#pragma omp target parallel map(tofrom : result)
#pragma omp single
  { result = result << 60; }
  if (result != 1ll << 60) {
    printf("shift result = %llx\n", result);
    return 1;
  }
  printf("Shift test OK!\n");
  return 0;
}


x86 assembly (clang, -O0):
<test4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x3c,%rax
mov    %rax,-0x10(%rbp)
movabs $0x1000000000000000,%rax
cmp    %rax,-0x10(%rbp)
je     115e <test4+0x4e>
mov    -0x10(%rbp),%rsi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1173 <test4+0x63>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test4>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"shift result = %llx\0A\00"
@.str.1 = [16 x i8] c"Shift test OK!\0A\00"
define i32 @test4() {
%1 = alloca i32
%2 = alloca i64
store i64 1, i64* %2
%3 = load i64, i64* %2
%4 = shl i64 %3, 60
store i64 %4, i64* %2
%5 = load i64, i64* %2
%6 = icmp ne i64 %5, 1152921504606846976
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = load i64, i64* %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i64 %8)
store i32 1, i32* %1
br label %12
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %12
12: ; preds = %10, %7
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@str = [15 x i8] c"Shift test OK!\00"
define i32 @test4() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  printf("hello,world\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"hello,world\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [12 x i8] c"hello,world\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ e_and();
int /*<<< orphan*/ e_izpy();
void e_and_izpy() {
  e_izpy();
  e_and();
}


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

x86 assembly (clang, -O2):
<e_and_izpy>:
push   %rax
xor    %eax,%eax
call   1040 <e_izpy@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <e_and@plt>

LLVM IR (-O0):
define void @e_and_izpy() {
%1 = call i32 (...) @e_izpy()
%2 = call i32 (...) @e_and()
ret void
}

LLVM IR (-O2):
define void @e_and_izpy() {
%1 = tail call i32 (...) @e_izpy()
%2 = tail call i32 (...) @e_and()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int i;
  int num = 20;
  for (i = 0; i < num; i++) {
    if (0 == i % 2)
      printf("%d\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x14,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1170 <main+0x60>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    %edx,%eax
jne    115d <main+0x4d>
mov    -0x8(%rbp),%esi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
jmp    1162 <main+0x52>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xee3(%rip),%r14
jmp    1128 <main+0x18>
nop
add    $0x1,%ebx
cmp    $0x14,%ebx
je     1139 <main+0x29>
test   $0x1,%bl
jne    1120 <main+0x10>
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
jmp    1120 <main+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %7
%2 = phi i32 [ 0, %0 ], [ %8, %7 ]
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %7
7: ; preds = %1, %5
%8 = add nuw nsw i32 %2, 1
%9 = icmp eq i32 %8, 20
br i1 %9, label %10, label %1
10: ; preds = %7
ret i32 0
}
void debug_if(int condition, const char *format, ...) {}


x86 assembly (clang, -O0):
<debug_if>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @debug_if(i32 %0, i8* %1, ...) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @debug_if(i32 %0, i8* nocapture %1, ...) {
ret void
}
void arr_access(int *arr, char *p, int i) {
  int x = arr[0];
  arr[x] = 1;
  *(p + i) = 'a';
}


x86 assembly (clang, -O0):
<arr_access>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x61,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<arr_access>:
movslq (%rdi),%rax
movl   $0x1,(%rdi,%rax,4)
movslq %edx,%rax
movb   $0x61,(%rsi,%rax,1)
ret

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

LLVM IR (-O2):
define void @arr_access(i32* nocapture %0, i8* nocapture writeonly %1, i32 %2) {
%4 = load i32, i32* %0
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %0, i64 %5
store i32 1, i32* %6
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %1, i64 %7
store i8 97, i8* %8
ret void
}