xunge/DecIR huggingface dataset:
int my_nbchiff(long nb, int base) {
  int i;
  i = 1;
  while ((nb /= base) > (base - 1)) {
    ++i;
    nb /= 10;
  }
  return (i);
}


x86 assembly (clang, -O0):
<my_nbchiff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movslq -0xc(%rbp),%rcx
mov    -0x8(%rbp),%rax
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
jle    1155 <my_nbchiff+0x55>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
jmp    1112 <my_nbchiff+0x12>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_nbchiff>:
mov    %rdi,%rax
movslq %esi,%rdi
lea    -0x1(%rdi),%ecx
movslq %ecx,%r8
mov    %rax,%rcx
or     %rdi,%rcx
shr    $0x20,%rcx
je     111f <my_nbchiff+0x1f>
cqto
idiv   %rdi
jmp    1123 <my_nbchiff+0x23>
xor    %edx,%edx
div    %esi
mov    $0x1,%ecx
cmp    %r8,%rax
jle    1175 <my_nbchiff+0x75>
movabs $0x6666666666666667,%r9
66 66 66
jmp    1150 <my_nbchiff+0x50>
nopl   0x0(%rax)
mov    %rdx,%rax
cqto
idiv   %rdi
add    $0x1,%ecx
cmp    %r8,%rax
jle    1175 <my_nbchiff+0x75>
imul   %r9
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
mov    %rdx,%rax
or     %rdi,%rax
shr    $0x20,%rax
jne    1140 <my_nbchiff+0x40>
mov    %edx,%eax
xor    %edx,%edx
div    %esi
jmp    1148 <my_nbchiff+0x48>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @my_nbchiff(i64 %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = add nsw i32 %1, -1
%5 = sext i32 %4 to i64
%6 = sdiv i64 %0, %3
%7 = icmp sgt i64 %6, %5
br i1 %7, label %8, label %15
8: ; preds = %2, %8
%9 = phi i64 [ %13, %8 ], [ %6, %2 ]
%10 = phi i32 [ %11, %8 ], [ 1, %2 ]
%11 = add nuw nsw i32 %10, 1
%12 = sdiv i64 %9, 10
%13 = sdiv i64 %12, %3
%14 = icmp sgt i64 %13, %5
br i1 %14, label %8, label %15
15: ; preds = %8, %2
%16 = phi i32 [ 1, %2 ], [ %11, %8 ]
ret i32 %16
}
int foo(int i, int j) {
  asm("foo_label: .globl foo_label");
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)

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

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

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
tail call void asm sideeffect "foo_label: .globl foo_label", "~{dirflag},~{fpsr},~{flags}"()
ret i32 0
}
int test_imm_7Eint64_lowword_reg(long long val) {
  return ((val) & (0x7E << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_7Eint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 126
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int proc(int **x, int **y) {
  int *z;
  z = *x;
  *x = *y;
  *y = z;
  return 2;
}


x86 assembly (clang, -O0):
<proc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<proc>:
mov    (%rdi),%rax
mov    (%rsi),%rcx
mov    %rcx,(%rdi)
mov    %rax,(%rsi)
mov    $0x2,%eax
ret

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

LLVM IR (-O2):
define i32 @proc(i32** nocapture %0, i32** nocapture %1) {
%3 = load i32*, i32** %0
%4 = load i32*, i32** %1
store i32* %4, i32** %0
store i32* %3, i32** %1
ret i32 2
}
void cmdline_stdin_exit(struct cmdline *cl) {
  if (!cl)
    return;
  (void)cl;
}


x86 assembly (clang, -O0):
<cmdline_stdin_exit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1118 <cmdline_stdin_exit+0x18>
jmp    1118 <cmdline_stdin_exit+0x18>
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.cmdline = type opaque
define void @cmdline_stdin_exit(%struct.cmdline* %0) {
%2 = alloca %struct.cmdline*
store %struct.cmdline* %0, %struct.cmdline** %2
%3 = load %struct.cmdline*, %struct.cmdline** %2
%4 = icmp ne %struct.cmdline* %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
br label %8
6: ; preds = %1
%7 = load %struct.cmdline*, %struct.cmdline** %2
br label %8
8: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
%struct.cmdline = type opaque
define void @cmdline_stdin_exit(%struct.cmdline* nocapture %0) {
ret void
}
/* Variables and functions */
int print(int, char *, int, int);
int locate(int tty, int x, int y) { return print(tty, "\033[%d;%dH", x, y); }


x86 assembly (clang, -O0):
<locate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xecf(%rip),%rsi
call   1030 <print@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<locate>:
mov    %edx,%ecx
mov    %esi,%edx
lea    0xee5(%rip),%rsi
jmp    1030 <print@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"\1B[%d;%dH\00"
define i32 @locate(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 @print(i32 %7, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
@.str = [9 x i8] c"\1B[%d;%dH\00"
define i32 @locate(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @print(i32 %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret i32 %4
}
char *strcpy(char *s1, const char *s2) {
  while (*s2) {
    *s1 = *s2;
    s1++;
    s2++;
  }
  *s1 = '\0';
  return s1;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1142 <strcpy+0x42>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <strcpy+0xc>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1121 <strcpy+0x21>
add    $0x1,%rsi
nopl   (%rax)
mov    %cl,(%rax)
add    $0x1,%rax
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <strcpy+0x10>
movb   $0x0,(%rax)
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %10, %5 ], [ %1, %2 ]
%8 = phi i8* [ %9, %5 ], [ %0, %2 ]
store i8 %6, i8* %8
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %9, %5 ]
store i8 0, i8* %14
ret i8* %14
}
/* Variables and functions */
int punicaoR(int *, int /*<<< orphan*/, int, int, int, int);
int punicao(int *v, int tam, int tmp, int faixas) {
  return punicaoR(v, 0, tam - 1, tam, tmp, faixas);
}


x86 assembly (clang, -O0):
<punicao>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
xor    %esi,%esi
call   1030 <punicaoR@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<punicao>:
mov    %ecx,%r9d
mov    %edx,%r8d
mov    %esi,%ecx
lea    -0x1(%rcx),%edx
xor    %esi,%esi
jmp    1030 <punicaoR@plt>

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

LLVM IR (-O2):
define i32 @punicao(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = add nsw i32 %1, -1
%6 = tail call i32 @punicaoR(i32* %0, i32 0, i32 %5, i32 %1, i32 %2, i32 %3)
ret i32 %6
}
void resetTimer() {
  (*(unsigned int *)0x4000C004) |= 0x2;
  __asm("nop");
  __asm("nop");
  (*(unsigned int *)0x4000C004) &= ~0x2;
}


x86 assembly (clang, -O0):
<resetTimer>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4000c004,%eax
mov    (%rax),%ecx
or     $0x2,%ecx
mov    $0x4000c004,%eax
mov    %ecx,(%rax)
nop
nop
mov    $0x4000c004,%eax
mov    (%rax),%ecx
and    $0xfffffffd,%ecx
mov    $0x4000c004,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<resetTimer>:
orb    $0x2,0x4000c004
02
nop
nop
andb   $0xfd,0x4000c004
fd
ret

LLVM IR (-O0):
define void @resetTimer() {
%1 = load i32, i32* inttoptr (i64 1073790980 to i32*)
%2 = or i32 %1, 2
store i32 %2, i32* inttoptr (i64 1073790980 to i32*)
%3 = load i32, i32* inttoptr (i64 1073790980 to i32*)
%4 = and i32 %3, -3
store i32 %4, i32* inttoptr (i64 1073790980 to i32*)
ret void
}

LLVM IR (-O2):
define void @resetTimer() {
%1 = load i32, i32* inttoptr (i64 1073790980 to i32*)
%2 = or i32 %1, 2
store i32 %2, i32* inttoptr (i64 1073790980 to i32*)
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
tail call void asm sideeffect "nop", "~{dirflag},~{fpsr},~{flags}"()
%3 = load i32, i32* inttoptr (i64 1073790980 to i32*)
%4 = and i32 %3, -3
store i32 %4, i32* inttoptr (i64 1073790980 to i32*)
ret void
}
void opencl_union_ndrange_init(struct opencl_union_ndrange_t *ndrange) {
  opencl_debug("[%s] empty", __FUNCTION__);
}


x86 assembly (clang, -O0):
<opencl_union_ndrange_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x0,%al
call   1030 <opencl_debug@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opencl_union_ndrange_init>:
lea    0xee9(%rip),%rdi
lea    0xeed(%rip),%rsi
xor    %eax,%eax
jmp    1030 <opencl_debug@plt>

LLVM IR (-O0):
%struct.opencl_union_ndrange_t = type opaque
@.str = [11 x i8] c"[%s] empty\00"
@__FUNCTION__.opencl_union_ndrange_init = [26 x i8] c"opencl_union_ndrange_init\00"
define void @opencl_union_ndrange_init(%struct.opencl_union_ndrange_t* %0) {
%2 = alloca %struct.opencl_union_ndrange_t*
store %struct.opencl_union_ndrange_t* %0, %struct.opencl_union_ndrange_t** %2
%3 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @opencl_debug to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @__FUNCTION__.opencl_union_ndrange_init, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.opencl_union_ndrange_t = type opaque
@.str = [11 x i8] c"[%s] empty\00"
@__FUNCTION__.opencl_union_ndrange_init = [26 x i8] c"opencl_union_ndrange_init\00"
define void @opencl_union_ndrange_init(%struct.opencl_union_ndrange_t* nocapture readnone %0) {
%2 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @opencl_debug to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @__FUNCTION__.opencl_union_ndrange_init, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ dvd_struct;
typedef int /*<<< orphan*/ d;

/* Variables and functions */
int main(void) {
  dvd_struct d;
  (void)d;
  return sizeof(d);
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 4
}
void inv_q_invertf(const float *q, float *qInverted) {
  typedef int invensensePutFunctionCallsHere;
  qInverted[0] = q[0];
  qInverted[1] = -q[1];
  qInverted[2] = -q[2];
  qInverted[3] = -q[3];
}


x86 assembly (clang, -O0):
<inv_q_invertf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
movss  0xc(%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,0xc(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<inv_q_invertf>:
movss  (%rdi),%xmm0
movss  %xmm0,(%rsi)
movss  0x4(%rdi),%xmm0
movaps 0xeec(%rip),%xmm1
xorps  %xmm1,%xmm0
movss  %xmm0,0x4(%rsi)
movss  0x8(%rdi),%xmm0
xorps  %xmm1,%xmm0
movss  %xmm0,0x8(%rsi)
movss  0xc(%rdi),%xmm0
xorps  %xmm1,%xmm0
movss  %xmm0,0xc(%rsi)
ret

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

LLVM IR (-O2):
define void @inv_q_invertf(float* nocapture %0, float* nocapture writeonly %1) {
%3 = load float, float* %0
store float %3, float* %1
%4 = getelementptr inbounds float, float* %0, i64 1
%5 = load float, float* %4
%6 = fneg float %5
%7 = getelementptr inbounds float, float* %1, i64 1
store float %6, float* %7
%8 = getelementptr inbounds float, float* %0, i64 2
%9 = load float, float* %8
%10 = fneg float %9
%11 = getelementptr inbounds float, float* %1, i64 2
store float %10, float* %11
%12 = getelementptr inbounds float, float* %0, i64 3
%13 = load float, float* %12
%14 = fneg float %13
%15 = getelementptr inbounds float, float* %1, i64 3
store float %14, float* %15
ret void
}
int main() {
  float celsius;
  printf("Insira o grau em celsius: ");
  scanf("%f", &celsius);
  float fahrenheit = c_para_f(celsius);
  printf("%s\n", fahrenheit);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1040 <c_para_f@plt>
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe96(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
call   1040 <c_para_f@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xea9(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Insira o grau em celsius: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%6 = load float, float* %2
%7 = fpext float %6 to double
%8 = call i32 (double, ...) bitcast (i32 (...)* @c_para_f to i32 (double, ...)*)(double %7)
%9 = sitofp i32 %8 to float
store float %9, float* %3
%10 = load float, float* %3
%11 = fpext float %10 to double
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Insira o grau em celsius: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fpext float %5 to double
%7 = call i32 (double, ...) bitcast (i32 (...)* @c_para_f to i32 (double, ...)*)(double %6)
%8 = sitofp i32 %7 to float
%9 = fpext float %8 to double
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %9)
ret i32 0
}
/* Variables and functions */
unsigned int random();
int pmrandom(void) {
  unsigned int x;
  x = random();
  return ((x & 0x8000) == 0) * 2 - 1;
}


x86 assembly (clang, -O0):
<pmrandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <random@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x8000,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
shl    $0x1,%eax
sub    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmrandom>:
push   %rax
xor    %eax,%eax
call   1030 <random@plt>
shr    $0xe,%eax
not    %eax
and    $0x2,%eax
add    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @pmrandom() {
%1 = alloca i32
%2 = call i32 (...) @random()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = and i32 %3, 32768
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = mul nsw i32 %6, 2
%8 = sub nsw i32 %7, 1
ret i32 %8
}

LLVM IR (-O2):
define i32 @pmrandom() {
%1 = tail call i32 (...) @random()
%2 = lshr i32 %1, 14
%3 = and i32 %2, 2
%4 = xor i32 %3, 2
%5 = add nsw i32 %4, -1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ _SC_NPROCESSORS_ONLN;
int sysconf(int /*<<< orphan*/);
int numphyscpus() { return sysconf(_SC_NPROCESSORS_ONLN); }


x86 assembly (clang, -O0):
<numphyscpus>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <sysconf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<numphyscpus>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <sysconf@plt>

LLVM IR (-O0):
@_SC_NPROCESSORS_ONLN = global i32 0
define i32 @numphyscpus() {
%1 = load i32, i32* @_SC_NPROCESSORS_ONLN
%2 = call i32 @sysconf(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@_SC_NPROCESSORS_ONLN = global i32 0
define i32 @numphyscpus() {
%1 = load i32, i32* @_SC_NPROCESSORS_ONLN
%2 = tail call i32 @sysconf(i32 %1)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ __gpio_as_pwm(int);
int /*<<< orphan*/ __lcd_pwm_set_backlight_level(int);
int /*<<< orphan*/ __tcu_init_pwm_output_high(int);
int /*<<< orphan*/ __tcu_select_clk_div4(int);
int /*<<< orphan*/ __tcu_select_extalclk(int);
int /*<<< orphan*/ __tcu_stop_counter(int);
void __lcd_pwm_start(void) {
  __gpio_as_pwm(2);
  __tcu_stop_counter(2);
  __tcu_select_extalclk(2);
  __tcu_select_clk_div4(2);
  __tcu_init_pwm_output_high(2);
  __lcd_pwm_set_backlight_level(80);
  return;
}


x86 assembly (clang, -O0):
<__lcd_pwm_start>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <__gpio_as_pwm@plt>
mov    $0x2,%edi
call   1050 <__tcu_stop_counter@plt>
mov    $0x2,%edi
call   1070 <__tcu_select_extalclk@plt>
mov    $0x2,%edi
call   1040 <__tcu_select_clk_div4@plt>
mov    $0x2,%edi
call   1060 <__tcu_init_pwm_output_high@plt>
mov    $0x50,%edi
call   1080 <__lcd_pwm_set_backlight_level@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<__lcd_pwm_start>:
push   %rax
mov    $0x2,%edi
call   1030 <__gpio_as_pwm@plt>
mov    $0x2,%edi
call   1050 <__tcu_stop_counter@plt>
mov    $0x2,%edi
call   1070 <__tcu_select_extalclk@plt>
mov    $0x2,%edi
call   1040 <__tcu_select_clk_div4@plt>
mov    $0x2,%edi
call   1060 <__tcu_init_pwm_output_high@plt>
mov    $0x50,%edi
pop    %rax
jmp    1080 <__lcd_pwm_set_backlight_level@plt>

LLVM IR (-O0):
define void @__lcd_pwm_start() {
%1 = call i32 @__gpio_as_pwm(i32 2)
%2 = call i32 @__tcu_stop_counter(i32 2)
%3 = call i32 @__tcu_select_extalclk(i32 2)
%4 = call i32 @__tcu_select_clk_div4(i32 2)
%5 = call i32 @__tcu_init_pwm_output_high(i32 2)
%6 = call i32 @__lcd_pwm_set_backlight_level(i32 80)
ret void
}

LLVM IR (-O2):
define void @__lcd_pwm_start() {
%1 = tail call i32 @__gpio_as_pwm(i32 2)
%2 = tail call i32 @__tcu_stop_counter(i32 2)
%3 = tail call i32 @__tcu_select_extalclk(i32 2)
%4 = tail call i32 @__tcu_select_clk_div4(i32 2)
%5 = tail call i32 @__tcu_init_pwm_output_high(i32 2)
%6 = tail call i32 @__lcd_pwm_set_backlight_level(i32 80)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint64_t;

/* Variables and functions */
uint8_t extract_variantkey_chrom(uint64_t vk) {
  return (uint8_t)((vk & 0xF800000000000000) >> 59);
}


x86 assembly (clang, -O0):
<extract_variantkey_chrom>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0xf800000000000000,%rcx
and    %rcx,%rax
shr    $0x3b,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_variantkey_chrom>:
movslq %edi,%rax
shr    $0x3b,%rax
ret

LLVM IR (-O0):
define i32 @extract_variantkey_chrom(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = and i64 %4, -576460752303423488
%6 = lshr i64 %5, 59
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @extract_variantkey_chrom(i32 %0) {
%2 = sext i32 %0 to i64
%3 = lshr i64 %2, 59
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ __put_unaligned_be32(int, int /*<<< orphan*/ *);
void __put_unaligned_be64(uint64_t val, uint8_t *p) {
  __put_unaligned_be32(val >> 32, p);
  __put_unaligned_be32(val, p + 4);
}


x86 assembly (clang, -O0):
<__put_unaligned_be64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x20,%ecx
sar    %cl,%edi
mov    -0x10(%rbp),%rsi
call   1030 <__put_unaligned_be32@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
add    $0x10,%rsi
call   1030 <__put_unaligned_be32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__put_unaligned_be64>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1030 <__put_unaligned_be32@plt>
add    $0x10,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <__put_unaligned_be32@plt>

LLVM IR (-O0):
define void @__put_unaligned_be64(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 = ashr i32 %5, 32
%7 = load i32*, i32** %4
%8 = call i32 @__put_unaligned_be32(i32 %6, i32* %7)
%9 = load i32, i32* %3
%10 = load i32*, i32** %4
%11 = getelementptr inbounds i32, i32* %10, i64 4
%12 = call i32 @__put_unaligned_be32(i32 %9, i32* %11)
ret void
}

LLVM IR (-O2):
define void @__put_unaligned_be64(i32 %0, i32* %1) {
%3 = tail call i32 @__put_unaligned_be32(i32 poison, i32* %1)
%4 = getelementptr inbounds i32, i32* %1, i64 4
%5 = tail call i32 @__put_unaligned_be32(i32 %0, i32* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void SOS_LocateFunction(const char *func) { printf("%s: ", func); }


x86 assembly (clang, -O0):
<SOS_LocateFunction>:
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):
<SOS_LocateFunction>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%s: \00"
define void @SOS_LocateFunction(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LCD_FilledRect(int /*<<< orphan*/, int, int /*<<< orphan*/,
                                  int, int);
void LCD_ClearScreen(void) {
  LCD_FilledRect(0, 128, 0, 128,
                 ((((0x000000) & 0x00ff0000) >> 19) |
                  ((((0x000000) & 0x0000ff00) >> 5) & 0x000007e0) |
                  ((((0x000000) & 0x000000ff) << 8) & 0x0000f800)));
}


x86 assembly (clang, -O0):
<LCD_ClearScreen>:
push   %rbp
mov    %rsp,%rbp
xor    %r8d,%r8d
mov    $0x80,%ecx
mov    %r8d,%edi
mov    %ecx,%esi
mov    %r8d,%edx
call   1030 <LCD_FilledRect@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCD_ClearScreen>:
xor    %edi,%edi
mov    $0x80,%esi
xor    %edx,%edx
mov    $0x80,%ecx
xor    %r8d,%r8d
jmp    1030 <LCD_FilledRect@plt>

LLVM IR (-O0):
define void @LCD_ClearScreen() {
%1 = call i32 @LCD_FilledRect(i32 0, i32 128, i32 0, i32 128, i32 0)
ret void
}

LLVM IR (-O2):
define void @LCD_ClearScreen() {
%1 = tail call i32 @LCD_FilledRect(i32 0, i32 128, i32 0, i32 128, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printk(char *);
int lseek(int fd, int n, int whence) {
  printk("Write lseek()\n");
  return 0;
}


x86 assembly (clang, -O0):
<lseek>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
lea    0xed8(%rip),%rdi
call   1030 <printk@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [15 x i8] c"Write lseek()\0A\00"
define i32 @lseek(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 = call i32 @printk(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Write lseek()\0A\00"
define i32 @lseek(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @printk(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int core4_swap(char *, int);
int U_EMRELLIPSE_swap(char *record, int torev) {
  return (core4_swap(record, torev));
}


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

x86 assembly (clang, -O2):
<U_EMRELLIPSE_swap>:
jmp    1030 <core4_swap@plt>

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

LLVM IR (-O2):
define i32 @U_EMRELLIPSE_swap(i8* %0, i32 %1) {
%3 = tail call i32 @core4_swap(i8* %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int copy_multprec_container_to_start_system(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(284, a, b, c);
  return fail;
}


x86 assembly (clang, -O0):
<copy_multprec_container_to_start_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x11c,%edi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_multprec_container_to_start_system>:
mov    $0x11c,%edi
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @copy_multprec_container_to_start_system() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc(i32 284, i32* %5, i32* %6, double* %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @copy_multprec_container_to_start_system() {
%1 = tail call i32 @_ada_use_c2phc(i32 284, i32* undef, i32* undef, double* undef)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int sum;
  sum = 25 + 37 - 19;
  printf("The answer is %i\n", sum);
  return 0;
}


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

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

LLVM IR (-O2):
@.str = [18 x i8] c"The answer is %i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 43)
ret i32 0
}
int test_imm_E1int64_midword_reg(long long val) {
  return ((val >> 16) & (0xE1 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_E1int64_midword_reg>:
test   $0xe10000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_E1int64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 225
%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_E1int64_midword_reg(i64 %0) {
%2 = and i64 %0, 14745600
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void set_active_heap(int heap) {}


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

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

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

LLVM IR (-O2):
define void @set_active_heap(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void die(const char *msg) {
  fprintf(stderr, "%s\n", msg);
  exit(1);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @die(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @die(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int UINT_MAX;
unsigned MVectorU32_maxSize(void) { return UINT_MAX; }


x86 assembly (clang, -O0):
<MVectorU32_maxSize>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MVectorU32_maxSize>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@UINT_MAX = global i32 0
define i32 @MVectorU32_maxSize() {
%1 = load i32, i32* @UINT_MAX
ret i32 %1
}

LLVM IR (-O2):
@UINT_MAX = global i32 0
define i32 @MVectorU32_maxSize() {
%1 = load i32, i32* @UINT_MAX
ret i32 %1
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t rol64(uint64_t v, uint64_t s) { return (v >> (64 - s)) | (v << s); }


x86 assembly (clang, -O0):
<rol64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x40,%ecx
sub    -0x8(%rbp),%ecx
sar    %cl,%eax
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rol64>:
mov    %esi,%ecx
neg    %cl
mov    %edi,%eax
sar    %cl,%eax
mov    %esi,%ecx
shl    %cl,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @rol64(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 = load i32, i32* %4
%7 = sub nsw i32 64, %6
%8 = ashr i32 %5, %7
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = shl i32 %9, %10
%12 = or i32 %8, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @rol64(i32 %0, i32 %1) {
%3 = sub nsw i32 64, %1
%4 = ashr i32 %0, %3
%5 = shl i32 %0, %1
%6 = or i32 %4, %5
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int MatrixChainOrder(int *, int);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, int);
int main() {
  int arr[] = {1, 2, 3, 4};
  int size = sizeof(arr) / sizeof(arr[0]);
  printf("Minimum number of multiplications is %d ",
         MatrixChainOrder(arr, size));
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x4,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1030 <MatrixChainOrder@plt>
mov    %eax,%esi
lea    0xe9f(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xec5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
call   1030 <MatrixChainOrder@plt>
lea    0xebd(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [4 x i32] [i32 1, i32 2, i32 3, i32 4]
@.str = [41 x i8] c"Minimum number of multiplications is %d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [4 x i32]* %2 to i8*
store i32 4, i32* %3
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @MatrixChainOrder(i32* %5, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [4 x i32] [i32 1, i32 2, i32 3, i32 4]
@.str = [41 x i8] c"Minimum number of multiplications is %d \00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @MatrixChainOrder(i32* %3, i32 4)
%5 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = call i32 (...) @getchar()
ret i32 0
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *filename_to_print(const char *file) {
  const char *tmp = strrchr(file, '/');
  if (tmp) {
    file = &tmp[1];
  }
  tmp = strrchr(file, '\\');
  if (tmp) {
    file = &tmp[1];
  }
  return file;
}


x86 assembly (clang, -O0):
<filename_to_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1145 <filename_to_print+0x35>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x5c,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     116e <filename_to_print+0x5e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<filename_to_print>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rbx
test   %rax,%rax
cmove  %r14,%rbx
mov    %rbx,%rdi
mov    $0x5c,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @filename_to_print(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 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
store i8* %10, i8** %2
br label %11
11: ; preds = %8, %1
%12 = load i8*, i8** %2
%13 = call i8* @strrchr(i8* %12, i8 signext 92)
store i8* %13, i8** %3
%14 = load i8*, i8** %3
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 1
store i8* %18, i8** %2
br label %19
19: ; preds = %16, %11
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
define i8* @filename_to_print(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
%6 = tail call i8* @strrchr(i8* dereferenceable(1) %5, i8 signext 92)
%7 = icmp eq i8* %6, null
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = select i1 %7, i8* %5, i8* %8
ret i8* %9
}
int foo(int n) {
  int val = n;
  {
    char val = n ? 'y' : 'n';
    if (val == 'y')
      return n + foo(n - 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edx
mov    $0x6e,%eax
mov    $0x79,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0x79,%eax
jne    1164 <foo+0x54>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <foo@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    116b <foo+0x5b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
test   %edi,%edi
je     1119 <foo+0x19>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %rax,%rcx
imul   %eax,%eax
shr    %rcx
add    %edi,%eax
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 %0, i32* %3
%6 = load i32, i32* %3
store i32 %6, i32* %4
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 121, i32 110
%11 = trunc i32 %10 to i8
store i8 %11, i8* %5
%12 = load i8, i8* %5
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 121
br i1 %14, label %15, label %21
15: ; preds = %1
%16 = load i32, i32* %3
%17 = load i32, i32* %3
%18 = sub nsw i32 %17, 1
%19 = call i32 @foo(i32 %18)
%20 = add nsw i32 %16, %19
store i32 %20, i32* %2
br label %22
21: ; preds = %1
store i32 0, i32* %2
br label %22
22: ; preds = %21, %15
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = add i32 %0, -1
%5 = mul i32 %4, %4
%6 = zext i32 %4 to i33
%7 = add i32 %0, -2
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %5, %0
%13 = sub i32 %12, %11
br label %14
14: ; preds = %3, %1
%15 = phi i32 [ 0, %1 ], [ %13, %3 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void ouch(int sig) { printf("I got signal %d\n", sig); }


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

x86 assembly (clang, -O2):
<ouch>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [17 x i8] c"I got signal %d\0A\00"
define void @ouch(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
long rand();
float geom_rand_uniff() {
  float result;
  long a;
  a = rand();
  result = (float)((a - 1073741824) >> 6);
  return result;
}


x86 assembly (clang, -O0):
<geom_rand_uniff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
sub    $0x40000000,%rax
sar    $0x6,%rax
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_rand_uniff>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
add    $0xffffffffc0000000,%rax
sar    $0x6,%rax
cvtsi2ss %rax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @geom_rand_uniff() {
%1 = alloca float
%2 = alloca i64
%3 = call i64 (...) @rand()
store i64 %3, i64* %2
%4 = load i64, i64* %2
%5 = sub nsw i64 %4, 1073741824
%6 = ashr i64 %5, 6
%7 = sitofp i64 %6 to float
store float %7, float* %1
%8 = load float, float* %1
ret float %8
}

LLVM IR (-O2):
define float @geom_rand_uniff() {
%1 = tail call i64 (...) @rand()
%2 = add nsw i64 %1, -1073741824
%3 = ashr i64 %2, 6
%4 = sitofp i64 %3 to float
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int goodfunc(const char *str) {
  printf("\nHi, I'm a good function.  I was passed: %s\n", str);
  return 0;
}


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

x86 assembly (clang, -O2):
<goodfunc>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [45 x i8] c"\0AHi, I'm a good function. I was passed: %s\0A\00"
define i32 @goodfunc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"\0AHi, I'm a good function. I was passed: %s\0A\00"
define i32 @goodfunc(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 0
}
/* Type definitions */
struct dirent {
  char *d_name;
};

/* Variables and functions */
int filter2(const struct dirent *dir) {
  char *s = dir->d_name;
  if (s[0] == '.')
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<filter2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
jne    112f <filter2+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    1136 <filter2+0x36>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<filter2>:
mov    (%rdi),%rcx
xor    %eax,%eax
cmpb   $0x2e,(%rcx)
setne  %al
ret

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

LLVM IR (-O2):
%struct.dirent = type { i8* }
define i32 @filter2(%struct.dirent* nocapture %0) {
%2 = getelementptr inbounds %struct.dirent, %struct.dirent* %0, i64 0, i32 0
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = icmp ne i8 %4, 46
%6 = zext i1 %5 to i32
ret i32 %6
}