xunge/DecIR huggingface dataset:
double do_op(double n1, double n2, char op) {
  switch (op) {
  case '+':
    return n1 + n2;
  case '-':
    return n1 - n2;
  case '*':
    return n1 * n2;
  case '/':
    return n1 / n2;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<do_op>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
add    $0xffffffd6,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x5,%eax
ja     118e <do_op+0x8e>
mov    -0x28(%rbp),%rax
lea    0xecb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1196 <do_op+0x96>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1196 <do_op+0x96>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1196 <do_op+0x96>
movsd  -0x10(%rbp),%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1196 <do_op+0x96>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_op>:
xorpd  %xmm2,%xmm2
add    $0xffffffd6,%edi
cmp    $0x5,%edi
ja     1136 <do_op+0x36>
lea    0xeed(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mulsd  %xmm1,%xmm0
jmp    1132 <do_op+0x32>
addsd  %xmm1,%xmm0
jmp    1132 <do_op+0x32>
subsd  %xmm1,%xmm0
jmp    1132 <do_op+0x32>
divsd  %xmm1,%xmm0
movapd %xmm0,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @do_op(double %0, double %1, i8 signext %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i8
store double %0, double* %5
store double %1, double* %6
store i8 %2, i8* %7
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
switch i32 %9, label %26 [
i32 43, label %10
i32 45, label %14
i32 42, label %18
i32 47, label %22
]
10: ; preds = %3
%11 = load double, double* %5
%12 = load double, double* %6
%13 = fadd double %11, %12
store double %13, double* %4
br label %27
14: ; preds = %3
%15 = load double, double* %5
%16 = load double, double* %6
%17 = fsub double %15, %16
store double %17, double* %4
br label %27
18: ; preds = %3
%19 = load double, double* %5
%20 = load double, double* %6
%21 = fmul double %19, %20
store double %21, double* %4
br label %27
22: ; preds = %3
%23 = load double, double* %5
%24 = load double, double* %6
%25 = fdiv double %23, %24
store double %25, double* %4
br label %27
26: ; preds = %3
store double 0.000000e+00, double* %4
br label %27
27: ; preds = %26, %22, %18, %14, %10
%28 = load double, double* %4
ret double %28
}

LLVM IR (-O2):
define double @do_op(double %0, double %1, i8 signext %2) {
%4 = sext i8 %2 to i32
switch i32 %4, label %13 [
i32 43, label %5
i32 45, label %7
i32 42, label %9
i32 47, label %11
]
5: ; preds = %3
%6 = fadd double %0, %1
br label %13
7: ; preds = %3
%8 = fsub double %0, %1
br label %13
9: ; preds = %3
%10 = fmul double %0, %1
br label %13
11: ; preds = %3
%12 = fdiv double %0, %1
br label %13
13: ; preds = %3, %11, %9, %7, %5
%14 = phi double [ %12, %11 ], [ %10, %9 ], [ %8, %7 ], [ %6, %5 ], [ 0.000000e+00, %3 ]
ret double %14
}
void I2SIntEnable(unsigned long ulBase, unsigned long ulIntFlags) {
  ;

  ;
  (*((volatile unsigned long *)(ulBase + 0x00000C10))) |= ulIntFlags;
}


x86 assembly (clang, -O0):
<I2SIntEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    0xc10(%rax),%rcx
or     %rdx,%rcx
mov    %rcx,0xc10(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<I2SIntEnable>:
or     %rsi,0xc10(%rdi)
ret

LLVM IR (-O0):
define void @I2SIntEnable(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 = load i64, i64* %3
%7 = add i64 %6, 3088
%8 = inttoptr i64 %7 to i64*
%9 = load volatile i64, i64* %8
%10 = or i64 %9, %5
store volatile i64 %10, i64* %8
ret void
}

LLVM IR (-O2):
define void @I2SIntEnable(i64 %0, i64 %1) {
%3 = add i64 %0, 3088
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
%6 = or i64 %5, %1
store volatile i64 %6, i64* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ GenExpr0();
int /*<<< orphan*/ GenStrData(int, int /*<<< orphan*/);
void GenExpr(void) {
  GenStrData(1, 0);
  GenExpr0();
}


x86 assembly (clang, -O0):
<GenExpr>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <GenStrData@plt>
mov    $0x0,%al
call   1030 <GenExpr0@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<GenExpr>:
push   %rax
mov    $0x1,%edi
xor    %esi,%esi
call   1040 <GenStrData@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <GenExpr0@plt>

LLVM IR (-O0):
define void @GenExpr() {
%1 = call i32 @GenStrData(i32 1, i32 0)
%2 = call i32 (...) @GenExpr0()
ret void
}

LLVM IR (-O2):
define void @GenExpr() {
%1 = tail call i32 @GenStrData(i32 1, i32 0)
%2 = tail call i32 (...) @GenExpr0()
ret void
}
void swap(char v[], int i, int j) {
  char temp;
  temp = v[i];
  v[i] = v[j];
  v[j] = temp;
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x11(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
movslq %esi,%rax
mov    (%rdi,%rax,1),%sil
movslq %edx,%rdx
mov    (%rdi,%rdx,1),%cl
mov    %cl,(%rdi,%rax,1)
mov    %sil,(%rdi,%rdx,1)
ret

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

LLVM IR (-O2):
define void @swap(i8* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
store i8 %9, i8* %5
store i8 %6, i8* %8
ret void
}
/* Variables and functions */
int /*<<< orphan*/ get_idiv_ops();
int /*<<< orphan*/ get_idiv_ops_len();
int /*<<< orphan*/ write_bytes(char *, unsigned char *, unsigned int,
                               unsigned int *, int /*<<< orphan*/,
                               int /*<<< orphan*/);
void output_divide(unsigned char *buf, unsigned int buf_size,
                   unsigned int *bytes_written) {
  write_bytes("divide", buf, buf_size, bytes_written, get_idiv_ops(),
              get_idiv_ops_len());
}


x86 assembly (clang, -O0):
<output_divide>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1040 <get_idiv_ops@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <get_idiv_ops_len@plt>
mov    -0x38(%rbp),%rsi
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    %eax,%r9d
lea    0xe7d(%rip),%rdi
call   1050 <write_bytes@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_divide>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <get_idiv_ops@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <get_idiv_ops_len@plt>
lea    0xea9(%rip),%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
mov    %r14,%rcx
mov    %ebp,%r8d
mov    %eax,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <write_bytes@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"divide\00"
define void @output_divide(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32*, i32** %6
%10 = call i32 (...) @get_idiv_ops()
%11 = call i32 (...) @get_idiv_ops_len()
%12 = call i32 @write_bytes(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %8, i32* %9, i32 %10, i32 %11)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"divide\00"
define void @output_divide(i8* %0, i32 %1, i32* %2) {
%4 = tail call i32 (...) @get_idiv_ops()
%5 = tail call i32 (...) @get_idiv_ops_len()
%6 = tail call i32 @write_bytes(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i32* %2, i32 %4, i32 %5)
ret void
}
/* Variables and functions */
scalar_t__ malloc(int);
int *test() {
  int a;
  int *x, *y, *z, *t, *s;
  x = (int *)malloc(sizeof(int));
  y = (int *)malloc(sizeof(int));
  while ((a++) < 100) {
    t = x;
    x = y;
    y = z;
    z = NULL;
  }
  for (int i = 100; i < 0; i--) {
    z = x;
    x = y;
    y = t;
    t = NULL;
  }
  return y;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x64,%eax
jge    116d <test+0x5d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
jmp    1134 <test+0x24>
movl   $0x64,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    11ac <test+0x9c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x34(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x34(%rbp)
jmp    1174 <test+0x64>
mov    -0x18(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
mov    $0x4,%edi
call   1030 <malloc@plt>
mov    $0x4,%edi
pop    %rax
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define i32* @test() {
%1 = tail call i64 @malloc(i32 4)
%2 = tail call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
ret i32* %3
}
/* Variables and functions */
long double erf(double);
long double erfl(long double x) { return erf((double)x); }


x86 assembly (clang, -O0):
<erfl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fstpl  -0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <erf@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erfl>:
fldt   0x8(%rsp)
fstpl  -0x8(%rsp)
movsd  -0x8(%rsp),%xmm0
jmp    1030 <erf@plt>

LLVM IR (-O0):
define x86_fp80 @erfl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = fptrunc x86_fp80 %3 to double
%5 = call x86_fp80 @erf(double %4)
ret x86_fp80 %5
}

LLVM IR (-O2):
define x86_fp80 @erfl(x86_fp80 %0) {
%2 = fptrunc x86_fp80 %0 to double
%3 = tail call x86_fp80 @erf(double %2)
ret x86_fp80 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ PKCS12;

/* Variables and functions */
scalar_t__ ASN1_item_new(int /*<<< orphan*/ *);
int /*<<< orphan*/ PKCS12_it;
PKCS12 *PKCS12_new(void) { return (PKCS12 *)ASN1_item_new(&PKCS12_it); }


x86 assembly (clang, -O0):
<PKCS12_new>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rdi
call   1030 <ASN1_item_new@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<PKCS12_new>:
mov    0x2ec9(%rip),%rdi
jmp    1030 <ASN1_item_new@plt>

LLVM IR (-O0):
@PKCS12_it = global i32 0
define i32* @PKCS12_new() {
%1 = call i64 @ASN1_item_new(i32* @PKCS12_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}

LLVM IR (-O2):
@PKCS12_it = global i32 0
define i32* @PKCS12_new() {
%1 = tail call i64 @ASN1_item_new(i32* @PKCS12_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
char *xmalloc(scalar_t__);
char *xstrdup(char *str) {
  char *buf = xmalloc(strlen(str) + 1);
  (void)strcpy(buf, str);
  return (buf);
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1050 <xmalloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1050 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @xstrdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @xmalloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int *p = NULL;
  printf("No null point check: *p is %d\n", *p);
  return 0;
}


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

LLVM IR (-O0):
@.str = [31 x i8] c"No null point check: *p is %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
store i32* null, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"No null point check: *p is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 undef)
ret i32 0
}
/* Variables and functions */
int GET32(int);
unsigned int uart_check(void) {
  if (GET32((0x3F000000 + 0x00215054)) & 0x01)
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<uart_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x3f215054,%edi
call   1030 <GET32@plt>
and    $0x1,%eax
cmp    $0x0,%eax
je     113a <uart_check+0x2a>
movl   $0x1,-0x4(%rbp)
jmp    1141 <uart_check+0x31>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_check>:
push   %rax
mov    $0x3f215054,%edi
call   1030 <GET32@plt>
and    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @uart_check() {
%1 = tail call i32 @GET32(i32 1059147860)
%2 = and i32 %1, 1
ret i32 %2
}
char apollo_strcmp(char *str1, char *str2, int str1len) {
  int i = 0;
  for (i = 0; i < str1len; i++) {
    if (*str1 != *str2)
      return 0;
    str1++;
    str2++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<apollo_strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    116e <apollo_strcmp+0x6e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1148 <apollo_strcmp+0x48>
movb   $0x0,-0x1(%rbp)
jmp    1172 <apollo_strcmp+0x72>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    111d <apollo_strcmp+0x1d>
movb   $0x1,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<apollo_strcmp>:
mov    $0x1,%al
test   %edx,%edx
jle    1122 <apollo_strcmp+0x22>
mov    %edx,%r8d
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
movzbl (%rdi,%rdx,1),%ecx
cmp    (%rsi,%rdx,1),%cl
jne    1123 <apollo_strcmp+0x23>
add    $0x1,%rdx
cmp    %edx,%r8d
jne    1110 <apollo_strcmp+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define signext i8 @apollo_strcmp(i8* nocapture %0, i8* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3, %12
%6 = phi i32 [ %15, %12 ], [ 0, %3 ]
%7 = phi i8* [ %14, %12 ], [ %1, %3 ]
%8 = phi i8* [ %13, %12 ], [ %0, %3 ]
%9 = load i8, i8* %8
%10 = load i8, i8* %7
%11 = icmp eq i8 %9, %10
br i1 %11, label %12, label %17
12: ; preds = %5
%13 = getelementptr inbounds i8, i8* %8, i64 1
%14 = getelementptr inbounds i8, i8* %7, i64 1
%15 = add nuw nsw i32 %6, 1
%16 = icmp eq i32 %15, %2
br i1 %16, label %17, label %5
17: ; preds = %5, %12, %3
%18 = phi i8 [ 1, %3 ], [ 1, %12 ], [ 0, %5 ]
ret i8 %18
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
void funArea(void) {
  printf("area");
  system("pause");
}


x86 assembly (clang, -O0):
<funArea>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
lea    0xece(%rip),%rdi
call   1030 <system@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<funArea>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1030 <system@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"area\00"
@.str.1 = [6 x i8] c"pause\00"
define void @funArea() {
%1 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"area\00"
@.str.1 = [6 x i8] c"pause\00"
define void @funArea() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void hrtimer_start(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<hrtimer_start>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<hrtimer_start>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.hrtimer_start = [14 x i8] c"hrtimer_start\00"
define void @hrtimer_start() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.hrtimer_start, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.hrtimer_start = [14 x i8] c"hrtimer_start\00"
define void @hrtimer_start() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.hrtimer_start, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *hello(void *tid) {
  printf("Hello from thread %ld", *(long *)tid);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<hello>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hello>:
push   %rax
mov    (%rdi),%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rax
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"Hello from thread %ld\00"
define i8* @hello(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = bitcast i8* %4 to i64*
%6 = load i64, i64* %5
%7 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i64 %6)
%8 = call i32 @pthread_exit(i32* null)
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [22 x i8] c"Hello from thread %ld\00"
define noalias i8* @hello(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i64 %3)
%5 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
void ExttLogAuxTable(void) {}


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

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

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

LLVM IR (-O2):
define void @ExttLogAuxTable() {
ret void
}
int test_imm_45int8_reg(signed char val) {
  return ((val) & (-0x45 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_45int8_reg(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = and i32 %4, -69
%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_45int8_reg(i8 signext %0) {
%2 = and i8 %0, -69
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
__attribute__((always_)) void cpuid(int op, unsigned int *eax,
                                    unsigned int *ebx, unsigned int *ecx,
                                    unsigned int *edx) {
  __asm__("cpuid" : "=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx) : "0"(op));
}


x86 assembly (clang, -O0):
<cpuid>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0xc(%rbp),%eax
cpuid
mov    %eax,%r9d
mov    -0x40(%rbp),%rax
mov    %ecx,%esi
mov    -0x38(%rbp),%rcx
mov    %r9d,(%r8)
mov    %ebx,(%rdi)
mov    %esi,(%rcx)
mov    %edx,(%rax)
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid>:
push   %rbx
mov    %rcx,%r9
mov    %rdx,%r10
mov    %edi,%eax
cpuid
mov    %eax,(%rsi)
mov    %ebx,(%r10)
mov    %ecx,(%r9)
mov    %edx,(%r8)
pop    %rbx
ret

LLVM IR (-O0):
define void @cpuid(i32 %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%11 = load i32*, i32** %7
%12 = load i32*, i32** %8
%13 = load i32*, i32** %9
%14 = load i32*, i32** %10
%15 = load i32, i32* %6
%16 = call { i32, i32, i32, i32 } asm "cpuid", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %15)
%17 = extractvalue { i32, i32, i32, i32 } %16, 0
%18 = extractvalue { i32, i32, i32, i32 } %16, 1
%19 = extractvalue { i32, i32, i32, i32 } %16, 2
%20 = extractvalue { i32, i32, i32, i32 } %16, 3
store i32 %17, i32* %11
store i32 %18, i32* %12
store i32 %19, i32* %13
store i32 %20, i32* %14
ret void
}

LLVM IR (-O2):
define void @cpuid(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4) {
%6 = tail call { i32, i32, i32, i32 } asm "cpuid", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %0)
%7 = extractvalue { i32, i32, i32, i32 } %6, 0
%8 = extractvalue { i32, i32, i32, i32 } %6, 1
%9 = extractvalue { i32, i32, i32, i32 } %6, 2
%10 = extractvalue { i32, i32, i32, i32 } %6, 3
store i32 %7, i32* %1
store i32 %8, i32* %2
store i32 %9, i32* %3
store i32 %10, i32* %4
ret void
}
int Or(int x, int y, int z) { return x | y; }


x86 assembly (clang, -O0):
<Or>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
or     -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @Or(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 = or i32 %7, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @Or(i32 %0, i32 %1, i32 %2) {
%4 = or i32 %1, %0
ret i32 %4
}
/* Variables and functions */
float atof(char *);
float install_real(char *str) { return atof(str); }


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

x86 assembly (clang, -O2):
<install_real>:
jmp    1030 <atof@plt>

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

LLVM IR (-O2):
define float @install_real(i8* nocapture %0) {
%2 = tail call float @atof(i8* %0)
ret float %2
}
/* Variables and functions */
scalar_t__ isalnum(int);
bool is_little_word_character(int c) { return isalnum(c) || c == '_'; }


x86 assembly (clang, -O0):
<is_little_word_character>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    113f <is_little_word_character+0x2f>
cmpl   $0x5f,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_little_word_character>:
push   %rbx
mov    %edi,%ebx
call   1030 <isalnum@plt>
test   %rax,%rax
setne  %al
cmp    $0x5f,%ebx
sete   %cl
or     %al,%cl
movzbl %cl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_little_word_character(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isalnum(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 95
br label %9
9: ; preds = %6, %1
%10 = phi i1 [ true, %1 ], [ %8, %6 ]
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @is_little_word_character(i32 %0) {
%2 = tail call i64 @isalnum(i32 %0)
%3 = icmp ne i64 %2, 0
%4 = icmp eq i32 %0, 95
%5 = or i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ myprintf(char *);
int main() {
  myprintf("bbb");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"bbb\00"
define i32 @main() {
%1 = tail call i32 @myprintf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ my_pow(int, int);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int main() {
  printf("pow(2, 5) = %lld\n", my_pow(2, 5));
  printf("pow(3, 10) = %lld\n", my_pow(3, 10));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
mov    $0x5,%esi
call   1030 <my_pow@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x3,%edi
mov    $0xa,%esi
call   1030 <my_pow@plt>
lea    0xebe(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"pow(2, 5) = %lld\0A\00"
@.str.1 = [19 x i8] c"pow(3, 10) = %lld\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @my_pow(i32 2, i32 5)
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = call i32 @my_pow(i32 3, i32 10)
%5 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"pow(2, 5) = %lld\0A\00"
@.str.1 = [19 x i8] c"pow(3, 10) = %lld\0A\00"
define i32 @main() {
%1 = tail call i32 @my_pow(i32 2, i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @my_pow(i32 3, i32 10)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}
int lowercase_position(char ch) {
  if ((ch >= 'a') && (ch <= 'z')) {
    return (ch - 'a' + 1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<lowercase_position>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1136 <lowercase_position+0x36>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     1136 <lowercase_position+0x36>
movsbl -0x5(%rbp),%eax
sub    $0x61,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113d <lowercase_position+0x3d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lowercase_position>:
lea    -0x61(%rdi),%ecx
lea    -0x60(%rdi),%edx
xor    %eax,%eax
cmp    $0x1a,%cl
cmovb  %edx,%eax
ret

LLVM IR (-O0):
define i32 @lowercase_position(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 97
br i1 %6, label %7, label %16
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 122
br i1 %10, label %11, label %16
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 97
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %17
16: ; preds = %7, %1
store i32 0, i32* %2
br label %17
17: ; preds = %16, %11
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
define i32 @lowercase_position(i8 signext %0) {
%2 = add i8 %0, -97
%3 = icmp ult i8 %2, 26
%4 = sext i8 %0 to i32
%5 = add nsw i32 %4, -96
%6 = select i1 %3, i32 %5, i32 0
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
void usage(char *progname) {
  printf("Usage: %s [ -v Version ] [ -d Device_ID ] <input file>\n", progname);
  exit(1);
}


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

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

LLVM IR (-O0):
@.str = [56 x i8] c"Usage: %s [ -v Version ] [ -d Device_ID ] <input file>\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 ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [56 x i8] c"Usage: %s [ -v Version ] [ -d Device_ID ] <input file>\0A\00"
define void @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
void fill_int3(unsigned char *d, int len) {
  while (len-- > 0) {
    if (d[0] == 0xcc && d[1] == 0xcc)
      break;
    *d++ = 0xcc;
  }
}


x86 assembly (clang, -O0):
<fill_int3>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
jle    1160 <fill_int3+0x60>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0xcc,%eax
jne    1149 <fill_int3+0x49>
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
cmp    $0xcc,%eax
jne    1149 <fill_int3+0x49>
jmp    1160 <fill_int3+0x60>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movb   $0xcc,(%rax)
jmp    110b <fill_int3+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fill_int3>:
test   %esi,%esi
jle    112a <fill_int3+0x2a>
add    $0x1,%esi
jmp    111f <fill_int3+0x1f>
nopl   0x0(%rax)
movb   $0xcc,(%rdi)
add    $0x1,%rdi
add    $0xffffffff,%esi
cmp    $0x1,%esi
jbe    112a <fill_int3+0x2a>
cmpb   $0xcc,(%rdi)
jne    1110 <fill_int3+0x10>
cmpb   $0xcc,0x1(%rdi)
jne    1110 <fill_int3+0x10>
ret

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

LLVM IR (-O2):
define void @fill_int3(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %17
4: ; preds = %2, %14
%5 = phi i32 [ %7, %14 ], [ %1, %2 ]
%6 = phi i8* [ %15, %14 ], [ %0, %2 ]
%7 = add nsw i32 %5, -1
%8 = load i8, i8* %6
%9 = icmp eq i8 %8, -52
br i1 %9, label %10, label %14
10: ; preds = %4
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, -52
br i1 %13, label %17, label %14
14: ; preds = %10, %4
%15 = getelementptr inbounds i8, i8* %6, i64 1
store i8 -52, i8* %6
%16 = icmp ugt i32 %5, 1
br i1 %16, label %4, label %17
17: ; preds = %14, %10, %2
ret void
}
int f1(void) { return 1 / (sizeof(char) - 1); }


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

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

LLVM IR (-O0):
define i32 @f1() {
ret i32 poison
}

LLVM IR (-O2):
define i32 @f1() {
ret i32 poison
}
int vclip(int v, int min, int max) {
  if (v < min)
    return min;
  if (v > max)
    return max;
  return v;
}


x86 assembly (clang, -O0):
<vclip>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1124 <vclip+0x24>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <vclip+0x41>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    113b <vclip+0x3b>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <vclip+0x41>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vclip>:
mov    %edx,%eax
cmp    %edx,%edi
cmovle %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @vclip(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = icmp sgt i32 %0, %2
%6 = select i1 %5, i32 %2, i32 %0
%7 = select i1 %4, i32 %1, i32 %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void get_flag() { system("/bin/sh"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"/bin/sh\00"
define void @get_flag() {
%1 = call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"/bin/sh\00"
define void @get_flag() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int findRem(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  for (int i = 2520; i < 990000000; i++) {
    int x = findRem(i);
    if (x != 0) {
      printf("Found it! Smallest num that can be divided by 1-20 with 0 "
             "remainder is: %d\n",
             i);
      break;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x9d8,-0x8(%rbp)
cmpl   $0x3b023380,-0x8(%rbp)
jge    117f <main+0x5f>
mov    -0x8(%rbp),%edi
call   1040 <findRem@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     116c <main+0x4c>
mov    -0x8(%rbp),%esi
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
jmp    117f <main+0x5f>
jmp    1171 <main+0x51>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x9d8,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1040 <findRem@plt>
test   %eax,%eax
jne    1148 <main+0x28>
add    $0x1,%ebx
cmp    $0x3b023380,%ebx
jne    1130 <main+0x10>
jmp    1156 <main+0x36>
lea    0xeb1(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [76 x i8] c"Found it! Smallest num that can be divided by 1-20 with 0 remainder is: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 2520, i32* %2
br label %4
4: ; preds = %16, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 990000000
br i1 %6, label %7, label %19
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i32 @findRem(i32 %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i32, i32* %2
%14 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i32 %13)
br label %19
15: ; preds = %7
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 = %12, %4
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str = [76 x i8] c"Found it! Smallest num that can be divided by 1-20 with 0 remainder is: %d\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %7
%2 = phi i32 [ 2520, %0 ], [ %8, %7 ]
%3 = tail call i32 @findRem(i32 %2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %10
7: ; preds = %1
%8 = add nuw nsw i32 %2, 1
%9 = icmp eq i32 %8, 990000000
br i1 %9, label %10, label %1
10: ; preds = %7, %5
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ set_scale(double);
void set_scale_1() { set_scale(1.0 / 1); }


x86 assembly (clang, -O0):
<set_scale_1>:
push   %rbp
mov    %rsp,%rbp
movsd  0xee4(%rip),%xmm0
call   1030 <set_scale@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_scale_1>:
movsd  0xee8(%rip),%xmm0
jmp    1030 <set_scale@plt>

LLVM IR (-O0):
define void @set_scale_1() {
%1 = call i32 @set_scale(double 1.000000e+00)
ret void
}

LLVM IR (-O2):
define void @set_scale_1() {
%1 = tail call i32 @set_scale(double 1.000000e+00)
ret void
}
/* Variables and functions */
int rand();
int singlerandomvaluegenerator() {
  int random = (rand() % 256);
  return random;
}


x86 assembly (clang, -O0):
<singlerandomvaluegenerator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<singlerandomvaluegenerator>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
lea    0xff(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xffffff00,%ecx
sub    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @singlerandomvaluegenerator() {
%1 = alloca i32
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 256
store i32 %3, i32* %1
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
define i32 @singlerandomvaluegenerator() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 256
ret i32 %2
}
/* Type definitions */
struct device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dev_get_block_size(struct device *);
int /*<<< orphan*/ memcmp(char const *, char const *, int /*<<< orphan*/);
int equal_blk(struct device *dev, const char *b1, const char *b2) {
  return !memcmp(b1, b2, dev_get_block_size(dev));
}


x86 assembly (clang, -O0):
<equal_blk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <dev_get_block_size@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1040 <memcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equal_blk>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
call   1030 <dev_get_block_size@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <memcmp@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.device = type { i32 }
define i32 @equal_blk(%struct.device* %0, i8* %1, i8* %2) {
%4 = alloca %struct.device*
%5 = alloca i8*
%6 = alloca i8*
store %struct.device* %0, %struct.device** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %5
%8 = load i8*, i8** %6
%9 = load %struct.device*, %struct.device** %4
%10 = call i32 @dev_get_block_size(%struct.device* %9)
%11 = call i32 @memcmp(i8* %7, i8* %8, i32 %10)
%12 = icmp ne i32 %11, 0
%13 = xor i1 %12, true
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
%struct.device = type { i32 }
define i32 @equal_blk(%struct.device* %0, i8* %1, i8* %2) {
%4 = tail call i32 @dev_get_block_size(%struct.device* %0)
%5 = tail call i32 @memcmp(i8* %1, i8* %2, i32 %4)
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
void *dlopen(char const *, int);
void *__wrap_dlopen(const char *filename, int flag) {
  return dlopen(filename, flag);
}


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

x86 assembly (clang, -O2):
<__wrap_dlopen>:
jmp    1030 <dlopen@plt>

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

LLVM IR (-O2):
define i8* @__wrap_dlopen(i8* %0, i32 %1) {
%3 = tail call i8* @dlopen(i8* %0, i32 %1)
ret i8* %3
}
/* Variables and functions */
int analogRead(int);
int /*<<< orphan*/ ino(int);
int analogReadX(int x, int pin) {
  ino(x);
  return (analogRead(pin));
}


x86 assembly (clang, -O0):
<analogReadX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <ino@plt>
mov    -0x8(%rbp),%edi
call   1040 <analogRead@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<analogReadX>:
push   %rbx
mov    %esi,%ebx
call   1030 <ino@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <analogRead@plt>

LLVM IR (-O0):
define i32 @analogReadX(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i32 @ino(i32 %5)
%7 = load i32, i32* %4
%8 = call i32 @analogRead(i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @analogReadX(i32 %0, i32 %1) {
%3 = tail call i32 @ino(i32 %0)
%4 = tail call i32 @analogRead(i32 %1)
ret i32 %4
}