xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int do_echo(int argc, char **argv) {
  for (int i = 1; i < argc; i++) {
    printf("%s ", argv[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<do_echo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    115a <do_echo+0x4a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1126 <do_echo+0x16>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_echo>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     1157 <do_echo+0x37>
mov    %rsi,%r15
mov    %edi,%r12d
mov    $0x1,%ebx
lea    0xec1(%rip),%r14
nop
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <do_echo+0x20>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s \00"
define i32 @do_echo(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %8
6: ; preds = %8, %2
%7 = tail call i32 @putchar(i32 10)
ret i32 0
8: ; preds = %4, %8
%9 = phi i64 [ 1, %4 ], [ %13, %8 ]
%10 = getelementptr inbounds i8*, i8** %1, i64 %9
%11 = load i8*, i8** %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %6, label %8
}
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn57() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn57");
  return result;
}


x86 assembly (clang, -O0):
<fn57>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1e,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn57>:
push   %rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1e,%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fn57\00"
define i8* @fn57() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 20
%4 = add nsw i32 20, %3
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 20
%9 = add nsw i32 30, %8
%10 = call i8* @realloc(i8* %6, i32 %9)
store i8* %10, i8** %1
%11 = load i8*, i8** %1
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@.str = [5 x i8] c"fn57\00"
define i8* @fn57() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 20
%3 = add nsw i32 %2, 20
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 20
%7 = add nsw i32 %6, 30
%8 = tail call i8* @realloc(i8* %4, i32 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ acosh(double);
int /*<<< orphan*/ acoshf(float);
int /*<<< orphan*/ acoshl(long double);
void invalidFunctionArg_acosh(void) {
  float f = .999f;
  (void)acoshf(f);
  f = 1.0f;
  (void)acoshf(f);
  double d = .999;
  (void)acosh(d);
  d = 1.0;
  (void)acosh(d);
  long double ld = .999L;
  (void)acoshl(ld);
  ld = 1.0;
  (void)acoshl(ld);
}


x86 assembly (clang, -O0):
<invalidFunctionArg_acosh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x3f7fbe77,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <acoshf@plt>
movl   $0x3f800000,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <acoshf@plt>
movabs $0x3feff7ced916872b,%rax
f7 ef 3f
mov    %rax,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <acosh@plt>
movabs $0x3ff0000000000000,%rax
mov    %rax,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <acosh@plt>
fldt   0xe70(%rip)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1050 <acoshl@plt>
fld1
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1050 <acoshl@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<invalidFunctionArg_acosh>:
sub    $0x18,%rsp
movss  0xec4(%rip),%xmm0
call   1040 <acoshf@plt>
movss  0xebb(%rip),%xmm0
call   1040 <acoshf@plt>
movsd  0xeb2(%rip),%xmm0
call   1030 <acosh@plt>
movsd  0xead(%rip),%xmm0
call   1030 <acosh@plt>
fldt   0xeb2(%rip)
fstpt  (%rsp)
call   1050 <acoshl@plt>
fld1
fstpt  (%rsp)
call   1050 <acoshl@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define void @invalidFunctionArg_acosh() {
%1 = alloca float
%2 = alloca double
%3 = alloca x86_fp80
store float 0x3FEFF7CEE0000000, float* %1
%4 = load float, float* %1
%5 = call i32 @acoshf(float %4)
store float 1.000000e+00, float* %1
%6 = load float, float* %1
%7 = call i32 @acoshf(float %6)
store double 0x3FEFF7CED916872B, double* %2
%8 = load double, double* %2
%9 = call i32 @acosh(double %8)
store double 1.000000e+00, double* %2
%10 = load double, double* %2
%11 = call i32 @acosh(double %10)
store x86_fp80 0xK3FFEFFBE76C8B4395810, x86_fp80* %3
%12 = load x86_fp80, x86_fp80* %3
%13 = call i32 @acoshl(x86_fp80 %12)
store x86_fp80 0xK3FFF8000000000000000, x86_fp80* %3
%14 = load x86_fp80, x86_fp80* %3
%15 = call i32 @acoshl(x86_fp80 %14)
ret void
}

LLVM IR (-O2):
define void @invalidFunctionArg_acosh() {
%1 = tail call i32 @acoshf(float 0x3FEFF7CEE0000000)
%2 = tail call i32 @acoshf(float 1.000000e+00)
%3 = tail call i32 @acosh(double 0x3FEFF7CED916872B)
%4 = tail call i32 @acosh(double 1.000000e+00)
%5 = tail call i32 @acoshl(x86_fp80 0xK3FFEFFBE76C8B4395810)
%6 = tail call i32 @acoshl(x86_fp80 0xK3FFF8000000000000000)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _cc3_fifo_read_inc();
void _cc3_pixbuf_skip_subpixel(void) { _cc3_fifo_read_inc(); }


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

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

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

LLVM IR (-O2):
define void @_cc3_pixbuf_skip_subpixel() {
%1 = tail call i32 (...) @_cc3_fifo_read_inc()
ret void
}
/* Variables and functions */
double cdfgno_(double *, double *);
double ccdfgno(double *x, double *para) { return cdfgno_(x, para); }


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

x86 assembly (clang, -O2):
<ccdfgno>:
jmp    1030 <cdfgno_@plt>

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

LLVM IR (-O2):
define double @ccdfgno(double* %0, double* %1) {
%3 = tail call double @cdfgno_(double* %0, double* %1)
ret double %3
}
void rop3_251_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  unsigned char stk2;
  unsigned char stk3;
  stk3 = ~S;
  stk2 = T | stk3;
  stk1 = *D | stk2;
  *D = stk1;
}


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

x86 assembly (clang, -O2):
<rop3_251_0_0>:
not    %sil
or     %dl,%sil
or     %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_251_0_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = xor i32 %11, -1
%13 = trunc i32 %12 to i8
store i8 %13, i8* %9
%14 = load i8, i8* %6
%15 = zext i8 %14 to i32
%16 = load i8, i8* %9
%17 = zext i8 %16 to i32
%18 = or i32 %15, %17
%19 = trunc i32 %18 to i8
store i8 %19, i8* %8
%20 = load i8*, i8** %4
%21 = load i8, i8* %20
%22 = zext i8 %21 to i32
%23 = load i8, i8* %8
%24 = zext i8 %23 to i32
%25 = or i32 %22, %24
%26 = trunc i32 %25 to i8
store i8 %26, i8* %7
%27 = load i8, i8* %7
%28 = load i8*, i8** %4
store i8 %27, i8* %28
ret void
}

LLVM IR (-O2):
define void @rop3_251_0_0(i8* nocapture %0, i8 zeroext %1, i8 zeroext %2) {
%4 = xor i8 %1, -1
%5 = or i8 %4, %2
%6 = load i8, i8* %0
%7 = or i8 %5, %6
store i8 %7, i8* %0
ret void
}
int __kfifo_int_must_check_helper(int val) { return val; }


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

x86 assembly (clang, -O2):
<__kfifo_int_must_check_helper>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @__kfifo_int_must_check_helper(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int s(int, int);
uint32_t s_4(uint32_t x) { return s(x, 17) ^ s(x, 19) ^ (x >> 10); }


x86 assembly (clang, -O0):
<s_4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x11,%esi
call   1030 <s@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x13,%esi
call   1030 <s@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
xor    %ecx,%eax
mov    -0x4(%rbp),%ecx
sar    $0xa,%ecx
xor    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_4>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x11,%esi
call   1030 <s@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x13,%esi
call   1030 <s@plt>
sar    $0xa,%ebx
xor    %ebp,%ebx
xor    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @s_4(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @s(i32 %3, i32 17)
%5 = load i32, i32* %2
%6 = call i32 @s(i32 %5, i32 19)
%7 = xor i32 %4, %6
%8 = load i32, i32* %2
%9 = ashr i32 %8, 10
%10 = xor i32 %7, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @s_4(i32 %0) {
%2 = tail call i32 @s(i32 %0, i32 17)
%3 = tail call i32 @s(i32 %0, i32 19)
%4 = ashr i32 %0, 10
%5 = xor i32 %2, %4
%6 = xor i32 %5, %3
ret i32 %6
}
/* Variables and functions */
int Si1132_I2C_read16(int);
int /*<<< orphan*/ usleep(int);
float Si1132_readIR() {
  usleep(10000);
  return ((Si1132_I2C_read16(0x24) - 250) / 2.44) * 14.5;
}


x86 assembly (clang, -O0):
<Si1132_readIR>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2710,%edi
call   1040 <usleep@plt>
mov    $0x24,%edi
call   1030 <Si1132_I2C_read16@plt>
sub    $0xfa,%eax
cvtsi2sd %eax,%xmm0
movsd  0xebf(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xeab(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Si1132_readIR>:
push   %rax
mov    $0x2710,%edi
call   1040 <usleep@plt>
mov    $0x24,%edi
call   1030 <Si1132_I2C_read16@plt>
add    $0xffffff06,%eax
cvtsi2sd %eax,%xmm0
divsd  0xeba(%rip),%xmm0
mulsd  0xeba(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @Si1132_readIR() {
%1 = call i32 @usleep(i32 10000)
%2 = call i32 @Si1132_I2C_read16(i32 36)
%3 = sub nsw i32 %2, 250
%4 = sitofp i32 %3 to double
%5 = fdiv double %4, 2.440000e+00
%6 = fmul double %5, 1.450000e+01
%7 = fptrunc double %6 to float
ret float %7
}

LLVM IR (-O2):
define float @Si1132_readIR() {
%1 = tail call i32 @usleep(i32 10000)
%2 = tail call i32 @Si1132_I2C_read16(i32 36)
%3 = add nsw i32 %2, -250
%4 = sitofp i32 %3 to double
%5 = fdiv double %4, 2.440000e+00
%6 = fmul double %5, 1.450000e+01
%7 = fptrunc double %6 to float
ret float %7
}
/* Type definitions */
struct polygon {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct polygon *);
void poly_free(struct polygon *poly) { free(poly); }


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

x86 assembly (clang, -O2):
<poly_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.polygon = type { i32 }
define void @poly_free(%struct.polygon* nocapture %0) {
%2 = tail call i32 @free(%struct.polygon* %0)
ret void
}
/* Variables and functions */
int HZ;
int /*<<< orphan*/ __delay(unsigned long);
void udelay(unsigned long usecs) {
  extern unsigned long loops_per_jiffy;
  __delay(usecs * loops_per_jiffy / (1000000 / HZ));
}


x86 assembly (clang, -O0):
<udelay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2ec1(%rip),%rcx
imul   (%rcx),%rax
mov    %rax,-0x10(%rbp)
mov    $0xf4240,%eax
mov    0x2e9d(%rip),%rcx
cltd
idivl  (%rcx)
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
xor    %edx,%edx
div    %rcx
mov    %rax,%rdi
call   1030 <__delay@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<udelay>:
mov    0x2ed1(%rip),%rax
imul   (%rax),%rdi
mov    0x2eb6(%rip),%rcx
mov    $0xf4240,%eax
xor    %edx,%edx
idivl  (%rcx)
mov    %eax,%ecx
movslq %eax,%rsi
mov    %rdi,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     114c <udelay+0x3c>
mov    %rdi,%rax
xor    %edx,%edx
div    %rsi
mov    %rax,%rdi
jmp    1030 <__delay@plt>
mov    %edi,%eax
xor    %edx,%edx
div    %ecx
mov    %rax,%rdi
jmp    1030 <__delay@plt>

LLVM IR (-O0):
@loops_per_jiffy = external global i64
@HZ = global i32 0
define void @udelay(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i64, i64* @loops_per_jiffy
%5 = mul i64 %3, %4
%6 = load i32, i32* @HZ
%7 = sdiv i32 1000000, %6
%8 = sext i32 %7 to i64
%9 = udiv i64 %5, %8
%10 = call i32 @__delay(i64 %9)
ret void
}

LLVM IR (-O2):
@loops_per_jiffy = external global i64
@HZ = global i32 0
define void @udelay(i64 %0) {
%2 = load i64, i64* @loops_per_jiffy
%3 = mul i64 %2, %0
%4 = load i32, i32* @HZ
%5 = sdiv i32 1000000, %4
%6 = sext i32 %5 to i64
%7 = udiv i64 %3, %6
%8 = tail call i32 @__delay(i64 %7)
ret void
}
void test3_bar() {}


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

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

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

LLVM IR (-O2):
define void @test3_bar() {
ret void
}
/* Variables and functions */
float fabs(float);
float f_abs(float x) { return fabs(x); }


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

x86 assembly (clang, -O2):
<f_abs>:
andps  0xef9(%rip),%xmm0
ret

LLVM IR (-O0):
define float @f_abs(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @fabs(float %3)
ret float %4
}

LLVM IR (-O2):
define float @f_abs(float %0) {
%2 = tail call float @llvm.fabs.f32(float %0)
ret float %2
}
int main() {
  int a = 0;
  switch (0) {
  case 0:
    a += 1;
  case 1:
    a += 2;
  case 2:
    a += 3;
  default:
    a += 4;
  }
  return a;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 10
}
/* Type definitions */
typedef int ptrdiff_t;

/* Variables and functions */
ptrdiff_t posrelat(ptrdiff_t pos, size_t len) {
  return (pos >= 0) ? pos : (ptrdiff_t)len + pos + 1;
}


x86 assembly (clang, -O0):
<posrelat>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1120 <posrelat+0x20>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    112d <posrelat+0x2d>
mov    -0x10(%rbp),%rax
add    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<posrelat>:
test   %edi,%edi
lea    0x1(%rdi,%rsi,1),%eax
cmovns %edi,%eax
ret

LLVM IR (-O0):
define i32 @posrelat(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i32, i32* %3
br label %15
9: ; preds = %2
%10 = load i64, i64* %4
%11 = trunc i64 %10 to i32
%12 = load i32, i32* %3
%13 = add nsw i32 %11, %12
%14 = add nsw i32 %13, 1
br label %15
15: ; preds = %9, %7
%16 = phi i32 [ %8, %7 ], [ %14, %9 ]
ret i32 %16
}

LLVM IR (-O2):
define i32 @posrelat(i32 %0, i64 %1) {
%3 = icmp sgt i32 %0, -1
%4 = trunc i64 %1 to i32
%5 = add i32 %0, 1
%6 = add i32 %5, %4
%7 = select i1 %3, i32 %0, i32 %6
ret i32 %7
}
/* Variables and functions */
long double euclid_dist(double *, double *, int);
int sim_stop_ck(double *p1, double *p2, int len, long double tol) {
  if (euclid_dist(p1, p2, len) < tol)
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<sim_stop_ck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
fstpt  -0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <euclid_dist@plt>
fldt   -0x30(%rbp)
fucomip %st(1),%st
fstp   %st(0)
jbe    1157 <sim_stop_ck+0x47>
jmp    114b <sim_stop_ck+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    115e <sim_stop_ck+0x4e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sim_stop_ck>:
sub    $0x18,%rsp
fldt   0x20(%rsp)
fstpt  0xc(%rsp)
call   1030 <euclid_dist@plt>
xor    %eax,%eax
fldt   0xc(%rsp)
fucomip %st(1),%st
fstp   %st(0)
setbe  %al
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @sim_stop_ck(double* %0, double* %1, i32 %2, x86_fp80 %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca double*
%8 = alloca i32
%9 = alloca x86_fp80
store double* %0, double** %6
store double* %1, double** %7
store i32 %2, i32* %8
store x86_fp80 %3, x86_fp80* %9
%10 = load double*, double** %6
%11 = load double*, double** %7
%12 = load i32, i32* %8
%13 = call x86_fp80 @euclid_dist(double* %10, double* %11, i32 %12)
%14 = load x86_fp80, x86_fp80* %9
%15 = fcmp olt x86_fp80 %13, %14
br i1 %15, label %16, label %17
16: ; preds = %4
store i32 0, i32* %5
br label %18
17: ; preds = %4
store i32 1, i32* %5
br label %18
18: ; preds = %17, %16
%19 = load i32, i32* %5
ret i32 %19
}

LLVM IR (-O2):
define i32 @sim_stop_ck(double* %0, double* %1, i32 %2, x86_fp80 %3) {
%5 = tail call x86_fp80 @euclid_dist(double* %0, double* %1, i32 %2)
%6 = fcmp uge x86_fp80 %5, %3
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc == 1) {
    fprintf(stderr, "pkill: no matching criteria specified\nTry `pkill --help' "
                    "for more information.\n");
    return 1;
  }
  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)
cmpl   $0x1,-0x8(%rbp)
jne    1151 <main+0x41>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1158 <main+0x48>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
cmp    $0x1,%edi
jne    1136 <main+0x26>
push   %rax
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
lea    0xed8(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [80 x i8] c"pkill: no matching criteria specified\0ATry `pkill --help' for more information.\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 = load i32, i32* %4
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %12
11: ; preds = %2
store i32 0, i32* %3
br label %12
12: ; preds = %11, %8
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [80 x i8] c"pkill: no matching criteria specified\0ATry `pkill --help' for more information.\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %2, %4
%8 = phi i32 [ 1, %4 ], [ 0, %2 ]
ret i32 %8
}
char *remove_subgrid(char ***g, int slice, int index, int pos) {
  return g[(slice / 3) * 3 + index / 3][(slice % 3) * 3 + index % 3] + pos;
}


x86 assembly (clang, -O0):
<remove_subgrid>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
imul   $0x3,%eax,%ecx
mov    -0x10(%rbp),%eax
mov    $0x3,%esi
cltd
idiv   %esi
mov    %eax,%edx
mov    -0x28(%rbp),%rax
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
imul   $0x3,%edx,%ecx
mov    -0x10(%rbp),%eax
mov    $0x3,%esi
cltd
idiv   %esi
mov    -0x20(%rbp),%rax
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_subgrid>:
movslq %esi,%r8
imul   $0x55555556,%r8,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
shr    $0x20,%rsi
add    %eax,%esi
lea    (%rsi,%rsi,2),%r9d
sub    %r9d,%r8d
movslq %edx,%rdx
imul   $0x55555556,%rdx,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
shr    $0x20,%rsi
add    %eax,%esi
add    %esi,%r9d
movslq %r9d,%rax
mov    (%rdi,%rax,8),%rdi
lea    (%r8,%r8,2),%eax
lea    (%rsi,%rsi,2),%esi
sub    %esi,%edx
add    %eax,%edx
movslq %edx,%rdx
movslq %ecx,%rax
add    (%rdi,%rdx,8),%rax
ret

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

LLVM IR (-O2):
define i8* @remove_subgrid(i8*** nocapture %0, i32 %1, i32 %2, i32 %3) {
%5 = srem i32 %1, 3
%6 = sub i32 %1, %5
%7 = sdiv i32 %2, 3
%8 = add nsw i32 %6, %7
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds i8**, i8*** %0, i64 %9
%11 = load i8**, i8*** %10
%12 = mul nsw i32 %5, 3
%13 = srem i32 %2, 3
%14 = add nsw i32 %12, %13
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %11, i64 %15
%17 = load i8*, i8** %16
%18 = sext i32 %3 to i64
%19 = getelementptr inbounds i8, i8* %17, i64 %18
ret i8* %19
}
/* Variables and functions */
int pow(double, int);
int amortize(int benefit, int delay) {
  double discount = 1.0 - 1.0 / ((double)24);
  return benefit * pow(discount, delay);
}


x86 assembly (clang, -O0):
<amortize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  0xeda(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%edi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
imul   %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<amortize>:
push   %rbx
mov    %edi,%ebx
movsd  0xee5(%rip),%xmm0
mov    %esi,%edi
call   1030 <pow@plt>
imul   %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @amortize(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 %0, i32* %3
store i32 %1, i32* %4
store double 0x3FEEAAAAAAAAAAAB, double* %5
%6 = load i32, i32* %3
%7 = load double, double* %5
%8 = load i32, i32* %4
%9 = call i32 @pow(double %7, i32 %8)
%10 = mul nsw i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @amortize(i32 %0, i32 %1) {
%3 = tail call i32 @pow(double 0x3FEEAAAAAAAAAAAB, i32 %1)
%4 = mul nsw i32 %3, %0
ret i32 %4
}
/* Variables and functions */
int INLINE_SYSCALL(int (*)(int), int, int, int, int);
int reboot(int howto) {
  return INLINE_SYSCALL(reboot, 3, (int)0xfee1dead, 672274793, howto);
}


x86 assembly (clang, -O0):
<reboot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%r8d
mov    0x2ec2(%rip),%rdi
mov    $0x3,%esi
mov    $0xfee1dead,%edx
mov    $0x28121969,%ecx
call   1030 <INLINE_SYSCALL@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reboot>:
mov    %edi,%r8d
mov    0x2ece(%rip),%rdi
mov    $0x3,%esi
mov    $0xfee1dead,%edx
mov    $0x28121969,%ecx
jmp    1030 <INLINE_SYSCALL@plt>

LLVM IR (-O0):
define i32 @reboot(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @INLINE_SYSCALL(i32 (i32)* @reboot, i32 3, i32 -18751827, i32 672274793, i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @reboot(i32 %0) {
%2 = tail call i32 @INLINE_SYSCALL(i32 (i32)* @reboot, i32 3, i32 -18751827, i32 672274793, i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ japi_getmousepos(int, int *, int *);
void j_getmousepos(int arg0, int *arg1, int *arg2) {
  japi_getmousepos(arg0, arg1, arg2);
}


x86 assembly (clang, -O0):
<j_getmousepos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <japi_getmousepos@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<j_getmousepos>:
jmp    1030 <japi_getmousepos@plt>

LLVM IR (-O0):
define void @j_getmousepos(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 @japi_getmousepos(i32 %7, i32* %8, i32* %9)
ret void
}

LLVM IR (-O2):
define void @j_getmousepos(i32 %0, i32* %1, i32* %2) {
%4 = tail call i32 @japi_getmousepos(i32 %0, i32* %1, i32* %2)
ret void
}
/* Variables and functions */
char *getenv(char *);
char *get_addresses(void) { return getenv("ERL_EPMD_ADDRESS"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"ERL_EPMD_ADDRESS\00"
define i8* @get_addresses() {
%1 = call i8* @getenv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [17 x i8] c"ERL_EPMD_ADDRESS\00"
define i8* @get_addresses() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
void print_help(int in_ac, char *in_av) {
  printf("usage: %s <options>\n", in_av[0]);
  printf("Options may be one or more of the following:\n");
  printf("  -v Fork the daemon in verbose mode\n");
  printf("  -s <sockname> use <sockname> instead of the default socket name\n");
}


x86 assembly (clang, -O0):
<print_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%esi
lea    0xed3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_help>:
push   %rax
movsbl (%rsi),%esi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedc(%rip),%rdi
call   1030 <puts@plt>
lea    0xefd(%rip),%rdi
call   1030 <puts@plt>
lea    0xf16(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"usage: %s <options>\0A\00"
@.str.1 = [46 x i8] c"Options may be one or more of the following:\0A\00"
@.str.2 = [38 x i8] c" -v Fork the daemon in verbose mode\0A\00"
@.str.3 = [67 x i8] c" -s <sockname> use <sockname> instead of the default socket name\0A\00"
define void @print_help(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = getelementptr inbounds i8, i8* %5, i64 0
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"usage: %s <options>\0A\00"
@str = [45 x i8] c"Options may be one or more of the following:\00"
@str.4 = [37 x i8] c" -v Fork the daemon in verbose mode\00"
@str.5 = [66 x i8] c" -s <sockname> use <sockname> instead of the default socket name\00"
define void @print_help(i32 %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.4, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str.5, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int soma(int);
int main() {
  printf("Soma:%d\n", soma(4));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1040 <soma@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"Soma:%d\0A\00"
define i32 @main() {
%1 = tail call i32 @soma(i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
double erf(double);
double erfc(double x) { return 1. - erf(x); }


x86 assembly (clang, -O0):
<erfc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <erf@plt>
movaps %xmm0,%xmm1
movsd  0xece(%rip),%xmm0
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erfc>:
push   %rax
call   1030 <erf@plt>
movsd  0xee2(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @erfc(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @erf(double %3)
%5 = fsub double 1.000000e+00, %4
ret double %5
}

LLVM IR (-O2):
define double @erfc(double %0) {
%2 = tail call double @erf(double %0)
%3 = fsub double 1.000000e+00, %2
ret double %3
}
int f(int x) {
  int j = 0;
  j += x;
  return j;
}


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

x86 assembly (clang, -O2):
<f>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 returned %0) {
ret i32 %0
}
execve(s, a, e) char *s, *a[], *e[];
{ ; }


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

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

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

LLVM IR (-O2):
define i32 @execve(i8* nocapture readnone %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
ret i32 undef
}
void buffer_clear(void *out, unsigned int count) {
  unsigned char *op = out;
  while (count--)
    *op++ = 0;
}


x86 assembly (clang, -O0):
<buffer_clear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     113e <buffer_clear+0x3e>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
jmp    1113 <buffer_clear+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<buffer_clear>:
test   %esi,%esi
je     1122 <buffer_clear+0x12>
push   %rax
mov    %esi,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @buffer_clear(i8* nocapture writeonly %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %2
ret void
}
int test_imm_6Euint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x6E << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_6Euint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 110
%6 = icmp ne i64 %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_6Euint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 110
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int students;
  students = 12;
  printf("students: %d\n", students);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xc,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed0(%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
mov    $0xc,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [14 x i8] c"students: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 12)
ret i32 0
}
/* Type definitions */
struct adapter {
  int dummy;
};

/* Variables and functions */
int t3_seeprom_write(struct adapter *, int, int);
int t3_seeprom_wp(struct adapter *adapter, int enable) {
  return t3_seeprom_write(adapter, 0x4000, enable ? 0xc : 0);
}


x86 assembly (clang, -O0):
<t3_seeprom_wp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
xor    %edx,%edx
mov    $0xc,%eax
cmp    $0x0,%ecx
cmovne %eax,%edx
mov    $0x4000,%esi
call   1030 <t3_seeprom_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t3_seeprom_wp>:
test   %esi,%esi
mov    $0xc,%edx
cmove  %esi,%edx
mov    $0x4000,%esi
jmp    1030 <t3_seeprom_write@plt>

LLVM IR (-O0):
%struct.adapter = type { i32 }
define i32 @t3_seeprom_wp(%struct.adapter* %0, i32 %1) {
%3 = alloca %struct.adapter*
%4 = alloca i32
store %struct.adapter* %0, %struct.adapter** %3
store i32 %1, i32* %4
%5 = load %struct.adapter*, %struct.adapter** %3
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 12, i32 0
%10 = call i32 @t3_seeprom_write(%struct.adapter* %5, i32 16384, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.adapter = type { i32 }
define i32 @t3_seeprom_wp(%struct.adapter* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = select i1 %3, i32 0, i32 12
%5 = tail call i32 @t3_seeprom_write(%struct.adapter* %0, i32 16384, i32 %4)
ret i32 %5
}
/* Variables and functions */
char *strdup(char const *);
char *strrchr(char const *, char);
char *base_name(const char *s) {
  char *ptr;
  return (ptr = strrchr(s, '/')) ? strdup(++ptr) : strdup(s);
}


x86 assembly (clang, -O0):
<base_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1162 <base_name+0x42>
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    %rdi,-0x10(%rbp)
call   1040 <strdup@plt>
mov    %rax,-0x18(%rbp)
jmp    116f <base_name+0x4f>
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<base_name>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1140 <base_name+0x20>
add    $0x1,%rax
mov    %rax,%rdi
pop    %rbx
jmp    1040 <strdup@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <strdup@plt>

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

LLVM IR (-O2):
define noalias i8* @base_name(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = tail call i8* @strdup(i8* %5)
br label %9
7: ; preds = %1
%8 = tail call i8* @strdup(i8* %0)
br label %9
9: ; preds = %7, %4
%10 = phi i8* [ %6, %4 ], [ %8, %7 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sleep(int);
void sleep_secs(int time) {
  printf("\n Doing some work for %d seconds!\n", time);
  sleep(time);
  return;
}


x86 assembly (clang, -O0):
<sleep_secs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleep_secs>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <sleep@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"\0A Doing some work for %d seconds!\0A\00"
define void @sleep_secs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @sleep(i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"\0A Doing some work for %d seconds!\0A\00"
define void @sleep_secs(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 @sleep(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void usage(const char *args) { printf("%s filename\n", args); }


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

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"%s filename\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"%s filename\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
size_t ft_strlen(const char *str) {
  size_t length;
  length = 0;
  if (str) {
    while (str[length] != '\0') {
      length++;
    }
  }
  return (length);
}


x86 assembly (clang, -O0):
<ft_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114b <ft_strlen+0x4b>
jmp    1120 <ft_strlen+0x20>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1146 <ft_strlen+0x46>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <ft_strlen+0x20>
jmp    114b <ft_strlen+0x4b>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_strlen>:
test   %rdi,%rdi
je     111f <ft_strlen+0x1f>
mov    $0xffffffffffffffff,%rcx
nopl   0x0(%rax)
lea    0x1(%rcx),%rax
cmpb   $0x0,0x1(%rdi,%rcx,1)
mov    %rax,%rcx
jne    1110 <ft_strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @ft_strlen(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %9, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ 0, %1 ]
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = add i64 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3, %1
%10 = phi i64 [ 0, %1 ], [ %4, %3 ]
ret i64 %10
}