xunge/DecIR huggingface dataset:
/* Variables and functions */
unsigned int clz(unsigned int);
unsigned int log2i(unsigned int x) {
  if (x != 0)
    return sizeof(unsigned int) * 8 - 1 - clz(x);
  else
    return 0;
}


x86 assembly (clang, -O0):
<log2i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1141 <log2i+0x31>
mov    -0x8(%rbp),%edi
call   1030 <clz@plt>
mov    %eax,%eax
mov    %eax,%ecx
mov    $0x1f,%eax
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
jmp    1148 <log2i+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2i>:
test   %edi,%edi
je     1128 <log2i+0x18>
push   %rax
call   1030 <clz@plt>
mov    %eax,%ecx
mov    $0x1f,%eax
sub    %ecx,%eax
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @log2i(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %3
%8 = call i32 @clz(i32 %7)
%9 = zext i32 %8 to i64
%10 = sub i64 31, %9
%11 = trunc i64 %10 to i32
store i32 %11, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %6
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @log2i(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @clz(i32 %0)
%5 = sub i32 31, %4
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ 0, %1 ]
ret i32 %7
}
double calculate_discount(double purchases, double discount) {
  double discount_money = purchases * discount;
  return discount_money;
}


x86 assembly (clang, -O0):
<calculate_discount>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_discount>:
mulsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @calculate_discount(double %0, double %1) {
%3 = fmul double %0, %1
ret double %3
}
/* Type definitions */
struct ibv_port_attr {
  int dummy;
};
struct ibv_context {
  int dummy;
};

/* Variables and functions */
int ibv_query_port(struct ibv_context *, int, struct ibv_port_attr *);
int pp_get_port_info(struct ibv_context *context, int port,
                     struct ibv_port_attr *attr) {
  return ibv_query_port(context, port, attr);
}


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

x86 assembly (clang, -O2):
<pp_get_port_info>:
jmp    1030 <ibv_query_port@plt>

LLVM IR (-O0):
%struct.ibv_context = type { i32 }
%struct.ibv_port_attr = type { i32 }
define i32 @pp_get_port_info(%struct.ibv_context* %0, i32 %1, %struct.ibv_port_attr* %2) {
%4 = alloca %struct.ibv_context*
%5 = alloca i32
%6 = alloca %struct.ibv_port_attr*
store %struct.ibv_context* %0, %struct.ibv_context** %4
store i32 %1, i32* %5
store %struct.ibv_port_attr* %2, %struct.ibv_port_attr** %6
%7 = load %struct.ibv_context*, %struct.ibv_context** %4
%8 = load i32, i32* %5
%9 = load %struct.ibv_port_attr*, %struct.ibv_port_attr** %6
%10 = call i32 @ibv_query_port(%struct.ibv_context* %7, i32 %8, %struct.ibv_port_attr* %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.ibv_context = type { i32 }
%struct.ibv_port_attr = type { i32 }
define i32 @pp_get_port_info(%struct.ibv_context* %0, i32 %1, %struct.ibv_port_attr* %2) {
%4 = tail call i32 @ibv_query_port(%struct.ibv_context* %0, i32 %1, %struct.ibv_port_attr* %2)
ret i32 %4
}
short internal_sign_s(short value) {
  return (value >= 0 ? (value == 0 ? 0 : 1) : -1);
}


x86 assembly (clang, -O0):
<internal_sign_s>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
cmp    $0x0,%eax
jl     1131 <internal_sign_s+0x31>
movswl -0x2(%rbp),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
mov    %eax,-0x8(%rbp)
jmp    113e <internal_sign_s+0x3e>
mov    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    113e <internal_sign_s+0x3e>
mov    -0x8(%rbp),%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_sign_s>:
xor    %ecx,%ecx
test   %di,%di
setne  %cl
mov    $0xffff,%eax
cmovns %ecx,%eax
ret

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

LLVM IR (-O2):
define signext i16 @internal_sign_s(i16 signext %0) {
%2 = icmp sgt i16 %0, -1
%3 = icmp ne i16 %0, 0
%4 = zext i1 %3 to i16
%5 = select i1 %2, i16 %4, i16 -1
ret i16 %5
}
/* Variables and functions */
int mkdir(char *, int);
int sr_filemkdir(char *path) { return mkdir(path, 0750); }


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

x86 assembly (clang, -O2):
<sr_filemkdir>:
mov    $0x1e8,%esi
jmp    1030 <mkdir@plt>

LLVM IR (-O0):
define i32 @sr_filemkdir(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @mkdir(i8* %3, i32 488)
ret i32 %4
}

LLVM IR (-O2):
define i32 @sr_filemkdir(i8* nocapture %0) {
%2 = tail call i32 @mkdir(i8* %0, i32 488)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int san_piece(int piece) {
  switch (piece) {
  case 10:
    return 5;
  case 8:
    return 4;
  case 6:
    return 3;
  case 2:
    return 1;
  case 4:
    return 2;
  case 0:
    return 0;
  }
  assert(0);
}


x86 assembly (clang, -O0):
<san_piece>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0xa,%rax
ja     1188 <san_piece+0x78>
mov    -0x10(%rbp),%rax
lea    0xec9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x5,-0x4(%rbp)
jmp    118f <san_piece+0x7f>
movl   $0x4,-0x4(%rbp)
jmp    118f <san_piece+0x7f>
movl   $0x3,-0x4(%rbp)
jmp    118f <san_piece+0x7f>
movl   $0x1,-0x4(%rbp)
jmp    118f <san_piece+0x7f>
movl   $0x2,-0x4(%rbp)
jmp    118f <san_piece+0x7f>
movl   $0x0,-0x4(%rbp)
jmp    118f <san_piece+0x7f>
xor    %edi,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<san_piece>:
push   %rax
cmp    $0xb,%edi
jae    1120 <san_piece+0x10>
mov    $0x555,%eax
bt     %edi,%eax
jb     1129 <san_piece+0x19>
xor    %edi,%edi
call   1030 <assert@plt>
pop    %rcx
ret
movslq %edi,%rax
lea    0xecd(%rip),%rcx
mov    (%rcx,%rax,4),%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @san_piece(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %11 [
i32 10, label %5
i32 8, label %6
i32 6, label %7
i32 2, label %8
i32 4, label %9
i32 0, label %10
]
5: ; preds = %1
store i32 5, i32* %2
br label %13
6: ; preds = %1
store i32 4, i32* %2
br label %13
7: ; preds = %1
store i32 3, i32* %2
br label %13
8: ; preds = %1
store i32 1, i32* %2
br label %13
9: ; preds = %1
store i32 2, i32* %2
br label %13
10: ; preds = %1
store i32 0, i32* %2
br label %13
11: ; preds = %1
%12 = call i32 @assert(i32 0)
br label %13
13: ; preds = %11, %10, %9, %8, %7, %6, %5
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@switch.table.san_piece = [11 x i32] [i32 0, i32 5, i32 1, i32 5, i32 2, i32 5, i32 3, i32 5, i32 4, i32 5, i32 5]
define i32 @san_piece(i32 %0) {
%2 = icmp ult i32 %0, 11
br i1 %2, label %5, label %3
3: ; preds = %5, %1
%4 = tail call i32 @assert(i32 0)
br label %14
5: ; preds = %1
%6 = trunc i32 %0 to i16
%7 = lshr i16 1365, %6
%8 = and i16 %7, 1
%9 = icmp eq i16 %8, 0
br i1 %9, label %3, label %10
10: ; preds = %5
%11 = sext i32 %0 to i64
%12 = getelementptr inbounds [11 x i32], [11 x i32]* @switch.table.san_piece, i64 0, i64 %11
%13 = load i32, i32* %12
br label %14
14: ; preds = %10, %3
%15 = phi i32 [ undef, %3 ], [ %13, %10 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main(int argc, char const *argv[]) {
  int integer = 5;
  float floating_more = 5.55;
  float floating_less = 5.05;
  printf("Before cast: \n%d\n%f\n%f\n", integer, floating_less, floating_more);
  printf("\nAfter cast: \n%d\n%d\n%d\n", integer, (int)floating_less,
         (int)floating_more);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
movss  0xecf(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xebe(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
cvttss2si -0x1c(%rbp),%edx
cvttss2si -0x18(%rbp),%ecx
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
cvttss2si -0x1c(%rbp),%edx
cvttss2si -0x18(%rbp),%ecx
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x5,%esi
mov    $0x5,%edx
mov    $0x5,%ecx
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
mov    $0x5,%esi
mov    $0x5,%edx
mov    $0x5,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Before cast: \0A%d\0A%f\0A%f\0A\00"
@.str.1 = [24 x i8] c"\0AAfter cast: \0A%d\0A%d\0A%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca float
%8 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 5, i32* %6
store float 0x4016333340000000, float* %7
store float 0x4014333340000000, float* %8
%9 = load i32, i32* %6
%10 = load float, float* %8
%11 = fptosi float %10 to i32
%12 = load float, float* %7
%13 = fptosi float %12 to i32
%14 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %9, i32 %11, i32 %13)
%15 = load i32, i32* %6
%16 = load float, float* %8
%17 = fptosi float %16 to i32
%18 = load float, float* %7
%19 = fptosi float %18 to i32
%20 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %17, i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Before cast: \0A%d\0A%f\0A%f\0A\00"
@.str.1 = [24 x i8] c"\0AAfter cast: \0A%d\0A%d\0A%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 5, i32 5, i32 5)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 5, i32 5, i32 5)
ret i32 0
}
/* Variables and functions */
int get_file(int, char *, char *);
int is_kernel_thread(int pid) {
  int num_read;
  char buf[512];
  num_read = get_file(pid, "cmdline", buf);
  if (num_read == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_kernel_thread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x210,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x210(%rbp),%rdx
lea    0xed1(%rip),%rsi
call   1030 <get_file@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    114d <is_kernel_thread+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1154 <is_kernel_thread+0x44>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x210,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_kernel_thread>:
sub    $0x208,%rsp
lea    0xee2(%rip),%rsi
mov    %rsp,%rdx
call   1030 <get_file@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
add    $0x208,%rsp
ret

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

LLVM IR (-O2):
@.str = [8 x i8] c"cmdline\00"
define i32 @is_kernel_thread(i32 %0) {
%2 = alloca [512 x i8]
%3 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%4 = call i32 @get_file(i32 %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, size_t);
void *scalloc(size_t nelem, size_t elsize) {
  void *ptr = NULL;
  if ((ptr = calloc(nelem, elsize)) == NULL) {
    printf("Allocation of %i bytes failed\n", nelem * elsize);
    exit(255);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<scalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1182 <scalloc+0x52>
mov    -0x8(%rbp),%rsi
imul   -0x10(%rbp),%rsi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
mov    $0xff,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <calloc@plt>
test   %rax,%rax
je     114c <scalloc+0x1c>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
imul   %rbx,%r14
lea    0xea9(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    $0xff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Allocation of %i bytes failed\0A\00"
define i8* @scalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
store i8* null, i8** %5
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i64, i64* %3
%12 = load i64, i64* %4
%13 = mul i64 %11, %12
%14 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i64 %13)
%15 = call i32 @exit(i32 255)
unreachable
16: ; preds = %2
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
@.str = [31 x i8] c"Allocation of %i bytes failed\0A\00"
define noalias i8* @scalloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = mul i64 %1, %0
%7 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i64 %6)
%8 = tail call i32 @exit(i32 255)
unreachable
9: ; preds = %2
ret i8* %3
}
/* Variables and functions */
float _d2f(int /*<<< orphan*/);
int /*<<< orphan*/ _ddiv(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _f2d(int);
float _fdiv(int a, int b) { return _d2f(_ddiv(_f2d(a), _f2d(b))); }


x86 assembly (clang, -O0):
<_fdiv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <_f2d@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <_f2d@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
call   1050 <_ddiv@plt>
mov    %eax,%edi
call   1030 <_d2f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_fdiv>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
call   1040 <_f2d@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1040 <_f2d@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <_ddiv@plt>
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <_d2f@plt>

LLVM IR (-O0):
define float @_fdiv(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i32 @_f2d(i32 %5)
%7 = load i32, i32* %4
%8 = call i32 @_f2d(i32 %7)
%9 = call i32 @_ddiv(i32 %6, i32 %8)
%10 = call float @_d2f(i32 %9)
ret float %10
}

LLVM IR (-O2):
define float @_fdiv(i32 %0, i32 %1) {
%3 = tail call i32 @_f2d(i32 %0)
%4 = tail call i32 @_f2d(i32 %1)
%5 = tail call i32 @_ddiv(i32 %3, i32 %4)
%6 = tail call float @_d2f(i32 %5)
ret float %6
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t next_power_of_2(uint32_t num) {
  if (num > 0) {
    num--;
  }
  num |= num >> 1;
  num |= num >> 2;
  num |= num >> 4;
  num |= num >> 8;
  num |= num >> 16;
  num++;
  return num;
}


x86 assembly (clang, -O0):
<next_power_of_2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    111a <next_power_of_2+0x1a>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_power_of_2>:
xor    %eax,%eax
test   %edi,%edi
setg   %al
sub    %eax,%edi
mov    %edi,%eax
sar    %eax
or     %edi,%eax
mov    %eax,%ecx
sar    $0x2,%ecx
or     %eax,%ecx
mov    %ecx,%eax
sar    $0x4,%eax
or     %ecx,%eax
mov    %eax,%ecx
sar    $0x8,%ecx
or     %eax,%ecx
mov    %ecx,%eax
sar    $0x10,%eax
or     %ecx,%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @next_power_of_2(i32 %0) {
%2 = icmp sgt i32 %0, 0
%3 = sext i1 %2 to i32
%4 = add nsw i32 %3, %0
%5 = ashr i32 %4, 1
%6 = or i32 %5, %4
%7 = ashr i32 %6, 2
%8 = or i32 %7, %6
%9 = ashr i32 %8, 4
%10 = or i32 %9, %8
%11 = ashr i32 %10, 8
%12 = or i32 %11, %10
%13 = ashr i32 %12, 16
%14 = or i32 %13, %12
%15 = add nsw i32 %14, 1
ret i32 %15
}
__attribute__((always_)) void native_wbinvd(void) {
  asm volatile("wbinvd" : : : "memory");
}


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

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

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

LLVM IR (-O2):
define void @native_wbinvd() {
tail call void asm sideeffect "wbinvd", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
void sti() { asm volatile("sti" ::: "cc"); }


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

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

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

LLVM IR (-O2):
define void @sti() {
tail call void asm sideeffect "sti", "~{cc},~{dirflag},~{fpsr},~{flags}"()
ret void
}
void RTNetUDPChecksum(void) {}


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

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

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

LLVM IR (-O2):
define void @RTNetUDPChecksum() {
ret void
}
void uDMAIntClear(unsigned long ulChanMask) {
  (*((volatile unsigned long *)(0x400FF000 + 0x00000504))) = ulChanMask;
}


x86 assembly (clang, -O0):
<uDMAIntClear>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x400ff504,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uDMAIntClear>:
mov    %rdi,0x400ff504
40
ret

LLVM IR (-O0):
define void @uDMAIntClear(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
store volatile i64 %3, i64* inttoptr (i64 1074787588 to i64*)
ret void
}

LLVM IR (-O2):
define void @uDMAIntClear(i64 %0) {
store volatile i64 %0, i64* inttoptr (i64 1074787588 to i64*)
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  unsigned long serial;
};
struct TYPE_4__ {
  TYPE_1__ xkey;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xkey_serial(void *_p, unsigned long _v) {
  ((XEvent *)_p)->xkey.serial = (unsigned long)_v;
}


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

x86 assembly (clang, -O2):
<set_XEvent_xkey_serial>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define void @set_XEvent_xkey_serial(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i64 %5, i64* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xkey_serial(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *dbg_init_0();
int /*<<< orphan*/ setlinebuf(int /*<<< orphan*/ *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ *stdout;
FILE *dbg_init() {
  FILE *f = dbg_init_0();
  if (f == stderr) {
    setlinebuf(stdout);
  } else {
    setlinebuf(f);
  }
  return f;
}


x86 assembly (clang, -O0):
<dbg_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <dbg_init_0@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2ea2(%rip),%rcx
cmp    (%rcx),%rax
jne    115b <dbg_init+0x3b>
mov    0x2e8a(%rip),%rax
mov    (%rax),%rdi
call   1030 <setlinebuf@plt>
jmp    1164 <dbg_init+0x44>
mov    -0x8(%rbp),%rdi
call   1030 <setlinebuf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbg_init>:
push   %rbx
xor    %eax,%eax
call   1040 <dbg_init_0@plt>
mov    %rax,%rbx
mov    0x2eae(%rip),%rax
mov    %rbx,%rdi
cmp    (%rax),%rbx
jne    1144 <dbg_init+0x24>
mov    0x2e97(%rip),%rax
mov    (%rax),%rdi
call   1030 <setlinebuf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@stderr = global i32* null
@stdout = global i32* null
define i32* @dbg_init() {
%1 = alloca i32*
%2 = call i32* (...) @dbg_init_0()
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = load i32*, i32** @stderr
%5 = icmp eq i32* %3, %4
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = load i32*, i32** @stdout
%8 = call i32 @setlinebuf(i32* %7)
br label %12
9: ; preds = %0
%10 = load i32*, i32** %1
%11 = call i32 @setlinebuf(i32* %10)
br label %12
12: ; preds = %9, %6
%13 = load i32*, i32** %1
ret i32* %13
}

LLVM IR (-O2):
@stderr = global i32* null
@stdout = global i32* null
define i32* @dbg_init() {
%1 = tail call i32* (...) @dbg_init_0()
%2 = load i32*, i32** @stderr
%3 = icmp eq i32* %1, %2
%4 = load i32*, i32** @stdout
%5 = select i1 %3, i32* %4, i32* %1
%6 = tail call i32 @setlinebuf(i32* %5)
ret i32* %1
}
int fakemain(int argc, char *argv[]) {
  int lgN, t, N;
  for (lgN = 0; N > 0; lgN++, N /= 2) {
  }
  for (lgN = 0, t = 1; t < N; lgN++, t += t) {
  }
  return 0;
}


x86 assembly (clang, -O0):
<fakemain>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    113d <fakemain+0x3d>
jmp    1121 <fakemain+0x21>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
jmp    1112 <fakemain+0x12>
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1173 <fakemain+0x73>
jmp    115c <fakemain+0x5c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    114b <fakemain+0x4b>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fakemain(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 0, i32* %5
br label %8
8: ; preds = %12, %2
%9 = load i32, i32* %7
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %8
br label %12
12: ; preds = %11
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 1
store i32 %14, i32* %5
%15 = load i32, i32* %7
%16 = sdiv i32 %15, 2
store i32 %16, i32* %7
br label %8
17: ; preds = %8
store i32 0, i32* %5
store i32 1, i32* %6
br label %18
18: ; preds = %23, %17
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %29
22: ; preds = %18
br label %23
23: ; preds = %22
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
%26 = load i32, i32* %6
%27 = load i32, i32* %6
%28 = add nsw i32 %27, %26
store i32 %28, i32* %6
br label %18
29: ; preds = %18
ret i32 0
}

LLVM IR (-O2):
define i32 @fakemain(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
void *fail_malloc() { return NULL; }


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

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

LLVM IR (-O0):
define i8* @fail_malloc() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @fail_malloc() {
ret i8* null
}
void ff_hevc_put_hevc_uni_w_pel_pixels12_12_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_w_pel_pixels12_12_sse4() {
ret void
}
int main(int argc, char *argv[]) {
  int a = 0;
  int i = 0;
  int c = 0;
  while (i < 10) {
    i++;
    a++;
  }
  c = i;
  if (c == 5) {
    c = 23;
    a++;
    a--;
  }
  if (a < 10) {
  ERROR:
    goto ERROR;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    1148 <main+0x48>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1127 <main+0x27>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jne    1171 <main+0x71>
movl   $0x17,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1185 <main+0x85>
jmp    1180 <main+0x80>
jmp    1180 <main+0x80>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _exit_thread(int);
int stub1(void *);
extern void __bionic_clone_entry(int (*fn)(void *), void *arg) {
  int ret = (*fn)(arg);
  _exit_thread(ret);
}


x86 assembly (clang, -O0):
<__bionic_clone_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
call   *%rax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <_exit_thread@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__bionic_clone_entry>:
push   %rax
mov    %rdi,%rax
mov    %rsi,%rdi
call   *%rax
mov    %eax,%edi
pop    %rax
jmp    1030 <_exit_thread@plt>

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

LLVM IR (-O2):
define void @__bionic_clone_entry(i32 (i8*)* nocapture %0, i8* %1) {
%3 = tail call i32 %0(i8* %1)
%4 = tail call i32 @_exit_thread(i32 %3)
ret void
}
/* Variables and functions */
int _hiddev_open(char const *, int *, int /*<<< orphan*/, int /*<<< orphan*/);
int hiddev_open(const char *device_path, int *usage_code) {
  return _hiddev_open(device_path, usage_code, 0, 0);
}


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

x86 assembly (clang, -O2):
<hiddev_open>:
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <_hiddev_open@plt>

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

LLVM IR (-O2):
define i32 @hiddev_open(i8* %0, i32* %1) {
%3 = tail call i32 @_hiddev_open(i8* %0, i32* %1, i32 0, i32 0)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
const char *
hfp_subevent_response_and_hold_status_get_value(const uint8_t *event) {
  return (const char *)&event[3];
}


x86 assembly (clang, -O0):
<hfp_subevent_response_and_hold_status_get_value>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xc,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hfp_subevent_response_and_hold_status_get_value>:
lea    0xc(%rdi),%rax
ret

LLVM IR (-O0):
define i8* @hfp_subevent_response_and_hold_status_get_value(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 3
%5 = bitcast i32* %4 to i8*
ret i8* %5
}

LLVM IR (-O2):
define i8* @hfp_subevent_response_and_hold_status_get_value(i32* readnone %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 3
%3 = bitcast i32* %2 to i8*
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ putc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ vfprintf(int /*<<< orphan*/, char const *,
                            int /*<<< orphan*/);
void gt_warning_default_handler(__attribute__((unused)) void *data,
                                const char *format, va_list ap) {
  (void)fputs("warning: ", stderr);
  (void)vfprintf(stderr, format, ap);
  (void)putc('\n', stderr);
}


x86 assembly (clang, -O0):
<gt_warning_default_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    0x2e96(%rip),%rax
mov    (%rax),%esi
lea    0xead(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <vfprintf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1040 <putc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gt_warning_default_handler>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%rbx
mov    0x2ea0(%rip),%r14
mov    (%r14),%esi
lea    0xeb6(%rip),%rdi
call   1030 <fputs@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1050 <vfprintf@plt>
mov    (%r14),%esi
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <putc@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"warning: \00"
@stderr = global i32 0
define void @gt_warning_default_handler(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 i32, i32* @stderr
%8 = call i32 @fputs(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call i32 @vfprintf(i32 %9, i8* %10, i32 %11)
%13 = load i32, i32* @stderr
%14 = call i32 @putc(i8 signext 10, i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"warning: \00"
@stderr = global i32 0
define void @gt_warning_default_handler(i8* nocapture readnone %0, i8* %1, i32 %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 @fputs(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* @stderr
%7 = tail call i32 @vfprintf(i32 %6, i8* %1, i32 %2)
%8 = load i32, i32* @stderr
%9 = tail call i32 @putc(i8 signext 10, i32 %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ acosl(long double);
long double cosl(int /*<<< orphan*/);
long double cosacosl(long double x) { return (cosl(acosl(x))); }


x86 assembly (clang, -O0):
<cosacosl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <acosl@plt>
mov    %eax,%edi
call   1030 <cosl@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cosacosl>:
sub    $0x18,%rsp
fldt   0x20(%rsp)
fstpt  (%rsp)
call   1040 <acosl@plt>
mov    %eax,%edi
add    $0x18,%rsp
jmp    1030 <cosl@plt>

LLVM IR (-O0):
define x86_fp80 @cosacosl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call i32 @acosl(x86_fp80 %3)
%5 = call x86_fp80 @cosl(i32 %4)
ret x86_fp80 %5
}

LLVM IR (-O2):
define x86_fp80 @cosacosl(x86_fp80 %0) {
%2 = tail call i32 @acosl(x86_fp80 %0)
%3 = tail call x86_fp80 @cosl(i32 %2)
ret x86_fp80 %3
}
/* Type definitions */
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double get_time(struct timeval *tim) {
  gettimeofday(tim, NULL);
  return tim->tv_sec + (tim->tv_usec / 1000000.0);
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
movsd  0xebe(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  0x8(%rbx),%xmm0
divsd  0xed8(%rip),%xmm0
addsd  (%rbx),%xmm0
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
define double @get_time(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %2
%3 = load %struct.timeval*, %struct.timeval** %2
%4 = call i32 @gettimeofday(%struct.timeval* %3, i32* null)
%5 = load %struct.timeval*, %struct.timeval** %2
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%7 = load double, double* %6
%8 = load %struct.timeval*, %struct.timeval** %2
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 1
%10 = load double, double* %9
%11 = fdiv double %10, 1.000000e+06
%12 = fadd double %7, %11
ret double %12
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
define double @get_time(%struct.timeval* nocapture %0) {
%2 = tail call i32 @gettimeofday(%struct.timeval* %0, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%6 = load double, double* %5
%7 = fdiv double %6, 1.000000e+06
%8 = fadd double %4, %7
ret double %8
}
/* Type definitions */
typedef int /*<<< orphan*/ buff;

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
scalar_t__ read(int, char *, int);
int read_adc(int fd) {
  char buff[8];
  int val = -100000;
  memset(buff, 0, sizeof(buff));
  if (read(fd, buff, 8) < 0)
    perror("read()");
  else
    val = atoi(buff);
  return val;
}


x86 assembly (clang, -O0):
<read_adc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xfffe7960,-0x10(%rbp)
lea    -0xc(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
mov    -0x4(%rbp),%edi
lea    -0xc(%rbp),%rsi
mov    $0x8,%edx
call   1040 <read@plt>
cmp    $0x0,%rax
jge    118e <read_adc+0x4e>
lea    0xe7c(%rip),%rdi
call   1050 <perror@plt>
jmp    119a <read_adc+0x5a>
lea    -0xc(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_adc>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %rsp,%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x8,%edx
call   1040 <read@plt>
test   %rax,%rax
js     117c <read_adc+0x3c>
mov    %rsp,%rdi
call   1060 <atoi@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe7d(%rip),%rdi
call   1050 <perror@plt>
mov    $0xfffe7960,%eax
jmp    1174 <read_adc+0x34>

LLVM IR (-O0):
@.str = [7 x i8] c"read()\00"
define i32 @read_adc(i32 %0) {
%2 = alloca i32
%3 = alloca [8 x i8]
%4 = alloca i32
store i32 %0, i32* %2
store i32 -100000, i32* %4
%5 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 8)
%7 = load i32, i32* %2
%8 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%9 = call i64 @read(i32 %7, i8* %8, i32 8)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %16
13: ; preds = %1
%14 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %4
br label %16
16: ; preds = %13, %11
%17 = load i32, i32* %4
ret i32 %17
}

LLVM IR (-O2):
@.str = [7 x i8] c"read()\00"
define i32 @read_adc(i32 %0) {
%2 = alloca [8 x i8]
%3 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 0, i32 8)
%5 = call i64 @read(i32 %0, i8* %3, i32 8)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %11
9: ; preds = %1
%10 = call i32 @atoi(i8* %3)
br label %11
11: ; preds = %9, %7
%12 = phi i32 [ -100000, %7 ], [ %10, %9 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("skip: Skipping userfaultfd test (missing __NR_userfaultfd)\n");
  return 4;
}


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

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

LLVM IR (-O0):
@.str = [60 x i8] c"skip: Skipping userfaultfd test (missing __NR_userfaultfd)\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
ret i32 4
}

LLVM IR (-O2):
@str = [59 x i8] c"skip: Skipping userfaultfd test (missing __NR_userfaultfd)\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ term(int /*<<< orphan*/);
void cant(const char *f) {
  perror(f);
  term(0);
}


x86 assembly (clang, -O0):
<cant>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
xor    %edi,%edi
call   1030 <term@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cant>:
push   %rax
call   1040 <perror@plt>
xor    %edi,%edi
pop    %rax
jmp    1030 <term@plt>

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

LLVM IR (-O2):
define void @cant(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @term(i32 0)
ret void
}
int do_959() { return 959; }


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

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

LLVM IR (-O0):
define i32 @do_959() {
ret i32 959
}

LLVM IR (-O2):
define i32 @do_959() {
ret i32 959
}
int test_imm_E4uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0xE4 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_E4uint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 228
%7 = icmp ne i64 %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_E4uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 14942208
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, char);
int main() {
  char *out = malloc(1);
  *out = 'a';
  free(out);
  *out = 'b';
  printf("past bad! %c\n", *out);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x61,(%rax)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movb   $0x62,(%rax)
mov    -0x8(%rbp),%rax
lea    0xe98(%rip),%rdi
movsbl (%rax),%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1050 <malloc@plt>
movb   $0x61,(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
lea    0xeb3(%rip),%rdi
mov    $0x62,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"past bad! %c\0A\00"
define i32 @main() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 1)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
store i8 97, i8* %3
%4 = load i8*, i8** %1
%5 = call i32 @free(i8* %4)
%6 = load i8*, i8** %1
store i8 98, i8* %6
%7 = load i8*, i8** %1
%8 = load i8, i8* %7
%9 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8 signext %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"past bad! %c\0A\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
store i8 97, i8* %1
%2 = tail call i32 @free(i8* %1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8 signext 98)
ret i32 0
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
char *substring(char *s, int start, int length) {
  char *sub = malloc(length + 1);
  memcpy(sub, &s[start], length);
  sub[length] = '\0';
  return sub;
}


x86 assembly (clang, -O0):
<substring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%edi
add    $0x1,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
mov    -0x10(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<substring>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %esi,%r15d
mov    %rdi,%r14
lea    0x1(%rbx),%edi
call   1040 <malloc@plt>
mov    %rax,%rbp
movslq %r15d,%rsi
add    %r14,%rsi
mov    %rax,%rdi
mov    %ebx,%edx
call   1030 <memcpy@plt>
movslq %ebx,%rax
movb   $0x0,0x0(%rbp,%rax,1)
mov    %rbp,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i8* @substring(i8* %0, i32 %1, i32 %2) {
%4 = add nsw i32 %2, 1
%5 = tail call i8* @malloc(i32 %4)
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = tail call i32 @memcpy(i8* %5, i8* %7, i32 %2)
%9 = sext i32 %2 to i64
%10 = getelementptr inbounds i8, i8* %5, i64 %9
store i8 0, i8* %10
ret i8* %5
}