xunge/DecIR huggingface dataset:
int st_strhash(char *string, int modulus) {
  register int val = 0;
  register int c;
  while ((c = *string++) != '\0') {
    val = val * 997 + c;
  }
  return ((val < 0) ? -val : val) % modulus;
}


x86 assembly (clang, -O0):
<st_strhash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
je     1142 <st_strhash+0x42>
imul   $0x3e5,-0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <st_strhash+0x12>
cmpl   $0x0,-0x10(%rbp)
jge    1159 <st_strhash+0x59>
xor    %eax,%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    115f <st_strhash+0x5f>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<st_strhash>:
mov    (%rdi),%al
test   %al,%al
je     1128 <st_strhash+0x28>
add    $0x1,%rdi
xor    %ecx,%ecx
nopl   0x0(%rax)
movsbl %al,%eax
imul   $0x3e5,%ecx,%ecx
add    %eax,%ecx
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <st_strhash+0x10>
jmp    112a <st_strhash+0x2a>
xor    %ecx,%ecx
mov    %ecx,%eax
neg    %eax
cmovs  %ecx,%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @st_strhash(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %13, %2
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %3
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
store i32 %11, i32* %6
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %7
%14 = load i32, i32* %5
%15 = mul nsw i32 %14, 997
%16 = load i32, i32* %6
%17 = add nsw i32 %15, %16
store i32 %17, i32* %5
br label %7
18: ; preds = %7
%19 = load i32, i32* %5
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* %5
%23 = sub nsw i32 0, %22
br label %26
24: ; preds = %18
%25 = load i32, i32* %5
br label %26
26: ; preds = %24, %21
%27 = phi i32 [ %23, %21 ], [ %25, %24 ]
%28 = load i32, i32* %4
%29 = srem i32 %27, %28
ret i32 %29
}

LLVM IR (-O2):
define i32 @st_strhash(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i8* [ %10, %5 ], [ %0, %2 ]
%8 = phi i32 [ %12, %5 ], [ 0, %2 ]
%9 = sext i8 %6 to i32
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = mul nsw i32 %8, 997
%12 = add nsw i32 %11, %9
%13 = load i8, i8* %10
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 0, %2 ], [ %12, %5 ]
%17 = tail call i32 @llvm.abs.i32(i32 %16, i1 true)
%18 = srem i32 %17, %1
ret i32 %18
}
int kvmppc_set_smt_threads(int smt) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @kvmppc_set_smt_threads(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ encode_bmp_to_jpeg(char *, char *, int, int /*<<< orphan*/);
void test_jpeg(void) {
  encode_bmp_to_jpeg("images/redFlowers.bmp", "output/new.jpg", 50, 0);
}


x86 assembly (clang, -O0):
<test_jpeg>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xef4(%rip),%rsi
mov    $0x32,%edx
xor    %ecx,%ecx
call   1030 <encode_bmp_to_jpeg@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_jpeg>:
lea    0xee9(%rip),%rdi
lea    0xef8(%rip),%rsi
mov    $0x32,%edx
xor    %ecx,%ecx
jmp    1030 <encode_bmp_to_jpeg@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"images/redFlowers.bmp\00"
@.str.1 = [15 x i8] c"output/new.jpg\00"
define void @test_jpeg() {
%1 = call i32 @encode_bmp_to_jpeg(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 50, i32 0)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"images/redFlowers.bmp\00"
@.str.1 = [15 x i8] c"output/new.jpg\00"
define void @test_jpeg() {
%1 = tail call i32 @encode_bmp_to_jpeg(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 50, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ log_e(char *, size_t);
void *realloc(void *, size_t);
void *hw_realloc(void *ptr, size_t size) {
  void *m = realloc(ptr, size);
  if (m == NULL) {
    log_e("Memory allocation by realloc failed (%ld bytes).", size);
    exit(2);
  }
  return m;
}


x86 assembly (clang, -O0):
<hw_realloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1176 <hw_realloc+0x46>
mov    -0x10(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1030 <log_e@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hw_realloc>:
push   %rbx
mov    %rsi,%rbx
call   1040 <realloc@plt>
test   %rax,%rax
je     1140 <hw_realloc+0x10>
pop    %rbx
ret
lea    0xeb9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <log_e@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"Memory allocation by realloc failed (%ld bytes).\00"
define i8* @hw_realloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i64, i64* %4
%13 = call i32 @log_e(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i64 %12)
%14 = call i32 @exit(i32 2)
unreachable
15: ; preds = %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
@.str = [49 x i8] c"Memory allocation by realloc failed (%ld bytes).\00"
define noalias i8* @hw_realloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @log_e(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i64 %1)
%7 = tail call i32 @exit(i32 2)
unreachable
8: ; preds = %2
ret i8* %3
}
int cairo_code_draw_envPeakrmsLabel_get_width() { return 7; }


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

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

LLVM IR (-O0):
define i32 @cairo_code_draw_envPeakrmsLabel_get_width() {
ret i32 7
}

LLVM IR (-O2):
define i32 @cairo_code_draw_envPeakrmsLabel_get_width() {
ret i32 7
}
/* Variables and functions */
int /*<<< orphan*/ __utac_acc__DecryptForward_spec__1(int);
int /*<<< orphan*/ printMail(int);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ queue(int, int);
void forward(int client, int msg) {
  int __utac__ad__arg1;
  {
    {
      __utac__ad__arg1 = msg;
      __utac_acc__DecryptForward_spec__1(__utac__ad__arg1);
      puts("Forwarding message.\n");
      printMail(msg);
      queue(client, msg);
    }
    return;
  }
}


x86 assembly (clang, -O0):
<forward>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1060 <__utac_acc__DecryptForward_spec__1@plt>
lea    0xe9d(%rip),%rdi
call   1040 <puts@plt>
mov    -0x8(%rbp),%edi
call   1030 <printMail@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1050 <queue@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<forward>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    %esi,%edi
call   1060 <__utac_acc__DecryptForward_spec__1@plt>
lea    0xeab(%rip),%rdi
call   1040 <puts@plt>
mov    %ebx,%edi
call   1030 <printMail@plt>
mov    %ebp,%edi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <queue@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Forwarding message.\0A\00"
define void @forward(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* %4
store i32 %6, i32* %5
%7 = load i32, i32* %5
%8 = call i32 @__utac_acc__DecryptForward_spec__1(i32 %7)
%9 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* %4
%11 = call i32 @printMail(i32 %10)
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 @queue(i32 %12, i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Forwarding message.\0A\00"
define void @forward(i32 %0, i32 %1) {
%3 = tail call i32 @__utac_acc__DecryptForward_spec__1(i32 %1)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @printMail(i32 %1)
%6 = tail call i32 @queue(i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AbsoluteLongSlow(int);
int /*<<< orphan*/ S9xSetPCBase(int /*<<< orphan*/);
void Op5CSlow(void) { S9xSetPCBase(AbsoluteLongSlow(5)); }


x86 assembly (clang, -O0):
<Op5CSlow>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
call   1030 <AbsoluteLongSlow@plt>
mov    %eax,%edi
call   1040 <S9xSetPCBase@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op5CSlow>:
push   %rax
mov    $0x5,%edi
call   1030 <AbsoluteLongSlow@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <S9xSetPCBase@plt>

LLVM IR (-O0):
define void @Op5CSlow() {
%1 = call i32 @AbsoluteLongSlow(i32 5)
%2 = call i32 @S9xSetPCBase(i32 %1)
ret void
}

LLVM IR (-O2):
define void @Op5CSlow() {
%1 = tail call i32 @AbsoluteLongSlow(i32 5)
%2 = tail call i32 @S9xSetPCBase(i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memmove(int *, int *, int);
void copy_ivector(int *dst, int *src, int n) {
  memmove(dst, src, sizeof(int) * n);
}


x86 assembly (clang, -O0):
<copy_ivector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   1030 <memmove@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_ivector>:
shl    $0x2,%edx
jmp    1030 <memmove@plt>

LLVM IR (-O0):
define void @copy_ivector(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 = sext i32 %9 to i64
%11 = mul i64 4, %10
%12 = trunc i64 %11 to i32
%13 = call i32 @memmove(i32* %7, i32* %8, i32 %12)
ret void
}

LLVM IR (-O2):
define void @copy_ivector(i32* %0, i32* %1, i32 %2) {
%4 = shl i32 %2, 2
%5 = tail call i32 @memmove(i32* %0, i32* %1, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ say(char *);
int main(void) {
  say("hello lovely");
  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 <say@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [13 x i8] c"hello lovely\00"
define i32 @main() {
%1 = tail call i32 @say(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
unsigned long lh_ptr_hash(void *k) { return ((long)k * 0x9e370001UL) >> 4; }


x86 assembly (clang, -O0):
<lh_ptr_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movabs $0x9e370001,%rcx
imul   %rcx,%rax
shr    $0x4,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lh_ptr_hash>:
mov    $0x9e370001,%eax
imul   %rdi,%rax
shr    $0x4,%rax
ret

LLVM IR (-O0):
define i64 @lh_ptr_hash(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
%5 = mul i64 %4, 2654404609
%6 = lshr i64 %5, 4
ret i64 %6
}

LLVM IR (-O2):
define i64 @lh_ptr_hash(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = mul i64 %2, 2654404609
%4 = lshr i64 %3, 4
ret i64 %4
}
int mlog(int x) {
  int res = 0;
  while (x > 1) {
    x = x / 2;
    res++;
  }
  return res;
}


x86 assembly (clang, -O0):
<mlog>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    1134 <mlog+0x34>
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <mlog+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mlog>:
xor    %eax,%eax
cmp    $0x2,%edi
jl     111c <mlog+0x1c>
xor    %eax,%eax
mov    %edi,%ecx
nopl   0x0(%rax,%rax,1)
shr    %ecx
add    $0x1,%eax
cmp    $0x3,%edi
mov    %ecx,%edi
ja     1110 <mlog+0x10>
ret

LLVM IR (-O0):
define i32 @mlog(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %7, %1
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sdiv i32 %8, 2
store i32 %9, i32* %2
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
br label %4
12: ; preds = %4
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @mlog(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = lshr i32 %5, 1
%7 = add nuw nsw i32 %4, 1
%8 = icmp ugt i32 %5, 3
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %10
}
/* Variables and functions */
int needRehashHS(size_t nitems, size_t capacity) {
  return (nitems / (double)capacity) > 0.80;
}


x86 assembly (clang, -O0):
<needRehashHS>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movaps 0xefd(%rip),%xmm3
movq   -0x8(%rbp),%xmm0
punpckldq %xmm3,%xmm0
movapd 0xefc(%rip),%xmm2
subpd  %xmm2,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movq   -0x10(%rbp),%xmm1
punpckldq %xmm3,%xmm1
subpd  %xmm2,%xmm1
movaps %xmm1,%xmm2
unpckhpd %xmm1,%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  0xea9(%rip),%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<needRehashHS>:
movq   %rdi,%xmm0
movdqa 0xef3(%rip),%xmm1
punpckldq %xmm1,%xmm0
movapd 0xef7(%rip),%xmm2
subpd  %xmm2,%xmm0
movapd %xmm0,%xmm3
unpckhpd %xmm0,%xmm3
addsd  %xmm0,%xmm3
movq   %rsi,%xmm0
punpckldq %xmm1,%xmm0
subpd  %xmm2,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
addsd  %xmm0,%xmm1
divsd  %xmm1,%xmm3
xor    %eax,%eax
ucomisd 0xed0(%rip),%xmm3
seta   %al
ret

LLVM IR (-O0):
define i32 @needRehashHS(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = uitofp i64 %5 to double
%7 = load i64, i64* %4
%8 = uitofp i64 %7 to double
%9 = fdiv double %6, %8
%10 = fcmp ogt double %9, 8.000000e-01
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @needRehashHS(i64 %0, i64 %1) {
%3 = uitofp i64 %0 to double
%4 = uitofp i64 %1 to double
%5 = fdiv double %3, %4
%6 = fcmp ogt double %5, 8.000000e-01
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ __m64;
typedef int /*<<< orphan*/ __m128;

/* Variables and functions */
int /*<<< orphan*/ _mm_cvtps_pi16(int /*<<< orphan*/);
int /*<<< orphan*/ _mm_packs_pi16(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_setzero_si64();
__m64 __attribute__((__always___, __nodebug__)) _mm_cvtps_pi8(__m128 a) {
  __m64 b, c;
  b = _mm_cvtps_pi16(a);
  c = _mm_setzero_si64();
  return _mm_packs_pi16(b, c);
}


x86 assembly (clang, -O0):
<_mm_cvtps_pi8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <_mm_cvtps_pi16@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <_mm_setzero_si64@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <_mm_packs_pi16@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_mm_cvtps_pi8>:
push   %rbx
call   1040 <_mm_cvtps_pi16@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <_mm_setzero_si64@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1030 <_mm_packs_pi16@plt>

LLVM IR (-O0):
define i32 @_mm_cvtps_pi8(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @_mm_cvtps_pi16(i32 %5)
store i32 %6, i32* %3
%7 = call i32 (...) @_mm_setzero_si64()
store i32 %7, i32* %4
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @_mm_packs_pi16(i32 %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @_mm_cvtps_pi8(i32 %0) {
%2 = tail call i32 @_mm_cvtps_pi16(i32 %0)
%3 = tail call i32 (...) @_mm_setzero_si64()
%4 = tail call i32 @_mm_packs_pi16(i32 %2, i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strlen(char const *);
int /*<<< orphan*/ write(int, char const *, int /*<<< orphan*/);
int main() {
  const char *mess = "HAI HOW ARE YOU THIS IS A TEST";
  write(1, mess, strlen(mess));
  printf("A B C D\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1030 <write@plt>
lea    0xeb4(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"HAI HOW ARE YOU THIS IS A TEST\00"
@.str.1 = [9 x i8] c"A B C D\0A\00"
define i32 @main() {
%1 = alloca i8*
store i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @strlen(i8* %3)
%5 = call i32 @write(i32 1, i8* %2, i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"HAI HOW ARE YOU THIS IS A TEST\00"
@str = [8 x i8] c"A B C D\00"
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int AddIdent(char *);
int CHAR_BIT;
char *lab2str(char *, int);
int AddNumericIdent(int n) {
  char s[1 + (2 + CHAR_BIT * sizeof n) / 3];
  char *p = s + sizeof s;
  *--p = '\0';
  p = lab2str(p, n);
  return AddIdent(p);
}


x86 assembly (clang, -O0):
<AddNumericIdent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
movslq (%rax),%rax
lea    0x2(,%rax,4),%rax
movabs $0xaaaaaaaaaaaaaaab,%rcx
aa aa aa
mul    %rcx
shr    %rdx
mov    %rdx,%rcx
add    $0x1,%rcx
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
add    $0x10,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,%rsp
mov    %rcx,-0x18(%rbp)
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x0,-0x1(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1030 <lab2str@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <AddIdent@plt>
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AddNumericIdent>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
movslq (%rax),%rax
lea    0x2(,%rax,4),%rax
movabs $0xaaaaaaaaaaaaaaab,%rcx
aa aa aa
mul    %rcx
mov    %edi,%esi
shr    %rdx
lea    0x10(%rdx),%rax
and    $0xfffffffffffffff0,%rax
mov    %rsp,%rcx
sub    %rax,%rcx
mov    %rcx,%rsp
lea    (%rcx,%rdx,1),%rdi
movb   $0x0,(%rdx,%rcx,1)
call   1030 <lab2str@plt>
mov    %rax,%rdi
call   1040 <AddIdent@plt>
mov    %rbp,%rsp
pop    %rbp
ret

LLVM IR (-O0):
@CHAR_BIT = global i32 0
define i32 @AddNumericIdent(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i32 %0, i32* %2
%6 = load i32, i32* @CHAR_BIT
%7 = sext i32 %6 to i64
%8 = mul i64 %7, 4
%9 = add i64 2, %8
%10 = udiv i64 %9, 3
%11 = add i64 1, %10
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %3
%13 = alloca i8, i64 %11
store i64 %11, i64* %4
%14 = getelementptr inbounds i8, i8* %13, i64 %11
store i8* %14, i8** %5
%15 = load i8*, i8** %5
%16 = getelementptr inbounds i8, i8* %15, i32 -1
store i8* %16, i8** %5
store i8 0, i8* %16
%17 = load i8*, i8** %5
%18 = load i32, i32* %2
%19 = call i8* @lab2str(i8* %17, i32 %18)
store i8* %19, i8** %5
%20 = load i8*, i8** %5
%21 = call i32 @AddIdent(i8* %20)
%22 = load i8*, i8** %3
ret i32 %21
}

LLVM IR (-O2):
@CHAR_BIT = global i32 0
define i32 @AddNumericIdent(i32 %0) {
%2 = load i32, i32* @CHAR_BIT
%3 = sext i32 %2 to i64
%4 = shl nsw i64 %3, 2
%5 = or i64 %4, 2
%6 = udiv i64 %5, 3
%7 = add nuw nsw i64 %6, 1
%8 = alloca i8, i64 %7
%9 = getelementptr inbounds i8, i8* %8, i64 %6
store i8 0, i8* %9
%10 = call i8* @lab2str(i8* %9, i32 %0)
%11 = call i32 @AddIdent(i8* %10)
ret i32 %11
}
int test9(int sv, unsigned uv, long slv) { return sv == (uv ^= slv); }


x86 assembly (clang, -O0):
<test9>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x10(%rbp),%rdx
mov    -0x8(%rbp),%ecx
xor    %rdx,%rcx
mov    %ecx,-0x8(%rbp)
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test9>:
xor    %esi,%edx
xor    %eax,%eax
cmp    %edi,%edx
sete   %al
ret

LLVM IR (-O0):
define i32 @test9(i32 %0, i32 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
store i32 %0, i32* %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = load i32, i32* %4
%8 = load i64, i64* %6
%9 = load i32, i32* %5
%10 = zext i32 %9 to i64
%11 = xor i64 %10, %8
%12 = trunc i64 %11 to i32
store i32 %12, i32* %5
%13 = icmp eq i32 %7, %12
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @test9(i32 %0, i32 %1, i64 %2) {
%4 = trunc i64 %2 to i32
%5 = xor i32 %4, %1
%6 = icmp eq i32 %5, %0
%7 = zext i1 %6 to i32
ret i32 %7
}
int test_imm_20uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x20 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_20uint64_highword_reg>:
bt     $0x25,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_20uint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 32
%5 = and i64 %4, 32
%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_20uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 137438953472
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
char *strct(char *, char);
main() {
  char a[20] = "Hello World";
  printf("\n%s", strct(a, 'l'));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x6c,%esi
call   1040 <strct@plt>
mov    %rax,%rsi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
mov    %rsp,%rdi
mov    $0x6c,%esi
call   1040 <strct@plt>
lea    0xec9(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [20 x i8] c"Hello World\00\00\00\00\00\00\00\00\00"
@.str = [4 x i8] c"\0A%s\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = bitcast [20 x i8]* %1 to i8*
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = call i8* @strct(i8* %3, i8 signext 108)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [20 x i8] c"Hello World\00\00\00\00\00\00\00\00\00"
@.str = [4 x i8] c"\0A%s\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i8* @strct(i8* %2, i8 signext 108)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}
int test_imm_F3uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xF3 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_F3uint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 243
%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_F3uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 15925248
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void panic(char *message) {
  fprintf(stderr, "Fatal error: %s\n", message);
  exit(1);
}


x86 assembly (clang, -O0):
<panic>:
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):
<panic>:
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 = [17 x i8] c"Fatal error: %s\0A\00"
define void @panic(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 ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"Fatal error: %s\0A\00"
define void @panic(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
unsigned char toprint(unsigned char chr) {
  return (chr > 0x1f && chr < 0x7f) ? chr : '.';
}


x86 assembly (clang, -O0):
<toprint>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x1f,%eax
jle    1130 <toprint+0x30>
movzbl -0x1(%rbp),%eax
cmp    $0x7f,%eax
jge    1130 <toprint+0x30>
movzbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    113d <toprint+0x3d>
mov    $0x2e,%eax
mov    %eax,-0x8(%rbp)
jmp    113d <toprint+0x3d>
mov    -0x8(%rbp),%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toprint>:
lea    -0x20(%rdi),%eax
cmp    $0x5f,%al
mov    $0x2e,%eax
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @toprint(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = icmp sgt i32 %4, 31
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = load i8, i8* %2
%8 = zext i8 %7 to i32
%9 = icmp slt i32 %8, 127
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = load i8, i8* %2
%12 = zext i8 %11 to i32
br label %14
13: ; preds = %6, %1
br label %14
14: ; preds = %13, %10
%15 = phi i32 [ %12, %10 ], [ 46, %13 ]
%16 = trunc i32 %15 to i8
ret i8 %16
}

LLVM IR (-O2):
define zeroext i8 @toprint(i8 zeroext %0) {
%2 = add i8 %0, -32
%3 = icmp ult i8 %2, 95
%4 = select i1 %3, i8 %0, i8 46
ret i8 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int hello2() {
  printf("\nHello 2222 world this is a test");
  return (1);
}


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

x86 assembly (clang, -O2):
<hello2>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"\0AHello 2222 world this is a test\00"
define i32 @hello2() {
%1 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@.str = [33 x i8] c"\0AHello 2222 world this is a test\00"
define i32 @hello2() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ pagealloc_init();
int module_init() {
  pagealloc_init();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @module_init() {
%1 = call i32 (...) @pagealloc_init()
ret i32 0
}

LLVM IR (-O2):
define i32 @module_init() {
%1 = tail call i32 (...) @pagealloc_init()
ret i32 0
}
/* Type definitions */
struct tm {
  int tm_year;
};

/* Variables and functions */
int tm_getyear(struct tm date) { return date.tm_year + 1900; }


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

x86 assembly (clang, -O2):
<tm_getyear>:
lea    0x76c(%rdi),%eax
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @tm_getyear(i32 %0) {
%2 = alloca %struct.tm
%3 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 0
store i32 %0, i32* %3
%4 = getelementptr inbounds %struct.tm, %struct.tm* %2, i32 0, i32 0
%5 = load i32, i32* %4
%6 = add nsw i32 %5, 1900
ret i32 %6
}

LLVM IR (-O2):
define i32 @tm_getyear(i32 %0) {
%2 = add nsw i32 %0, 1900
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ strcpy(char *, char *);
int main(int argc, char *argv[]) {
  char buffer[10];
  strcpy(buffer, argv[1]);
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
mov    0x8(%rsi),%rsi
lea    0xe(%rsp),%rdi
call   1030 <strcpy@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [10 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%7 = load i8**, i8*** %4
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @strcpy(i8* %6, i8* %9)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [10 x i8]
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = call i32 @strcpy(i8* %4, i8* %6)
ret i32 0
}
/* Variables and functions */
char *getlogin();
char *ptbl_get_cp_loginname(void) {
  char *cp_loginname;
  cp_loginname = getlogin();
  return cp_loginname;
}


x86 assembly (clang, -O0):
<ptbl_get_cp_loginname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getlogin@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @ptbl_get_cp_loginname() {
%1 = alloca i8*
%2 = call i8* (...) @getlogin()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
ret i8* %3
}

LLVM IR (-O2):
define i8* @ptbl_get_cp_loginname() {
%1 = tail call i8* (...) @getlogin()
ret i8* %1
}
void transpose0(double *out, const double *in) {}


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

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

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

LLVM IR (-O2):
define void @transpose0(double* nocapture %0, double* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void error_fatal(char *mens) {
  perror(mens);
  exit(1);
}


x86 assembly (clang, -O0):
<error_fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error_fatal>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @error_fatal(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @error_fatal(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
int main() {
  int sum = 0;
  while (1) {
    sum++;
    if (sum == 10)
      break;
  }
  return sum;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jne    112a <main+0x2a>
jmp    112f <main+0x2f>
jmp    1112 <main+0x12>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 10
}
void fa152(int n) {
  {
    int b[n];
    {
      int c[n];
      0;
    }
    {
      int d[n];
      0;
    };
    int e[n];
    0;
  };
  {
    int f[n];
  a:
    goto a;
    {
      int g[n];
      0;
    };
    {
      int h[n];
      0;
    };
    ;
    int i[n];
    0;
  };
  ;
  int j[n];
  0;
}


x86 assembly (clang, -O0):
<fa152>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rax,-0x50(%rbp)
jmp    1162 <fa152+0x62>

x86 assembly (clang, -O2):
<fa152>:
jmp    1100 <fa152>

LLVM IR (-O0):
define void @fa152(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i64
%17 = alloca i8*
%18 = alloca i64
store i32 %0, i32* %2
%19 = load i32, i32* %2
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
store i8* %21, i8** %3
%22 = alloca i32, i64 %20
store i64 %20, i64* %4
%23 = load i32, i32* %2
%24 = zext i32 %23 to i64
%25 = call i8* @llvm.stacksave()
store i8* %25, i8** %5
%26 = alloca i32, i64 %24
store i64 %24, i64* %6
%27 = load i8*, i8** %5
%28 = load i32, i32* %2
%29 = zext i32 %28 to i64
%30 = call i8* @llvm.stacksave()
store i8* %30, i8** %7
%31 = alloca i32, i64 %29
store i64 %29, i64* %8
%32 = load i8*, i8** %7
%33 = load i32, i32* %2
%34 = zext i32 %33 to i64
%35 = alloca i32, i64 %34
store i64 %34, i64* %9
%36 = load i8*, i8** %3
%37 = load i32, i32* %2
%38 = zext i32 %37 to i64
%39 = call i8* @llvm.stacksave()
store i8* %39, i8** %10
%40 = alloca i32, i64 %38
store i64 %38, i64* %11
br label %41
41: ; preds = %41, %1
br label %41
42: ; No predecessors!
%43 = load i32, i32* %2
%44 = zext i32 %43 to i64
%45 = call i8* @llvm.stacksave()
store i8* %45, i8** %12
%46 = alloca i32, i64 %44
store i64 %44, i64* %13
%47 = load i8*, i8** %12
%48 = load i32, i32* %2
%49 = zext i32 %48 to i64
%50 = call i8* @llvm.stacksave()
store i8* %50, i8** %14
%51 = alloca i32, i64 %49
store i64 %49, i64* %15
%52 = load i8*, i8** %14
%53 = load i32, i32* %2
%54 = zext i32 %53 to i64
%55 = alloca i32, i64 %54
store i64 %54, i64* %16
%56 = load i8*, i8** %10
%57 = load i32, i32* %2
%58 = zext i32 %57 to i64
%59 = call i8* @llvm.stacksave()
store i8* %59, i8** %17
%60 = alloca i32, i64 %58
store i64 %58, i64* %18
%61 = load i8*, i8** %17
ret void
}

LLVM IR (-O2):
define void @fa152(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
int mystrlen(char *s) {
  char *p = s;
  int i = 0;
  while (*p != '\0') {
    i++;
    p++;
  }
  return i;
}


x86 assembly (clang, -O0):
<mystrlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1141 <mystrlen+0x41>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1117 <mystrlen+0x17>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrlen>:
cmpb   $0x0,(%rdi)
je     111c <mystrlen+0x1c>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <mystrlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @mystrlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = add nuw nsw i32 %5, 1
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void printuse(char *pname) {
  printf("Usage:\n\t%s -b number -x number\n", pname);
  printf("Or:\n\t%s --box=number --ball=number\n", pname);
}


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

x86 assembly (clang, -O2):
<printuse>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"Usage:\0A\09%s -b number -x number\0A\00"
@.str.1 = [36 x i8] c"Or:\0A\09%s --box=number --ball=number\0A\00"
define void @printuse(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %5)
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Usage:\0A\09%s -b number -x number\0A\00"
@.str.1 = [36 x i8] c"Or:\0A\09%s --box=number --ball=number\0A\00"
define void @printuse(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
double calculate(double (*f)(double, double), double m1, double m2) {
  return f(m1, m2);
}


x86 assembly (clang, -O0):
<calculate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
call   *%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate>:
jmp    *%rdi

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

LLVM IR (-O2):
define double @calculate(double (double, double)* nocapture %0, double %1, double %2) {
%4 = tail call double %0(double %1, double %2)
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ LOG_PID;
int /*<<< orphan*/ LOG_USER;
int /*<<< orphan*/ openlog(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int debugopen(char *host) {
  openlog("libfli", LOG_PID, LOG_USER);
  return 0;
}


x86 assembly (clang, -O0):
<debugopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
mov    0x2ebc(%rip),%rax
mov    (%rax),%edx
lea    0xecb(%rip),%rdi
call   1030 <openlog@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<debugopen>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
mov    0x2ec7(%rip),%rax
mov    (%rax),%edx
lea    0xed6(%rip),%rdi
call   1030 <openlog@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"libfli\00"
@LOG_PID = global i32 0
@LOG_USER = global i32 0
define i32 @debugopen(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @LOG_PID
%4 = load i32, i32* @LOG_USER
%5 = call i32 @openlog(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"libfli\00"
@LOG_PID = global i32 0
@LOG_USER = global i32 0
define i32 @debugopen(i8* nocapture readnone %0) {
%2 = load i32, i32* @LOG_PID
%3 = load i32, i32* @LOG_USER
%4 = tail call i32 @openlog(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *libc_popen(char const *, char const *);
int /*<<< orphan*/ watch_log(char *, char const *);
FILE *popen(const char *command, const char *type) {
  watch_log("exec %s\n", command);
  return libc_popen(command, type);
}


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

x86 assembly (clang, -O2):
<popen>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
mov    %rbx,%rsi
call   1030 <watch_log@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <libc_popen@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"exec %s\0A\00"
define i32* @popen(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = call i32 @watch_log(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = call i32* @libc_popen(i8* %7, i8* %8)
ret i32* %9
}

LLVM IR (-O2):
@.str = [9 x i8] c"exec %s\0A\00"
define i32* @popen(i8* %0, i8* %1) {
%3 = tail call i32 @watch_log(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32* @libc_popen(i8* %0, i8* %1)
ret i32* %4
}
/* Variables and functions */
int /*<<< orphan*/ halt(int);
int /*<<< orphan*/ wheatLog(int, char *);
void handleQuit() {
  wheatLog(4, "Signal sigquit");
  halt(1);
}


x86 assembly (clang, -O0):
<handleQuit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
lea    0xed0(%rip),%rsi
call   1030 <wheatLog@plt>
mov    $0x1,%edi
call   1040 <halt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<handleQuit>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0x4,%edi
call   1030 <wheatLog@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <halt@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Signal sigquit\00"
define void @handleQuit() {
%1 = call i32 @wheatLog(i32 4, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @halt(i32 1)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Signal sigquit\00"
define void @handleQuit() {
%1 = tail call i32 @wheatLog(i32 4, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @halt(i32 1)
ret void
}
void RSA_generate_key_ex(void) {}


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

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

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

LLVM IR (-O2):
define void @RSA_generate_key_ex() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(int /*<<< orphan*/);
int /*<<< orphan*/ poptoken();
void voidtoken(void) { free(poptoken()); }


x86 assembly (clang, -O0):
<voidtoken>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <poptoken@plt>
mov    %eax,%edi
call   1030 <free@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<voidtoken>:
push   %rax
xor    %eax,%eax
call   1040 <poptoken@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @voidtoken() {
%1 = call i32 (...) @poptoken()
%2 = call i32 @free(i32 %1)
ret void
}

LLVM IR (-O2):
define void @voidtoken() {
%1 = tail call i32 (...) @poptoken()
%2 = tail call i32 @free(i32 %1)
ret void
}