xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_SET_RADIO_FIFOP_PIN() { set_io_bit(-1, 3); }


x86 assembly (clang, -O0):
<TOSH_SET_RADIO_FIFOP_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0xffffffff,%edi
mov    $0x3,%esi
call   1030 <set_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_SET_RADIO_FIFOP_PIN>:
mov    $0xffffffff,%edi
mov    $0x3,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_SET_RADIO_FIFOP_PIN() {
%1 = call i32 @set_io_bit(i32 -1, i32 3)
ret void
}

LLVM IR (-O2):
define void @TOSH_SET_RADIO_FIFOP_PIN() {
%1 = tail call i32 @set_io_bit(i32 -1, i32 3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sendCmd(int, char *, unsigned int, unsigned int,
                           unsigned int, unsigned int);
void sketchRect(int fd, unsigned int x, unsigned int y, unsigned int w,
                unsigned int h) {
  sendCmd(fd, "framerect %u %u %u %u\n", x, y, w, h);
}


x86 assembly (clang, -O0):
<sketchRect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
lea    0xec0(%rip),%rsi
call   1030 <sendCmd@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sketchRect>:
mov    %r8d,%r9d
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
lea    0xedf(%rip),%rsi
jmp    1030 <sendCmd@plt>

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

LLVM IR (-O2):
@.str = [23 x i8] c"framerect %u %u %u %u\0A\00"
define void @sketchRect(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @sendCmd(i32 %0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2, i32 %3, i32 %4)
ret void
}
/* Variables and functions */
int write_ec(int, int);
int turn_off_fans() {
  int ret = write_ec(147, 20);
  ret &= write_ec(150, 20);
  ret &= write_ec(148, 255);
  ret &= write_ec(151, 255);
  return ret;
}


x86 assembly (clang, -O0):
<turn_off_fans>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x93,%edi
mov    $0x14,%esi
call   1030 <write_ec@plt>
mov    %eax,-0x4(%rbp)
mov    $0x96,%edi
mov    $0x14,%esi
call   1030 <write_ec@plt>
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x94,%edi
mov    $0xff,%esi
call   1030 <write_ec@plt>
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x97,%edi
mov    $0xff,%esi
call   1030 <write_ec@plt>
and    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<turn_off_fans>:
push   %rbp
push   %rbx
push   %rax
mov    $0x93,%edi
mov    $0x14,%esi
call   1030 <write_ec@plt>
mov    %eax,%ebx
mov    $0x96,%edi
mov    $0x14,%esi
call   1030 <write_ec@plt>
mov    %eax,%ebp
and    %ebx,%ebp
mov    $0x94,%edi
mov    $0xff,%esi
call   1030 <write_ec@plt>
mov    %eax,%ebx
mov    $0x97,%edi
mov    $0xff,%esi
call   1030 <write_ec@plt>
and    %ebx,%eax
and    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @turn_off_fans() {
%1 = alloca i32
%2 = call i32 @write_ec(i32 147, i32 20)
store i32 %2, i32* %1
%3 = call i32 @write_ec(i32 150, i32 20)
%4 = load i32, i32* %1
%5 = and i32 %4, %3
store i32 %5, i32* %1
%6 = call i32 @write_ec(i32 148, i32 255)
%7 = load i32, i32* %1
%8 = and i32 %7, %6
store i32 %8, i32* %1
%9 = call i32 @write_ec(i32 151, i32 255)
%10 = load i32, i32* %1
%11 = and i32 %10, %9
store i32 %11, i32* %1
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
define i32 @turn_off_fans() {
%1 = tail call i32 @write_ec(i32 147, i32 20)
%2 = tail call i32 @write_ec(i32 150, i32 20)
%3 = and i32 %2, %1
%4 = tail call i32 @write_ec(i32 148, i32 255)
%5 = and i32 %3, %4
%6 = tail call i32 @write_ec(i32 151, i32 255)
%7 = and i32 %5, %6
ret i32 %7
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double gettime() {
  struct timeval tp;
  gettimeofday(&tp, NULL);
  return (double)tp.tv_sec + (double)tp.tv_usec * 1e-6;
}


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

x86 assembly (clang, -O2):
<gettime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
mulsd  0xeca(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @gettime() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%4 = load i64, i64* %3
%5 = sitofp i64 %4 to double
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = call double @llvm.fmuladd.f64(double %8, double 0x3EB0C6F7A0B5ED8D, double %5)
ret double %9
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @gettime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = tail call double @llvm.fmuladd.f64(double %9, double 0x3EB0C6F7A0B5ED8D, double %6)
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void ft_memdel(void **ap) {
  free(*ap);
  *ap = NULL;
}


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

x86 assembly (clang, -O2):
<ft_memdel>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ft_memdel(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i32 @free(i8* %2)
store i8* null, i8** %0
ret void
}
int clip(int w, int u, int o) { return w < u ? u : w > o ? o : w; }


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

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

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

LLVM IR (-O2):
define i32 @clip(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = icmp sgt i32 %0, %2
%6 = select i1 %5, i32 %2, i32 %0
%7 = select i1 %4, i32 %1, i32 %6
ret i32 %7
}
/* Variables and functions */
void *malloc(int);
int /*<<< orphan*/ printf(char *);
void *fossil_malloc(size_t n) {
  void *p = malloc(n == 0 ? 1 : n);
  if (p == 0)
    printf("out of memory");
  return p;
}


x86 assembly (clang, -O0):
<fossil_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1145 <fossil_malloc+0x25>
mov    $0x1,%eax
mov    %rax,-0x18(%rbp)
jmp    114d <fossil_malloc+0x2d>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1173 <fossil_malloc+0x53>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fossil_malloc>:
push   %rbx
test   %rdi,%rdi
mov    $0x1,%eax
cmove  %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1145 <fossil_malloc+0x25>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"out of memory\00"
define i8* @fossil_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
br label %9
7: ; preds = %1
%8 = load i64, i64* %2
br label %9
9: ; preds = %7, %6
%10 = phi i64 [ 1, %6 ], [ %8, %7 ]
%11 = trunc i64 %10 to i32
%12 = call i8* @malloc(i32 %11)
store i8* %12, i8** %3
%13 = load i8*, i8** %3
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %9
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
@.str = [14 x i8] c"out of memory\00"
define noalias i8* @fossil_malloc(i64 %0) {
%2 = icmp eq i64 %0, 0
%3 = trunc i64 %0 to i32
%4 = select i1 %2, i32 1, i32 %3
%5 = tail call i8* @malloc(i32 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
ret i8* %5
}
void ff_hevc_put_hevc_bi_w_pel_pixels48_10_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_w_pel_pixels48_10_sse4() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int opendsp(char const *, int, int, int /*<<< orphan*/, size_t);
int opendsp_read(int channels, int samplerate, const char *path,
                 size_t fragsize) {
  return opendsp(path, channels, samplerate, O_RDONLY, fragsize);
}


x86 assembly (clang, -O0):
<opendsp_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    0x2eb1(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%r8
call   1030 <opendsp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opendsp_read>:
mov    %rcx,%r8
mov    %rdx,%rax
mov    %esi,%edx
mov    %edi,%esi
mov    0x2ec7(%rip),%rcx
mov    (%rcx),%ecx
mov    %rax,%rdi
jmp    1030 <opendsp@plt>

LLVM IR (-O0):
@O_RDONLY = global i32 0
define i32 @opendsp_read(i32 %0, i32 %1, i8* %2, i64 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i64 %3, i64* %8
%9 = load i8*, i8** %7
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = load i32, i32* @O_RDONLY
%13 = load i64, i64* %8
%14 = call i32 @opendsp(i8* %9, i32 %10, i32 %11, i32 %12, i64 %13)
ret i32 %14
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
define i32 @opendsp_read(i32 %0, i32 %1, i8* %2, i64 %3) {
%5 = load i32, i32* @O_RDONLY
%6 = tail call i32 @opendsp(i8* %2, i32 %0, i32 %1, i32 %5, i64 %3)
ret i32 %6
}
int d_gt_rc1(double a1) { return (((a1) > (100))); }


x86 assembly (clang, -O0):
<d_gt_rc1>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_gt_rc1>:
xor    %eax,%eax
ucomisd 0xef6(%rip),%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @d_gt_rc1(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ogt double %3, 1.000000e+02
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @d_gt_rc1(double %0) {
%2 = fcmp ogt double %0, 1.000000e+02
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Type definitions */
struct nsxml_program_info {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct nsxml_program_info *);
int /*<<< orphan*/ nsxml_program_info_cleanup(struct nsxml_program_info *);
void nsxml_program_info_free(struct nsxml_program_info *info) {
  nsxml_program_info_cleanup(info);
  free(info);
}


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

x86 assembly (clang, -O2):
<nsxml_program_info_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <nsxml_program_info_cleanup@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.nsxml_program_info = type { i32 }
define void @nsxml_program_info_free(%struct.nsxml_program_info* %0) {
%2 = alloca %struct.nsxml_program_info*
store %struct.nsxml_program_info* %0, %struct.nsxml_program_info** %2
%3 = load %struct.nsxml_program_info*, %struct.nsxml_program_info** %2
%4 = call i32 @nsxml_program_info_cleanup(%struct.nsxml_program_info* %3)
%5 = load %struct.nsxml_program_info*, %struct.nsxml_program_info** %2
%6 = call i32 @free(%struct.nsxml_program_info* %5)
ret void
}

LLVM IR (-O2):
%struct.nsxml_program_info = type { i32 }
define void @nsxml_program_info_free(%struct.nsxml_program_info* %0) {
%2 = tail call i32 @nsxml_program_info_cleanup(%struct.nsxml_program_info* %0)
%3 = tail call i32 @free(%struct.nsxml_program_info* %0)
ret void
}
int cmp(const void *p1, const void *p2) {
  long long int a = (long long int)*(long long int *const)p1;
  long long int b = (long long int)*(long long int *const)p2;
  if (a > b) {
    return -1;
  } else if (a < b) {
    return 1;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jle    113c <cmp+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    115d <cmp+0x5d>
mov    -0x20(%rbp),%rax
cmp    -0x28(%rbp),%rax
jge    1156 <cmp+0x56>
movl   $0x1,-0x4(%rbp)
jmp    115d <cmp+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
mov    (%rdi),%rax
xor    %ecx,%ecx
cmp    (%rsi),%rax
setl   %cl
mov    $0xffffffff,%eax
cmovle %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = icmp sgt i64 %4, %6
%8 = icmp slt i64 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
void main(void) {
  static const int foo = 2;
  switch (foo) {
  case 1:
    break;
  case 2:
    break;
  default:
    break;
  }
}


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

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

LLVM IR (-O0):
@main.foo = internal constant i32 2
define void @main() {
ret void
}

LLVM IR (-O2):
define void @main() {
ret void
}
void setArrayD(double *arr, int idx, double v) { arr[idx] = v; }


x86 assembly (clang, -O0):
<setArrayD>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setArrayD>:
movslq %esi,%rax
movsd  %xmm0,(%rdi,%rax,8)
ret

LLVM IR (-O0):
define void @setArrayD(double* %0, i32 %1, double %2) {
%4 = alloca double*
%5 = alloca i32
%6 = alloca double
store double* %0, double** %4
store i32 %1, i32* %5
store double %2, double* %6
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds double, double* %8, i64 %10
store double %7, double* %11
ret void
}

LLVM IR (-O2):
define void @setArrayD(double* nocapture writeonly %0, i32 %1, double %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds double, double* %0, i64 %4
store double %2, double* %5
ret void
}
/* Variables and functions */
unsigned char *chacha20poly1305_decrypt(unsigned char *, size_t *,
                                        unsigned char const *, size_t,
                                        unsigned char const *,
                                        unsigned char const *);
unsigned char *crypt_decrypt_chacha20poly1305(
    unsigned char *out, size_t *out_len, const unsigned char *in, size_t in_len,
    const unsigned char *nonce, const unsigned char *key) {
  return chacha20poly1305_decrypt(out, out_len, in, in_len, nonce, key);
}


x86 assembly (clang, -O0):
<crypt_decrypt_chacha20poly1305>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
call   1030 <chacha20poly1305_decrypt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypt_decrypt_chacha20poly1305>:
jmp    1030 <chacha20poly1305_decrypt@plt>

LLVM IR (-O0):
define i8* @crypt_decrypt_chacha20poly1305(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i64*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i8*
store i8* %0, i8** %7
store i64* %1, i64** %8
store i8* %2, i8** %9
store i64 %3, i64* %10
store i8* %4, i8** %11
store i8* %5, i8** %12
%13 = load i8*, i8** %7
%14 = load i64*, i64** %8
%15 = load i8*, i8** %9
%16 = load i64, i64* %10
%17 = load i8*, i8** %11
%18 = load i8*, i8** %12
%19 = call i8* @chacha20poly1305_decrypt(i8* %13, i64* %14, i8* %15, i64 %16, i8* %17, i8* %18)
ret i8* %19
}

LLVM IR (-O2):
define i8* @crypt_decrypt_chacha20poly1305(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4, i8* %5) {
%7 = tail call i8* @chacha20poly1305_decrypt(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4, i8* %5)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ free5(void *****);
void free5int(int *****p) { free5((void *****)p); }


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

x86 assembly (clang, -O2):
<free5int>:
jmp    1030 <free5@plt>

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

LLVM IR (-O2):
define void @free5int(i32***** %0) {
%2 = bitcast i32***** %0 to i8*****
%3 = tail call i32 @free5(i8***** %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ setReg(int, int);
int cbse(int x, int y) {
  setReg(1, ((y << 9) | x));
  setReg(2, 0);
  return 0;
}


x86 assembly (clang, -O0):
<cbse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%esi
shl    $0x9,%esi
or     -0x4(%rbp),%esi
mov    $0x1,%edi
call   1030 <setReg@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   1030 <setReg@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cbse>:
push   %rax
shl    $0x9,%esi
or     %edi,%esi
mov    $0x1,%edi
call   1030 <setReg@plt>
mov    $0x2,%edi
xor    %esi,%esi
call   1030 <setReg@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @cbse(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 %5, 9
%7 = load i32, i32* %3
%8 = or i32 %6, %7
%9 = call i32 @setReg(i32 1, i32 %8)
%10 = call i32 @setReg(i32 2, i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @cbse(i32 %0, i32 %1) {
%3 = shl i32 %1, 9
%4 = or i32 %3, %0
%5 = tail call i32 @setReg(i32 1, i32 %4)
%6 = tail call i32 @setReg(i32 2, i32 0)
ret i32 0
}
/* Variables and functions */
int FNM_PATHNAME;
int FNM_PERIOD;
int fnmatch(char const *, char const *, int);
int c_pnmatch(const char *pat, const char *str) {
  return fnmatch(pat, str, FNM_PATHNAME | FNM_PERIOD);
}


x86 assembly (clang, -O0):
<c_pnmatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2ea1(%rip),%rax
mov    (%rax),%edx
mov    0x2ea8(%rip),%rax
or     (%rax),%edx
call   1030 <fnmatch@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_pnmatch>:
mov    0x2eb9(%rip),%rax
mov    0x2ec2(%rip),%rcx
mov    (%rcx),%edx
or     (%rax),%edx
jmp    1030 <fnmatch@plt>

LLVM IR (-O0):
@FNM_PATHNAME = global i32 0
@FNM_PERIOD = global i32 0
define i32 @c_pnmatch(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** %4
%7 = load i32, i32* @FNM_PATHNAME
%8 = load i32, i32* @FNM_PERIOD
%9 = or i32 %7, %8
%10 = call i32 @fnmatch(i8* %5, i8* %6, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
@FNM_PATHNAME = global i32 0
@FNM_PERIOD = global i32 0
define i32 @c_pnmatch(i8* %0, i8* %1) {
%3 = load i32, i32* @FNM_PATHNAME
%4 = load i32, i32* @FNM_PERIOD
%5 = or i32 %4, %3
%6 = tail call i32 @fnmatch(i8* %0, i8* %1, i32 %5)
ret i32 %6
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int solcon_dimension_of_quaddobl_solutions(int *dimension) {
  int *a, fail;
  double *c;
  fail = _ada_use_c2phc(393, a, dimension, c);
  return fail;
}


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

x86 assembly (clang, -O2):
<solcon_dimension_of_quaddobl_solutions>:
mov    %rdi,%rdx
mov    $0x189,%edi
jmp    1030 <_ada_use_c2phc@plt>

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

LLVM IR (-O2):
define i32 @solcon_dimension_of_quaddobl_solutions(i32* %0) {
%2 = tail call i32 @_ada_use_c2phc(i32 393, i32* undef, i32* %0, double* undef)
ret i32 %2
}
double foo(unsigned long var) { return var; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movaps 0xef1(%rip),%xmm1
movq   -0x8(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xef0(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movq   %rdi,%xmm1
punpckldq 0xef3(%rip),%xmm1
subpd  0xefb(%rip),%xmm1
movapd %xmm1,%xmm0
unpckhpd %xmm1,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @foo(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = uitofp i64 %3 to double
ret double %4
}

LLVM IR (-O2):
define double @foo(i64 %0) {
%2 = uitofp i64 %0 to double
ret double %2
}
/* Variables and functions */
unsigned long getn(int);
int /*<<< orphan*/ put(int, unsigned long);
unsigned long get(int n) {
  unsigned long x = getn(n);
  put(n, x);
  return x;
}


x86 assembly (clang, -O0):
<get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <getn@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <put@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
call   1040 <getn@plt>
mov    %rax,%rbx
mov    %ebp,%edi
mov    %rax,%rsi
call   1030 <put@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i64 @get(i32 %0) {
%2 = alloca i32
%3 = alloca i64
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i64 @getn(i32 %4)
store i64 %5, i64* %3
%6 = load i32, i32* %2
%7 = load i64, i64* %3
%8 = call i32 @put(i32 %6, i64 %7)
%9 = load i64, i64* %3
ret i64 %9
}

LLVM IR (-O2):
define i64 @get(i32 %0) {
%2 = tail call i64 @getn(i32 %0)
%3 = tail call i32 @put(i32 %0, i64 %2)
ret i64 %2
}
int test_imm_DDint16_reg(short val) {
  return ((val) & (-0xDD << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_DDint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffff23,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_DDint16_reg(i16 signext %0) {
%2 = and i16 %0, -221
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void __attribute__((stdcall)) winapi_dummy(void) { return; }


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

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

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

LLVM IR (-O2):
define void @winapi_dummy() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int x = 10, y = 10;
  if (y == x)
    printf("y: %d is equal to x: %d", y, x);
  else
    printf("comparison is false");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1152 <main+0x42>
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1160 <main+0x50>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
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    $0xa,%esi
mov    $0xa,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"y: %d is equal to x: %d\00"
@.str.1 = [20 x i8] c"comparison is false\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
store i32 10, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* %2
%6 = icmp eq i32 %4, %5
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
br label %13
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %7
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"y: %d is equal to x: %d\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 10, i32 10)
ret i32 0
}
unsigned int DRV_PWRCTRL_STANDBYSTATECCPU(unsigned int ulStandbyTime,
                                          unsigned int ulSwitchtime) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @DRV_PWRCTRL_STANDBYSTATECCPU(i32 %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int h_errno;
int *__h_errno_location() { return &h_errno; }


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

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

LLVM IR (-O0):
@h_errno = global i32 0
define i32* @__h_errno_location() {
ret i32* @h_errno
}

LLVM IR (-O2):
@h_errno = global i32 0
define i32* @__h_errno_location() {
ret i32* @h_errno
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sleep(int);
void *work(void *arg) {
  char *p = (char *)arg;
  printf("threadpool callback fuction : %s.\n", p);
  sleep(1);
}


x86 assembly (clang, -O0):
<work>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [35 x i8] c"threadpool callback fuction : %s.\0A\00"
define i8* @work(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
store i8* %5, i8** %4
%6 = load i8*, i8** %4
%7 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = call i32 @sleep(i32 1)
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [35 x i8] c"threadpool callback fuction : %s.\0A\00"
define noalias i8* @work(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @sleep(i32 1)
ret i8* undef
}
int test_imm_3Eint16_mem(short *val) {
  return ((*val) & (-0x3E << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_3Eint16_mem>:
movzwl (%rdi),%eax
test   $0xffc2,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_3Eint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -62
%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_3Eint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -62
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int testAmplitudePct() {
  int x;
  for (x = 0; x <= 100; x += 5) {
    printf("%i %i %i\n", x, x * 127 / 100, 128 + x * 127 / 100);
  }
}


x86 assembly (clang, -O0):
<testAmplitudePct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     116c <testAmplitudePct+0x5c>
mov    -0x8(%rbp),%esi
imul   $0x7f,-0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
imul   $0x7f,-0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%edx
mov    %eax,%ecx
add    $0x80,%ecx
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x5,%eax
mov    %eax,-0x8(%rbp)
jmp    111f <testAmplitudePct+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testAmplitudePct>:
push   %rbp
push   %r14
push   %rbx
mov    $0xfffffffb,%ebx
xor    %ebp,%ebp
lea    0xede(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x5,%ebx
movzwl %bp,%ebp
mov    %ebp,%eax
shr    $0x2,%eax
imul   $0x147b,%eax,%edx
shr    $0x11,%edx
lea    0x80(%rdx),%ecx
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x27b,%ebp
cmp    $0x60,%ebx
jb     1130 <testAmplitudePct+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%i %i %i\0A\00"
define i32 @testAmplitudePct() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
br label %3
3: ; preds = %16, %0
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 100
br i1 %5, label %6, label %19
6: ; preds = %3
%7 = load i32, i32* %2
%8 = load i32, i32* %2
%9 = mul nsw i32 %8, 127
%10 = sdiv i32 %9, 100
%11 = load i32, i32* %2
%12 = mul nsw i32 %11, 127
%13 = sdiv i32 %12, 100
%14 = add nsw i32 128, %13
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %10, i32 %14)
br label %16
16: ; preds = %6
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 5
store i32 %18, i32* %2
br label %3
19: ; preds = %3
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
@.str = [10 x i8] c"%i %i %i\0A\00"
define i32 @testAmplitudePct() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %9, %1 ]
%3 = trunc i32 %2 to i16
%4 = mul nuw nsw i16 %3, 127
%5 = udiv i16 %4, 100
%6 = zext i16 %5 to i32
%7 = add nuw nsw i32 %6, 128
%8 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %6, i32 %7)
%9 = add nuw nsw i32 %2, 5
%10 = icmp ult i32 %2, 96
br i1 %10, label %1, label %11
11: ; preds = %1
ret i32 undef
}
/* Variables and functions */
unsigned char si475xFMRX_seek(unsigned char, unsigned char);
unsigned char si47xxFMRX_seek(int upDown, int stopFlag) {
  return si475xFMRX_seek((unsigned char)(upDown), (unsigned char)stopFlag);
}


x86 assembly (clang, -O0):
<si47xxFMRX_seek>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%eax
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <si475xFMRX_seek@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<si47xxFMRX_seek>:
movzbl %dil,%edi
movzbl %sil,%esi
jmp    1030 <si475xFMRX_seek@plt>

LLVM IR (-O0):
define zeroext i8 @si47xxFMRX_seek(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 = trunc i32 %5 to i8
%7 = load i32, i32* %4
%8 = trunc i32 %7 to i8
%9 = call zeroext i8 @si475xFMRX_seek(i8 zeroext %6, i8 zeroext %8)
ret i8 %9
}

LLVM IR (-O2):
define zeroext i8 @si47xxFMRX_seek(i32 %0, i32 %1) {
%3 = trunc i32 %0 to i8
%4 = trunc i32 %1 to i8
%5 = tail call zeroext i8 @si475xFMRX_seek(i8 zeroext %3, i8 zeroext %4)
ret i8 %5
}
/* Variables and functions */
int /*<<< orphan*/ _ididfd(int, double, int, double, float, double);
void call_ididfd() { _ididfd(1, 2.0, 3, 4.0, 5.0f, 6.0); }


x86 assembly (clang, -O0):
<call_ididfd>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
movsd  0xedf(%rip),%xmm0
mov    $0x3,%esi
movsd  0xeda(%rip),%xmm1
movss  0xee2(%rip),%xmm2
movsd  0xed2(%rip),%xmm3
call   1030 <_ididfd@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_ididfd>:
movsd  0xee8(%rip),%xmm0
movsd  0xee8(%rip),%xmm1
movss  0xef0(%rip),%xmm2
movsd  0xee0(%rip),%xmm3
mov    $0x1,%edi
mov    $0x3,%esi
jmp    1030 <_ididfd@plt>

LLVM IR (-O0):
define void @call_ididfd() {
%1 = call i32 @_ididfd(i32 1, double 2.000000e+00, i32 3, double 4.000000e+00, float 5.000000e+00, double 6.000000e+00)
ret void
}

LLVM IR (-O2):
define void @call_ididfd() {
%1 = tail call i32 @_ididfd(i32 1, double 2.000000e+00, i32 3, double 4.000000e+00, float 5.000000e+00, double 6.000000e+00)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void encrypt(uint8_t *ciphertext, const uint8_t *plaintext, size_t length) {}


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

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

LLVM IR (-O0):
define void @encrypt(i32* %0, i32* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i64
store i32* %0, i32** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
ret void
}

LLVM IR (-O2):
define void @encrypt(i32* nocapture %0, i32* nocapture %1, i64 %2) {
ret void
}
float farenheitToCelsius(long f) { return (f - 32) / 1.8; }


x86 assembly (clang, -O0):
<farenheitToCelsius>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
sub    $0x20,%rax
cvtsi2sd %rax,%xmm0
movsd  0xee3(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<farenheitToCelsius>:
add    $0xffffffffffffffe0,%rdi
cvtsi2sd %rdi,%xmm0
divsd  0xeef(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @farenheitToCelsius(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sub nsw i64 %3, 32
%5 = sitofp i64 %4 to double
%6 = fdiv double %5, 1.800000e+00
%7 = fptrunc double %6 to float
ret float %7
}

LLVM IR (-O2):
define float @farenheitToCelsius(i64 %0) {
%2 = add nsw i64 %0, -32
%3 = sitofp i64 %2 to double
%4 = fdiv double %3, 1.800000e+00
%5 = fptrunc double %4 to float
ret float %5
}
void vadd(const float *src1, const float *src2, float *dst) {
  dst[(signed long int)0] = src1[(signed long int)0] + src2[(signed long int)0];
  dst[(signed long int)1] = src1[(signed long int)1] + src2[(signed long int)1];
  dst[(signed long int)2] = src1[(signed long int)2] + src2[(signed long int)2];
}


x86 assembly (clang, -O0):
<vadd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
addss  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
addss  0x4(%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
addss  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<vadd>:
movss  (%rdi),%xmm0
addss  (%rsi),%xmm0
movss  %xmm0,(%rdx)
movss  0x4(%rdi),%xmm0
addss  0x4(%rsi),%xmm0
movss  %xmm0,0x4(%rdx)
movss  0x8(%rdi),%xmm0
addss  0x8(%rsi),%xmm0
movss  %xmm0,0x8(%rdx)
ret

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

LLVM IR (-O2):
define void @vadd(float* nocapture %0, float* nocapture %1, float* nocapture writeonly %2) {
%4 = load float, float* %0
%5 = load float, float* %1
%6 = fadd float %4, %5
store float %6, float* %2
%7 = getelementptr inbounds float, float* %0, i64 1
%8 = load float, float* %7
%9 = getelementptr inbounds float, float* %1, i64 1
%10 = load float, float* %9
%11 = fadd float %8, %10
%12 = getelementptr inbounds float, float* %2, i64 1
store float %11, float* %12
%13 = getelementptr inbounds float, float* %0, i64 2
%14 = load float, float* %13
%15 = getelementptr inbounds float, float* %1, i64 2
%16 = load float, float* %15
%17 = fadd float %14, %16
%18 = getelementptr inbounds float, float* %2, i64 2
store float %17, float* %18
ret void
}
int autoFn() {
  auto int x = 0;
  x++;
  return x;
}


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

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

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

LLVM IR (-O2):
define i32 @autoFn() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int hour24(int hour12, char c) {
  if (hour12 == 12) {
    hour12 = 0;
  }
  if (c == 'A') {
    return hour12;
  } else if (c == 'P') {
    return hour12 + 12;
  }
  assert(0);
}


x86 assembly (clang, -O0):
<hour24>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
cmpl   $0xc,-0x8(%rbp)
jne    1132 <hour24+0x22>
movl   $0x0,-0x8(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x41,%eax
jne    114a <hour24+0x3a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1171 <hour24+0x61>
movsbl -0x9(%rbp),%eax
cmp    $0x50,%eax
jne    1165 <hour24+0x55>
mov    -0x8(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0x4(%rbp)
jmp    1171 <hour24+0x61>
jmp    116a <hour24+0x5a>
xor    %edi,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hour24>:
xor    %eax,%eax
cmp    $0xc,%edi
cmovne %edi,%eax
cmp    $0x41,%sil
je     1134 <hour24+0x24>
cmp    $0x50,%sil
jne    1128 <hour24+0x18>
add    $0xc,%eax
ret
push   %rax
xor    %edi,%edi
call   1030 <assert@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @hour24(i32 %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 %0, i32* %4
store i8 %1, i8* %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 12
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 0, i32* %4
br label %9
9: ; preds = %8, %2
%10 = load i8, i8* %5
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 65
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = load i32, i32* %4
store i32 %14, i32* %3
br label %25
15: ; preds = %9
%16 = load i8, i8* %5
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 80
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i32, i32* %4
%21 = add nsw i32 %20, 12
store i32 %21, i32* %3
br label %25
22: ; preds = %15
br label %23
23: ; preds = %22
%24 = call i32 @assert(i32 0)
br label %25
25: ; preds = %23, %19, %13
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @hour24(i32 %0, i8 signext %1) {
%3 = icmp eq i32 %0, 12
%4 = select i1 %3, i32 0, i32 %0
switch i8 %1, label %7 [
i8 65, label %9
i8 80, label %5
]
5: ; preds = %2
%6 = add nsw i32 %4, 12
br label %9
7: ; preds = %2
%8 = tail call i32 @assert(i32 0)
br label %9
9: ; preds = %2, %7, %5
%10 = phi i32 [ %6, %5 ], [ undef, %7 ], [ %4, %2 ]
ret i32 %10
}
long idfBernoulli(double p, double u) { return ((u < 1.0 - p) ? 0 : 1); }


x86 assembly (clang, -O0):
<idfBernoulli>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  0xee5(%rip),%xmm0
subsd  -0x8(%rbp),%xmm0
mov    $0x1,%eax
xor    %ecx,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
cltq
pop    %rbp
ret

x86 assembly (clang, -O2):
<idfBernoulli>:
movsd  0xef8(%rip),%xmm2
subsd  %xmm0,%xmm2
xor    %eax,%eax
ucomisd %xmm1,%xmm2
setbe  %al
ret

LLVM IR (-O0):
define i64 @idfBernoulli(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* %3
%7 = fsub double 1.000000e+00, %6
%8 = fcmp olt double %5, %7
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 0, i32 1
%11 = sext i32 %10 to i64
ret i64 %11
}

LLVM IR (-O2):
define i64 @idfBernoulli(double %0, double %1) {
%3 = fsub double 1.000000e+00, %0
%4 = fcmp ule double %3, %1
%5 = zext i1 %4 to i64
ret i64 %5
}