xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *, int,
                           int);
void setinttype(char *tname, char *fname, int num, int arg, FILE *fp) {
  fprintf(fp, "define(STR_%s_%s%d,%d)\n", tname, fname, num, arg);
}


x86 assembly (clang, -O0):
<setinttype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
lea    0xebb(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setinttype>:
mov    %ecx,%r9d
mov    %edx,%eax
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xede(%rip),%rsi
mov    %r8,%rdi
mov    %eax,%r8d
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"define(STR_%s_%s%d,%d)\0A\00"
define void @setinttype(i8* %0, i8* %1, i32 %2, i32 %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32* %4, i32** %10
%11 = load i32*, i32** %10
%12 = load i8*, i8** %6
%13 = load i8*, i8** %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13, i32 %14, i32 %15)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"define(STR_%s_%s%d,%d)\0A\00"
define void @setinttype(i8* %0, i8* %1, i32 %2, i32 %3, i32* nocapture %4) {
%6 = tail call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i32 %2, i32 %3)
ret void
}
/* Variables and functions */
int CHAR_BIT;
int test_bit(unsigned long *bitmap, unsigned int bit) {
  return (int)(bitmap[bit / (CHAR_BIT * sizeof(long))] >>
               (bit % (CHAR_BIT * sizeof(long)))) &
         1;
}


x86 assembly (clang, -O0):
<test_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2ec3(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x3,%rcx
xor    %edx,%edx
div    %rcx
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e9e(%rip),%rcx
movslq (%rcx),%rcx
shl    $0x3,%rcx
xor    %edx,%edx
div    %rcx
mov    -0x18(%rbp),%rax
mov    %rdx,%rcx
shr    %cl,%rax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_bit>:
mov    %esi,%ecx
mov    0x2ed7(%rip),%rax
movslq (%rax),%rsi
shl    $0x3,%rsi
cmp    %rsi,%rcx
jb     111f <test_bit+0x1f>
mov    %ecx,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%ecx
jmp    1121 <test_bit+0x21>
xor    %eax,%eax
mov    (%rdi,%rax,8),%rax
shr    %cl,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
@CHAR_BIT = global i32 0
define i32 @test_bit(i64* %0, i32 %1) {
%3 = alloca i64*
%4 = alloca i32
store i64* %0, i64** %3
store i32 %1, i32* %4
%5 = load i64*, i64** %3
%6 = load i32, i32* %4
%7 = zext i32 %6 to i64
%8 = load i32, i32* @CHAR_BIT
%9 = sext i32 %8 to i64
%10 = mul i64 %9, 8
%11 = udiv i64 %7, %10
%12 = getelementptr inbounds i64, i64* %5, i64 %11
%13 = load i64, i64* %12
%14 = load i32, i32* %4
%15 = zext i32 %14 to i64
%16 = load i32, i32* @CHAR_BIT
%17 = sext i32 %16 to i64
%18 = mul i64 %17, 8
%19 = urem i64 %15, %18
%20 = lshr i64 %13, %19
%21 = trunc i64 %20 to i32
%22 = and i32 %21, 1
ret i32 %22
}

LLVM IR (-O2):
@CHAR_BIT = global i32 0
define i32 @test_bit(i64* nocapture %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = load i32, i32* @CHAR_BIT
%5 = sext i32 %4 to i64
%6 = shl nsw i64 %5, 3
%7 = udiv i64 %3, %6
%8 = getelementptr inbounds i64, i64* %0, i64 %7
%9 = load i64, i64* %8
%10 = urem i64 %3, %6
%11 = lshr i64 %9, %10
%12 = trunc i64 %11 to i32
%13 = and i32 %12, 1
ret i32 %13
}
/* Variables and functions */
int partition(int *, int, int);
void quick_sort(int *a, int s, int t) {
  int p;
  if (s < t) {
    p = partition(a, s, t);
    quick_sort(a, s, p - 1);
    quick_sort(a, p + 1, t);
  }
}


x86 assembly (clang, -O0):
<quick_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <quick_sort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <quick_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <quick_sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quick_sort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <quick_sort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <quick_sort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quick_sort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @quick_sort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quick_sort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
void test121_Test_01_targetInit__I() {}


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

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

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

LLVM IR (-O2):
define void @test121_Test_01_targetInit__I() {
ret void
}
void dbAsyncDelete(void) {
  _serverPanic("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/"
               "heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c",
               57, "Function '%s' is disabled.", __func__);
}


x86 assembly (clang, -O0):
<dbAsyncDelete>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x39,%esi
lea    0xf79(%rip),%rdx
lea    0xf8d(%rip),%rcx
mov    $0x0,%al
call   1030 <_serverPanic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbAsyncDelete>:
lea    0xee9(%rip),%rdi
lea    0xf82(%rip),%rdx
lea    0xf96(%rip),%rcx
mov    $0x39,%esi
xor    %eax,%eax
jmp    1030 <_serverPanic@plt>

LLVM IR (-O0):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.dbAsyncDelete = [14 x i8] c"dbAsyncDelete\00"
define void @dbAsyncDelete() {
%1 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 57, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.dbAsyncDelete, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.dbAsyncDelete = [14 x i8] c"dbAsyncDelete\00"
define void @dbAsyncDelete() {
%1 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 57, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @__func__.dbAsyncDelete, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ define_orthogonal_complex(int, int);
int /*<<< orphan*/ put_orthogonal_complex(int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int x, y;
  scanf("%d", &x);
  scanf("%d", &y);
  put_orthogonal_complex(define_orthogonal_complex(x, y));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeaa(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <define_orthogonal_complex@plt>
mov    %eax,%edi
call   1040 <put_orthogonal_complex@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1030 <define_orthogonal_complex@plt>
mov    %eax,%edi
call   1040 <put_orthogonal_complex@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = call i32 @define_orthogonal_complex(i32 %6, i32 %7)
%9 = call i32 @put_orthogonal_complex(i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 @define_orthogonal_complex(i32 %7, i32 %8)
%10 = call i32 @put_orthogonal_complex(i32 %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ radio_prepare_adv();
int /*<<< orphan*/ radio_send_adv();
void adv_intvl_handler(void) {
  radio_prepare_adv();
  radio_send_adv();
}


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

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

LLVM IR (-O0):
define void @adv_intvl_handler() {
%1 = call i32 (...) @radio_prepare_adv()
%2 = call i32 (...) @radio_send_adv()
ret void
}

LLVM IR (-O2):
define void @adv_intvl_handler() {
%1 = tail call i32 (...) @radio_prepare_adv()
%2 = tail call i32 (...) @radio_send_adv()
ret void
}
/* Variables and functions */
scalar_t__ isgraph(int);
int isprint(int ch) { return ch == 0x20 || isgraph(ch); }


x86 assembly (clang, -O0):
<isprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     113c <isprint+0x2c>
mov    -0x4(%rbp),%edi
call   1030 <isgraph@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isprint>:
mov    $0x1,%eax
cmp    $0x20,%edi
je     112f <isprint+0x1f>
push   %rax
call   1030 <isgraph@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @isprint(i32 %0) {
%2 = icmp eq i32 %0, 32
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i64 @isgraph(i32 %0)
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 1, %1 ], [ %6, %3 ]
ret i32 %8
}
/* Variables and functions */
int time_total_milliseconds(float);
int time_seconds(float t) { return time_total_milliseconds(t) / 1000 % 60; }


x86 assembly (clang, -O0):
<time_seconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <time_total_milliseconds@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_seconds>:
push   %rax
call   1030 <time_total_milliseconds@plt>
cltq
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0x6,%eax
add    %ecx,%eax
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x3c,%ecx,%ecx
sub    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @time_seconds(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @time_total_milliseconds(float %3)
%5 = sdiv i32 %4, 1000
%6 = srem i32 %5, 60
ret i32 %6
}

LLVM IR (-O2):
define i32 @time_seconds(float %0) {
%2 = tail call i32 @time_total_milliseconds(float %0)
%3 = sdiv i32 %2, 1000
%4 = srem i32 %3, 60
ret i32 %4
}
dummy(p) struct anode *p;
{ return (1); }


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

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

LLVM IR (-O0):
%struct.anode = type opaque
define i32 @dummy(%struct.anode* %0) {
%2 = alloca %struct.anode*
store %struct.anode* %0, %struct.anode** %2
ret i32 1
}

LLVM IR (-O2):
%struct.anode = type opaque
define i32 @dummy(%struct.anode* nocapture readnone %0) {
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ siginfo_t;
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ SYS_rt_tgsigqueueinfo;
int syscall(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/, int,
            int /*<<< orphan*/ *);
int sys_rt_tgsigqueueinfo(pid_t tgid, pid_t tid, int sig, siginfo_t *uinfo) {
  return syscall(SYS_rt_tgsigqueueinfo, tgid, tid, sig, uinfo);
}


x86 assembly (clang, -O0):
<sys_rt_tgsigqueueinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%r8
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_rt_tgsigqueueinfo>:
mov    %rcx,%r8
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
@SYS_rt_tgsigqueueinfo = global i32 0
define i32 @sys_rt_tgsigqueueinfo(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* @SYS_rt_tgsigqueueinfo
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32*, i32** %8
%14 = call i32 @syscall(i32 %9, i32 %10, i32 %11, i32 %12, i32* %13)
ret i32 %14
}

LLVM IR (-O2):
@SYS_rt_tgsigqueueinfo = global i32 0
define i32 @sys_rt_tgsigqueueinfo(i32 %0, i32 %1, i32 %2, i32* %3) {
%5 = load i32, i32* @SYS_rt_tgsigqueueinfo
%6 = tail call i32 @syscall(i32 %5, i32 %0, i32 %1, i32 %2, i32* %3)
ret i32 %6
}
/* Forward declarations */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ xcb_get_property_reply_t;
struct TYPE_3__ {
  int /*<<< orphan*/ sequence;
};
typedef TYPE_1__ xcb_get_property_cookie_t;
typedef int /*<<< orphan*/ xcb_generic_error_t;
typedef int /*<<< orphan*/ xcb_connection_t;

/* Variables and functions */
scalar_t__ __xcb_wait_for_event_timeo(int /*<<< orphan*/ *, int /*<<< orphan*/,
                                      int /*<<< orphan*/ **, int);
xcb_get_property_reply_t *
xcb_get_property_reply_timeo(xcb_connection_t *c,
                             xcb_get_property_cookie_t cookie,
                             xcb_generic_error_t **e) {
  return (xcb_get_property_reply_t *)__xcb_wait_for_event_timeo(
      c, cookie.sequence, e, 50);
}


x86 assembly (clang, -O0):
<xcb_get_property_reply_timeo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %esi,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    $0x32,%ecx
call   1030 <__xcb_wait_for_event_timeo@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcb_get_property_reply_timeo>:
mov    $0x32,%ecx
jmp    1030 <__xcb_wait_for_event_timeo@plt>

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32 }
define i32* @xcb_get_property_reply_timeo(i32* %0, i32 %1, i32** %2) {
%4 = alloca %struct.TYPE_3__
%5 = alloca i32*
%6 = alloca i32**
%7 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i32 0, i32 0
store i32 %1, i32* %7
store i32* %0, i32** %5
store i32** %2, i32*** %6
%8 = load i32*, i32** %5
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i32 0, i32 0
%10 = load i32, i32* %9
%11 = load i32**, i32*** %6
%12 = call i64 @__xcb_wait_for_event_timeo(i32* %8, i32 %10, i32** %11, i32 50)
%13 = inttoptr i64 %12 to i32*
ret i32* %13
}

LLVM IR (-O2):
define i32* @xcb_get_property_reply_timeo(i32* %0, i32 %1, i32** %2) {
%4 = tail call i64 @__xcb_wait_for_event_timeo(i32* %0, i32 %1, i32** %2, i32 50)
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}
/* Variables and functions */
char const *strstr(char const *, char const *);
int strstarts(const char *s1, const char *s2) { return (s1 == strstr(s1, s2)); }


x86 assembly (clang, -O0):
<strstarts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @strstarts(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i8* @strstr(i8* %6, i8* %7)
%9 = icmp eq i8* %5, %8
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @strstarts(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = tail call i32 @strncmp(i8* %0, i8* %1, i64 %3)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
__attribute__((no)) void foo(long long *arr) {
  for (int i = 0; i < 256; i++)
    arr[i] *= -19594LL;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x100,-0xc(%rbp)
jge    113e <foo+0x3e>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   $0xffffffffffffb376,(%rax,%rcx,8),%rdx
ff
mov    %rdx,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <foo+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
imul   $0xffffffffffffb376,(%rdi,%rax,8),%rcx
ff
mov    %rcx,(%rdi,%rax,8)
imul   $0xffffffffffffb376,0x8(%rdi,%rax,8),%rcx
ff ff
mov    %rcx,0x8(%rdi,%rax,8)
imul   $0xffffffffffffb376,0x10(%rdi,%rax,8),%rcx
ff ff
mov    %rcx,0x10(%rdi,%rax,8)
imul   $0xffffffffffffb376,0x18(%rdi,%rax,8),%rcx
ff ff
mov    %rcx,0x18(%rdi,%rax,8)
add    $0x4,%rax
cmp    $0x100,%rax
jne    1110 <foo+0x10>
ret

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

LLVM IR (-O2):
define void @foo(i64* nocapture %0) {
br label %3
2: ; preds = %3
ret void
3: ; preds = %3, %1
%4 = phi i64 [ 0, %1 ], [ %20, %3 ]
%5 = getelementptr inbounds i64, i64* %0, i64 %4
%6 = load i64, i64* %5
%7 = mul nsw i64 %6, -19594
store i64 %7, i64* %5
%8 = or i64 %4, 1
%9 = getelementptr inbounds i64, i64* %0, i64 %8
%10 = load i64, i64* %9
%11 = mul nsw i64 %10, -19594
store i64 %11, i64* %9
%12 = or i64 %4, 2
%13 = getelementptr inbounds i64, i64* %0, i64 %12
%14 = load i64, i64* %13
%15 = mul nsw i64 %14, -19594
store i64 %15, i64* %13
%16 = or i64 %4, 3
%17 = getelementptr inbounds i64, i64* %0, i64 %16
%18 = load i64, i64* %17
%19 = mul nsw i64 %18, -19594
store i64 %19, i64* %17
%20 = add nuw nsw i64 %4, 4
%21 = icmp eq i64 %20, 256
br i1 %21, label %2, label %3
}
/* Variables and functions */
scalar_t__ calloc(unsigned int, int);
int /*<<< orphan*/ perror(char *);
char *alloc_chars(unsigned int length) {
  char *s;
  if ((s = (char *)calloc(length, sizeof(char))) == NULL) {
    perror("calloc");
    return NULL;
  }
  return s;
}


x86 assembly (clang, -O0):
<alloc_chars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    115f <alloc_chars+0x3f>
lea    0xeb3(%rip),%rdi
call   1040 <perror@plt>
movq   $0x0,-0x8(%rbp)
jmp    1167 <alloc_chars+0x47>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_chars>:
push   %rax
mov    $0x1,%esi
call   1030 <calloc@plt>
test   %rax,%rax
je     1132 <alloc_chars+0x12>
pop    %rcx
ret
lea    0xec7(%rip),%rdi
call   1040 <perror@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"calloc\00"
define i8* @alloc_chars(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i64 @calloc(i32 %5, i32 1)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %4
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i8* null, i8** %2
br label %13
11: ; preds = %1
%12 = load i8*, i8** %4
store i8* %12, i8** %2
br label %13
13: ; preds = %11, %9
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
@.str = [7 x i8] c"calloc\00"
define i8* @alloc_chars(i32 %0) {
%2 = tail call i64 @calloc(i32 %0, i32 1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %1
%7 = inttoptr i64 %2 to i8*
br label %8
8: ; preds = %6, %4
%9 = phi i8* [ null, %4 ], [ %7, %6 ]
ret i8* %9
}
int test_imm_B3uint16_mem(unsigned short *val) {
  return ((*val) & (0xB3 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_B3uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 179
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void cacheex_init_hitcache(void) {}


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

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

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

LLVM IR (-O2):
define void @cacheex_init_hitcache() {
ret void
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
void bitmap64_set(int64_t *bitmap, int n) { *bitmap |= ((int64_t)1 << n); }


x86 assembly (clang, -O0):
<bitmap64_set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmap64_set>:
mov    %esi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     %eax,(%rdi)
ret

LLVM IR (-O0):
define void @bitmap64_set(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = shl i32 1, %5
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
%9 = or i32 %8, %6
store i32 %9, i32* %7
ret void
}

LLVM IR (-O2):
define void @bitmap64_set(i32* nocapture %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = load i32, i32* %0
%5 = or i32 %4, %3
store i32 %5, i32* %0
ret void
}
void RTSocketReadNB(void) {}


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

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

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

LLVM IR (-O2):
define void @RTSocketReadNB() {
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int bin_is_valid(uint8_t b) { return (b & 0b01000000) != 0; }


x86 assembly (clang, -O0):
<bin_is_valid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x40,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin_is_valid>:
mov    %edi,%eax
shr    $0x6,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @bin_is_valid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 64
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @bin_is_valid(i32 %0) {
%2 = lshr i32 %0, 6
%3 = and i32 %2, 1
ret i32 %3
}
int ilen(int n) {
  int s = 0;
  while (n)
    n /= 10, ++s;
  return s;
}


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

x86 assembly (clang, -O2):
<ilen>:
xor    %eax,%eax
test   %edi,%edi
je     1132 <ilen+0x32>
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
add    $0x1,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <ilen+0x10>
ret

LLVM IR (-O0):
define i32 @ilen(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 ne i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load i32, i32* %2
%9 = sdiv i32 %8, 10
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 @ilen(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %7, %3 ], [ 0, %1 ]
%5 = phi i32 [ %6, %3 ], [ %0, %1 ]
%6 = sdiv i32 %5, 10
%7 = add nuw nsw i32 %4, 1
%8 = add i32 %5, 9
%9 = icmp ult i32 %8, 19
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %7, %3 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int main(void) { printf("%.29f\n", 1.0 / 10.0); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xeed(%rip),%rdi
movsd  0xedd(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"%.29f\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double 1.000000e-01)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%.29f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double 1.000000e-01)
ret i32 0
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void output(uint16_t v) { printf("0x%04x, ", v); }


x86 assembly (clang, -O0):
<output>:
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):
<output>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"0x%04x, \00"
define void @output(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
unsigned int vhaddu2(unsigned int a, unsigned int b) {
  unsigned int r, s;
  s = a ^ b;
  r = a & b;
  s = s & 0xfffefffe;
  s = s >> 1;
  r = r + s;
  return r;
}


x86 assembly (clang, -O0):
<vhaddu2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
and    $0xfffefffe,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vhaddu2>:
mov    %esi,%eax
xor    %edi,%eax
and    %edi,%esi
shr    %eax
and    $0x7fff7fff,%eax
add    %esi,%eax
ret

LLVM IR (-O0):
define i32 @vhaddu2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = xor i32 %7, %8
store i32 %9, i32* %6
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = and i32 %10, %11
store i32 %12, i32* %5
%13 = load i32, i32* %6
%14 = and i32 %13, -65538
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = lshr i32 %15, 1
store i32 %16, i32* %6
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = add i32 %17, %18
store i32 %19, i32* %5
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
define i32 @vhaddu2(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
%4 = and i32 %1, %0
%5 = lshr i32 %3, 1
%6 = and i32 %5, 2147450879
%7 = add i32 %6, %4
ret i32 %7
}
void (*signal(int sig, void (*func)(int)))(int) { return 0; }


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

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

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

LLVM IR (-O2):
define noalias void (i32)* @signal(i32 %0, void (i32)* nocapture readnone %1) {
ret void (i32)* null
}
/* Variables and functions */
int /*<<< orphan*/ TestFunc();
int /*<<< orphan*/ write_line(char *);
int main() {
  write_line("Calling test function");
  TestFunc();
  write_line("After test function");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"Calling test function\00"
@.str.1 = [20 x i8] c"After test function\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @write_line(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @TestFunc()
%4 = call i32 @write_line(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Calling test function\00"
@.str.1 = [20 x i8] c"After test function\00"
define i32 @main() {
%1 = tail call i32 @write_line(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @TestFunc()
%3 = tail call i32 @write_line(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
double cos(double);
double cos_lat(double lat) {
  return cos(lat * 0.017453292519943295769236907684886);
}


x86 assembly (clang, -O0):
<cos_lat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
call   1030 <cos@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cos_lat>:
mulsd  0xee8(%rip),%xmm0
jmp    1030 <cos@plt>

LLVM IR (-O0):
define double @cos_lat(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 0x3F91DF46A2529D39
%5 = call double @cos(double %4)
ret double %5
}

LLVM IR (-O2):
define double @cos_lat(double %0) {
%2 = fmul double %0, 0x3F91DF46A2529D39
%3 = tail call double @cos(double %2)
ret double %3
}
/* Variables and functions */
int __copy(char *, char const *, int);
int safecpy(char *dst, const char *src, int dstsize) {
  return __copy(dst, src, dstsize);
}


x86 assembly (clang, -O0):
<safecpy>:
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
mov    -0x14(%rbp),%edx
call   1030 <__copy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safecpy>:
jmp    1030 <__copy@plt>

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

LLVM IR (-O2):
define i32 @safecpy(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @__copy(i8* %0, i8* %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int test_post_alib(void) {
  printf("This is a \"post/alib\" target.\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"This is a \22post/alib\22 target.\0A\00"
define i32 @test_post_alib() {
%1 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [30 x i8] c"This is a \22post/alib\22 target.\00"
define i32 @test_post_alib() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret i32 0
}
int gcd_algorithm(int x, int y) {
  if (y == 0) {
    return x;
  } else if (x >= y && y > 0) {
    return gcd_algorithm(y, (x % y));
  }
}


x86 assembly (clang, -O0):
<gcd_algorithm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1133 <gcd_algorithm+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1167 <gcd_algorithm+0x57>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1162 <gcd_algorithm+0x52>
cmpl   $0x0,-0xc(%rbp)
jle    1162 <gcd_algorithm+0x52>
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,%esi
call   1030 <gcd_algorithm@plt>
mov    %eax,-0x4(%rbp)
jmp    1167 <gcd_algorithm+0x57>
jmp    1167 <gcd_algorithm+0x57>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd_algorithm>:
mov    %edi,%eax
test   %esi,%esi
je     1125 <gcd_algorithm+0x25>
mov    %esi,%edx
nopl   0x0(%rax,%rax,1)
mov    %edx,%ecx
cmp    %edx,%eax
jl     1123 <gcd_algorithm+0x23>
test   %ecx,%ecx
jle    1123 <gcd_algorithm+0x23>
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <gcd_algorithm+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd_algorithm(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %10
%5 = phi i32 [ %11, %10 ], [ %1, %2 ]
%6 = phi i32 [ %5, %10 ], [ %0, %2 ]
%7 = icmp sge i32 %6, %5
%8 = icmp sgt i32 %5, 0
%9 = and i1 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %4
%11 = srem i32 %6, %5
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %10, %2
%14 = phi i32 [ %0, %2 ], [ %5, %10 ], [ %5, %4 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int main() {
  unsigned int teste = 0;
  teste = 1 << 9;
  printf("%d\n", teste);
  return (0);
}


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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 512)
ret i32 0
}
/* Type definitions */
typedef int uint32_t;
typedef scalar_t__ int8_t;
typedef int int32_t;

/* Variables and functions */
int32_t constructWord_0(int8_t byte1_0, int8_t byte2_0) {
  int32_t signed_0 = ((int32_t)(((uint32_t)((int32_t)byte1_0)) << 8)) |
                     (((int32_t)byte2_0) & 255);
  int32_t norm_75;
  if (signed_0 < 0) {
    norm_75 = signed_0 + 65536;
  } else {
    norm_75 = signed_0;
  }
  int32_t unsigned_0 = norm_75;
  return unsigned_0;
}


x86 assembly (clang, -O0):
<constructWord_0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
and    $0xff,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    113c <constructWord_0+0x3c>
mov    -0x14(%rbp),%eax
add    $0x10000,%eax
mov    %eax,-0x18(%rbp)
jmp    1142 <constructWord_0+0x42>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<constructWord_0>:
shl    $0x8,%edi
movzbl %sil,%eax
lea    (%rax,%rdi,1),%ecx
test   %ecx,%ecx
lea    0x10000(%rax,%rdi,1),%eax
cmovns %ecx,%eax
ret

LLVM IR (-O0):
define i32 @constructWord_0(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i64 %0, i64* %3
store i64 %1, i64* %4
%8 = load i64, i64* %3
%9 = trunc i64 %8 to i32
%10 = shl i32 %9, 8
%11 = load i64, i64* %4
%12 = trunc i64 %11 to i32
%13 = and i32 %12, 255
%14 = or i32 %10, %13
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 65536
store i32 %19, i32* %6
br label %22
20: ; preds = %2
%21 = load i32, i32* %5
store i32 %21, i32* %6
br label %22
22: ; preds = %20, %17
%23 = load i32, i32* %6
store i32 %23, i32* %7
%24 = load i32, i32* %7
ret i32 %24
}

LLVM IR (-O2):
define i32 @constructWord_0(i64 %0, i64 %1) {
%3 = trunc i64 %0 to i32
%4 = shl i32 %3, 8
%5 = trunc i64 %1 to i32
%6 = and i32 %5, 255
%7 = or i32 %6, %4
%8 = icmp slt i32 %7, 0
%9 = add nsw i32 %7, 65536
%10 = select i1 %8, i32 %9, i32 %7
ret i32 %10
}
void debug_set_file(const char *name) {}


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

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

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

LLVM IR (-O2):
define void @debug_set_file(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
int main() {
  system("clear");
  system("echo this is an example of a basic system call");
  printf("just as you've always done.\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [6 x i8] c"clear\00"
@.str.1 = [47 x i8] c"echo this is an example of a basic system call\00"
@.str.2 = [29 x i8] c"just as you've always done.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @system(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
@.str.1 = [47 x i8] c"echo this is an example of a basic system call\00"
@str = [28 x i8] c"just as you've always done.\00"
define i32 @main() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct stat {
  int st_mode;
  int st_nlink;
  int /*<<< orphan*/ st_gid;
  int /*<<< orphan*/ st_uid;
};

/* Variables and functions */
int S_IFDIR;
int /*<<< orphan*/ getgid();
int /*<<< orphan*/ getuid();
void stat_make_dir(struct stat *st) {
  st->st_mode = S_IFDIR | 0755;
  st->st_uid = getuid();
  st->st_gid = getgid();
  st->st_nlink = 2;
}


x86 assembly (clang, -O0):
<stat_make_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%ecx
or     $0x1ed,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <getuid@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    $0x0,%al
call   1040 <getgid@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x8(%rbp),%rax
movl   $0x2,0x4(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stat_make_dir>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ead(%rip),%rax
mov    $0x1ed,%ecx
or     (%rax),%ecx
mov    %ecx,(%rdi)
xor    %eax,%eax
call   1030 <getuid@plt>
mov    %eax,0xc(%rbx)
xor    %eax,%eax
call   1040 <getgid@plt>
mov    %eax,0x8(%rbx)
movl   $0x2,0x4(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
%struct.stat = type { i32, i32, i32, i32 }
@S_IFDIR = global i32 0
define void @stat_make_dir(%struct.stat* %0) {
%2 = alloca %struct.stat*
store %struct.stat* %0, %struct.stat** %2
%3 = load i32, i32* @S_IFDIR
%4 = or i32 %3, 493
%5 = load %struct.stat*, %struct.stat** %2
%6 = getelementptr inbounds %struct.stat, %struct.stat* %5, i32 0, i32 0
store i32 %4, i32* %6
%7 = call i32 (...) @getuid()
%8 = load %struct.stat*, %struct.stat** %2
%9 = getelementptr inbounds %struct.stat, %struct.stat* %8, i32 0, i32 3
store i32 %7, i32* %9
%10 = call i32 (...) @getgid()
%11 = load %struct.stat*, %struct.stat** %2
%12 = getelementptr inbounds %struct.stat, %struct.stat* %11, i32 0, i32 2
store i32 %10, i32* %12
%13 = load %struct.stat*, %struct.stat** %2
%14 = getelementptr inbounds %struct.stat, %struct.stat* %13, i32 0, i32 1
store i32 2, i32* %14
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32, i32, i32, i32 }
@S_IFDIR = global i32 0
define void @stat_make_dir(%struct.stat* nocapture writeonly %0) {
%2 = load i32, i32* @S_IFDIR
%3 = or i32 %2, 493
%4 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 0
store i32 %3, i32* %4
%5 = tail call i32 (...) @getuid()
%6 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 3
store i32 %5, i32* %6
%7 = tail call i32 (...) @getgid()
%8 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 2
store i32 %7, i32* %8
%9 = getelementptr inbounds %struct.stat, %struct.stat* %0, i64 0, i32 1
store i32 2, i32* %9
ret void
}