xunge/DecIR huggingface dataset:
unsigned hash(char *name) {
  unsigned val;
  for (val = 0; *name != '\0'; name++) {
    val = *name + 31 * val;
  }
  return val % 1000;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1140 <hash+0x40>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
imul   $0x1f,-0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <hash+0xf>
mov    -0xc(%rbp),%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     113f <hash+0x3f>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
mov    %eax,%edx
shl    $0x5,%edx
sub    %eax,%edx
mov    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
mov    %eax,%ecx
imul   $0x10624dd3,%rcx,%rcx
shr    $0x26,%rcx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul i32 %6, 31
%10 = add i32 %9, %8
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = urem i32 %10, 1000
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
int test_imm_CFint16_reg(short val) {
  return ((val) & (-0xCF << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_CFint16_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, -207
%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_CFint16_reg(i16 signext %0) {
%2 = and i16 %0, -207
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
ru(i) {
  if (fu(i++) != 5)
    abort();
  if (fu(++i) != 7)
    abort();
}


x86 assembly (clang, -O0):
<ru>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1040 <fu@plt>
cmp    $0x5,%eax
je     114b <ru+0x2b>
call   1030 <abort@plt>
mov    -0x8(%rbp),%edi
add    $0x1,%edi
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <fu@plt>
cmp    $0x7,%eax
je     1169 <ru+0x49>
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ru>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <fu@plt>
cmp    $0x5,%eax
jne    1142 <ru+0x22>
add    $0x2,%ebx
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <fu@plt>
cmp    $0x7,%eax
jne    1142 <ru+0x22>
pop    %rbx
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @ru(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 1
store i32 %5, i32* %3
%6 = call i32 (i32, ...) bitcast (i32 (...)* @fu to i32 (i32, ...)*)(i32 %4)
%7 = icmp ne i32 %6, 5
br i1 %7, label %8, label %9
8: ; preds = %1
unreachable
9: ; preds = %1
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
store i32 %11, i32* %3
%12 = call i32 (i32, ...) bitcast (i32 (...)* @fu to i32 (i32, ...)*)(i32 %11)
%13 = icmp ne i32 %12, 7
br i1 %13, label %14, label %15
14: ; preds = %9
unreachable
15: ; preds = %9
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @ru(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @fu to i32 (i32, ...)*)(i32 %0)
%3 = icmp eq i32 %2, 5
br i1 %3, label %5, label %4
4: ; preds = %1
tail call void @abort()
unreachable
5: ; preds = %1
%6 = add nsw i32 %0, 2
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @fu to i32 (i32, ...)*)(i32 %6)
%8 = icmp eq i32 %7, 7
br i1 %8, label %10, label %9
9: ; preds = %5
tail call void @abort()
unreachable
10: ; preds = %5
ret i32 undef
}
/* Variables and functions */
scalar_t__ floor(double);
int /*<<< orphan*/ link_failure_floor();
void test_floor(double d) {
  if (floor(d) != floor(d))
    link_failure_floor();
}


x86 assembly (clang, -O0):
<test_floor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <floor@plt>
mov    %rax,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <floor@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
cmp    %rcx,%rax
je     115c <test_floor+0x3c>
mov    $0x0,%al
call   1030 <link_failure_floor@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_floor>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
call   1040 <floor@plt>
mov    %rax,%rbx
movsd  0x8(%rsp),%xmm0
call   1040 <floor@plt>
cmp    %rax,%rbx
jne    1149 <test_floor+0x29>
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1030 <link_failure_floor@plt>

LLVM IR (-O0):
define void @test_floor(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @floor(double %3)
%5 = load double, double* %2
%6 = call i64 @floor(double %5)
%7 = icmp ne i64 %4, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @link_failure_floor()
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
define void @test_floor(double %0) {
%2 = tail call i64 @floor(double %0)
%3 = tail call i64 @floor(double %0)
%4 = icmp eq i64 %2, %3
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 (...) @link_failure_floor()
br label %7
7: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int, int, int, int,
                          int, int, int, int, int, int);
void t_a(void) {
  printf("     1 2 3 4 5 6 7\n    %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n", -38, -60,
         -62, -60, -62, -60, -62, -60, -62, -60, -62, -60, -62, -60, -65);
}


x86 assembly (clang, -O0):
<t_a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    0xee1(%rip),%rdi
mov    $0xffffffda,%esi
mov    $0xffffffc4,%r8d
mov    $0xffffffc2,%r9d
mov    %r8d,%edx
mov    %r9d,%ecx
movl   $0xffffffc4,(%rsp)
movl   $0xffffffc2,0x8(%rsp)
ff
movl   $0xffffffc4,0x10(%rsp)
ff
movl   $0xffffffc2,0x18(%rsp)
ff
movl   $0xffffffc4,0x20(%rsp)
ff
movl   $0xffffffc2,0x28(%rsp)
ff
movl   $0xffffffc4,0x30(%rsp)
ff
movl   $0xffffffc2,0x38(%rsp)
ff
movl   $0xffffffc4,0x40(%rsp)
ff
movl   $0xffffffbf,0x48(%rsp)
ff
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_a>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xffffffda,%esi
mov    $0xffffffc4,%edx
mov    $0xffffffc2,%ecx
mov    $0xffffffc4,%r8d
mov    $0xffffffc2,%r9d
push   $0xffffffffffffffbf
push   $0xffffffffffffffc4
push   $0xffffffffffffffc2
push   $0xffffffffffffffc4
push   $0xffffffffffffffc2
push   $0xffffffffffffffc4
push   $0xffffffffffffffc2
push   $0xffffffffffffffc4
push   $0xffffffffffffffc2
push   $0xffffffffffffffc4
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rax
ret

LLVM IR (-O0):
@.str = [55 x i8] c" 1 2 3 4 5 6 7\0A %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\0A\00"
define void @t_a() {
%1 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 -38, i32 -60, i32 -62, i32 -60, i32 -62, i32 -60, i32 -62, i32 -60, i32 -62, i32 -60, i32 -62, i32 -60, i32 -62, i32 -60, i32 -65)
ret void
}

LLVM IR (-O2):
@.str = [55 x i8] c" 1 2 3 4 5 6 7\0A %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\0A\00"
define void @t_a() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 -38, i32 -60, i32 -62, i32 -60, i32 -62, i32 -60, i32 -62, i32 -60, i32 -62, i32 -60, i32 -62, i32 -60, i32 -62, i32 -60, i32 -65)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
void free_string(char *str) { free(str); }


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

x86 assembly (clang, -O2):
<free_string>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_string(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int syscon_add_symbol(int, char *);
int padcon_add_Z0(void) {
  int fail;
  char name[2];
  name[0] = 'Z';
  name[1] = '0';
  fail = syscon_add_symbol(2, name);
  return fail;
}


x86 assembly (clang, -O0):
<padcon_add_Z0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x5a,-0x6(%rbp)
movb   $0x30,-0x5(%rbp)
lea    -0x6(%rbp),%rsi
mov    $0x2,%edi
call   1030 <syscon_add_symbol@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<padcon_add_Z0>:
push   %rax
movw   $0x305a,0x6(%rsp)
lea    0x6(%rsp),%rsi
mov    $0x2,%edi
call   1030 <syscon_add_symbol@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @padcon_add_Z0() {
%1 = alloca i32
%2 = alloca [2 x i8]
%3 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
store i8 90, i8* %3
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 1
store i8 48, i8* %4
%5 = getelementptr inbounds [2 x i8], [2 x i8]* %2, i64 0, i64 0
%6 = call i32 @syscon_add_symbol(i32 2, i8* %5)
store i32 %6, i32* %1
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
define i32 @padcon_add_Z0() {
%1 = alloca [2 x i8]
%2 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 0
store i8 90, i8* %2
%3 = getelementptr inbounds [2 x i8], [2 x i8]* %1, i64 0, i64 1
store i8 48, i8* %3
%4 = call i32 @syscon_add_symbol(i32 2, i8* %2)
ret i32 %4
}
/* Variables and functions */
void *__builtin___bnd_copy_ptr_bounds(void *, void *);
void *chkp_test(void *p, void *q) {
  return __builtin___bnd_copy_ptr_bounds(p, q);
}


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

x86 assembly (clang, -O2):
<chkp_test>:
jmp    1030 <__builtin___bnd_copy_ptr_bounds@plt>

LLVM IR (-O0):
define i8* @chkp_test(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 = call i8* @__builtin___bnd_copy_ptr_bounds(i8* %5, i8* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @chkp_test(i8* %0, i8* %1) {
%3 = tail call i8* @__builtin___bnd_copy_ptr_bounds(i8* %0, i8* %1)
ret i8* %3
}
/* Type definitions */
struct cxl_ioctl_start_work {
  int /*<<< orphan*/ amr;
};
typedef int /*<<< orphan*/ __u64;

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
int /*<<< orphan*/ errno;
int cxl_work_get_amr(struct cxl_ioctl_start_work *work, __u64 *valp) {
  if (work == NULL) {
    errno = EINVAL;
    return -1;
  }
  *valp = work->amr;
  return 0;
}


x86 assembly (clang, -O0):
<cxl_work_get_amr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1135 <cxl_work_get_amr+0x35>
mov    0x2eba(%rip),%rax
mov    (%rax),%ecx
mov    0x2eb9(%rip),%rax
mov    %ecx,(%rax)
movl   $0xffffffff,-0x4(%rbp)
jmp    1148 <cxl_work_get_amr+0x48>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cxl_work_get_amr>:
xor    %eax,%eax
test   %rdi,%rdi
sete   %cl
jne    1118 <cxl_work_get_amr+0x18>
mov    0x2ec7(%rip),%rdi
mov    0x2ec8(%rip),%rsi
mov    %cl,%al
neg    %eax
mov    (%rdi),%ecx
mov    %ecx,(%rsi)
ret

LLVM IR (-O0):
%struct.cxl_ioctl_start_work = type { i32 }
@EINVAL = global i32 0
@errno = global i32 0
define i32 @cxl_work_get_amr(%struct.cxl_ioctl_start_work* %0, i32* %1) {
%3 = alloca i32
%4 = alloca %struct.cxl_ioctl_start_work*
%5 = alloca i32*
store %struct.cxl_ioctl_start_work* %0, %struct.cxl_ioctl_start_work** %4
store i32* %1, i32** %5
%6 = load %struct.cxl_ioctl_start_work*, %struct.cxl_ioctl_start_work** %4
%7 = icmp eq %struct.cxl_ioctl_start_work* %6, null
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* @EINVAL
store i32 %9, i32* @errno
store i32 -1, i32* %3
br label %15
10: ; preds = %2
%11 = load %struct.cxl_ioctl_start_work*, %struct.cxl_ioctl_start_work** %4
%12 = getelementptr inbounds %struct.cxl_ioctl_start_work, %struct.cxl_ioctl_start_work* %11, i32 0, i32 0
%13 = load i32, i32* %12
%14 = load i32*, i32** %5
store i32 %13, i32* %14
store i32 0, i32* %3
br label %15
15: ; preds = %10, %8
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
%struct.cxl_ioctl_start_work = type { i32 }
@EINVAL = global i32 0
@errno = global i32 0
define i32 @cxl_work_get_amr(%struct.cxl_ioctl_start_work* %0, i32* nocapture writeonly %1) {
%3 = icmp eq %struct.cxl_ioctl_start_work* %0, null
%4 = getelementptr inbounds %struct.cxl_ioctl_start_work, %struct.cxl_ioctl_start_work* %0, i64 0, i32 0
%5 = select i1 %3, i32* @EINVAL, i32* %4
%6 = select i1 %3, i32* @errno, i32* %1
%7 = sext i1 %3 to i32
%8 = load i32, i32* %5
store i32 %8, i32* %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  char test[20];
  strcpy(test, "test1 ");
  strcat(test, "test2 ");
  strcat(test, "test3\n");
  puts(test);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x20(%rbp),%rdi
lea    0xebd(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x20(%rbp),%rdi
lea    0xeb4(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x20(%rbp),%rdi
lea    0xeab(%rip),%rsi
call   1050 <strcat@plt>
lea    -0x20(%rbp),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xec4(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
lea    0xeb1(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcat@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"test1 \00"
@.str.1 = [7 x i8] c"test2 \00"
@.str.2 = [7 x i8] c"test3\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%5 = call i32 @strcat(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%7 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%9 = call i32 @puts(i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"test1 \00"
@.str.1 = [7 x i8] c"test2 \00"
@.str.2 = [7 x i8] c"test3\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @strcat(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @strcat(i8* %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @puts(i8* %2)
ret i32 0
}
int test_imm_7Buint32_reg(unsigned int val) {
  return ((val) & (0x7B << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_7Buint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x7b,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_7Buint32_reg(i32 %0) {
%2 = and i32 %0, 123
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_silence_memchunk_get() {
  printf("NOT IMPLEMENTED:"
         "pa_silence_memchunk_get"
         "\n");
}


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

x86 assembly (clang, -O2):
<pa_silence_memchunk_get>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [40 x i8] c"NOT IMPLEMENTED:pa_silence_memchunk_get\00"
define i32 @pa_silence_memchunk_get() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
void BN_rand_range(void) {}


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

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

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

LLVM IR (-O2):
define void @BN_rand_range() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *Fnv1a_create_from_file(int /*<<< orphan*/ *const);
char *Fnv1a_create_string(int /*<<< orphan*/);
int /*<<< orphan*/ free(int /*<<< orphan*/ *const);
char *Fnv1a_create_string_from_file(FILE *const inFilePtr) {
  char *retVal = NULL;
  uint32_t *const hashPtr = Fnv1a_create_from_file(inFilePtr);
  if (hashPtr != NULL) {
    retVal = Fnv1a_create_string(*hashPtr);
    free(hashPtr);
  }
  return retVal;
}


x86 assembly (clang, -O0):
<Fnv1a_create_string_from_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <Fnv1a_create_from_file@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1174 <Fnv1a_create_string_from_file+0x44>
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
call   1050 <Fnv1a_create_string@plt>
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Fnv1a_create_string_from_file>:
push   %r14
push   %rbx
push   %rax
call   1040 <Fnv1a_create_from_file@plt>
test   %rax,%rax
je     1158 <Fnv1a_create_string_from_file+0x28>
mov    %rax,%rbx
mov    (%rax),%edi
call   1050 <Fnv1a_create_string@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
jmp    115a <Fnv1a_create_string_from_file+0x2a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @Fnv1a_create_string_from_file(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i32*
store i32* %0, i32** %2
store i8* null, i8** %3
%5 = load i32*, i32** %2
%6 = call i32* @Fnv1a_create_from_file(i32* %5)
store i32* %6, i32** %4
%7 = load i32*, i32** %4
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %15
9: ; preds = %1
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
%12 = call i8* @Fnv1a_create_string(i32 %11)
store i8* %12, i8** %3
%13 = load i32*, i32** %4
%14 = call i32 @free(i32* %13)
br label %15
15: ; preds = %9, %1
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
define i8* @Fnv1a_create_string_from_file(i32* %0) {
%2 = tail call i32* @Fnv1a_create_from_file(i32* %0)
%3 = icmp eq i32* %2, null
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = load i32, i32* %2
%6 = tail call i8* @Fnv1a_create_string(i32 %5)
%7 = tail call i32 @free(i32* %2)
br label %8
8: ; preds = %4, %1
%9 = phi i8* [ %6, %4 ], [ null, %1 ]
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ check_seq(int, int *, int /*<<< orphan*/,
                             int /*<<< orphan*/);
scalar_t__ malloc(int);
void print_seq(int num) {
  int *array;
  array = (int *)malloc(num * sizeof(int));
  check_seq(num, array, 0, 0);
}


x86 assembly (clang, -O0):
<print_seq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <check_seq@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_seq>:
push   %rbx
mov    %edi,%ebx
lea    0x0(,%rbx,4),%edi
call   1040 <malloc@plt>
mov    %ebx,%edi
mov    %rax,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
pop    %rbx
jmp    1030 <check_seq@plt>

LLVM IR (-O0):
define void @print_seq(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sext i32 %4 to i64
%6 = mul i64 %5, 4
%7 = trunc i64 %6 to i32
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %3
%10 = load i32, i32* %2
%11 = load i32*, i32** %3
%12 = call i32 @check_seq(i32 %10, i32* %11, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @print_seq(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i64 @malloc(i32 %2)
%4 = inttoptr i64 %3 to i32*
%5 = tail call i32 @check_seq(i32 %0, i32* %4, i32 0, i32 0)
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int32_t endianSwapI32(int32_t i) {
  int32_t tmp = 0;
  tmp |= ((i >> 24) & (0xff << 0));
  tmp |= ((i >> 8) & (0xff << 8));
  tmp |= ((i << 8) & (0xff << 16));
  tmp |= ((i << 24) & (0xff << 24));
  return tmp;
}


x86 assembly (clang, -O0):
<endianSwapI32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x18,%eax
and    $0xff,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x8,%eax
and    $0xff00,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
and    $0xff0000,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x18,%eax
and    $0xff000000,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<endianSwapI32>:
mov    %edi,%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @endianSwapI32(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = ashr i32 %4, 24
%6 = and i32 %5, 255
%7 = load i32, i32* %3
%8 = or i32 %7, %6
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = ashr i32 %9, 8
%11 = and i32 %10, 65280
%12 = load i32, i32* %3
%13 = or i32 %12, %11
store i32 %13, i32* %3
%14 = load i32, i32* %2
%15 = shl i32 %14, 8
%16 = and i32 %15, 16711680
%17 = load i32, i32* %3
%18 = or i32 %17, %16
store i32 %18, i32* %3
%19 = load i32, i32* %2
%20 = shl i32 %19, 24
%21 = and i32 %20, -16777216
%22 = load i32, i32* %3
%23 = or i32 %22, %21
store i32 %23, i32* %3
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @endianSwapI32(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("To compile C, type:\n");
  printf("\tgcc filename.c\n");
  printf("To run the file you just compiled, type:\n");
  printf("\t./filename.out\n");
  printf("\nYou're done.\n");
}


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

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

LLVM IR (-O0):
@.str = [21 x i8] c"To compile C, type:\0A\00"
@.str.1 = [17 x i8] c"\09gcc filename.c\0A\00"
@.str.2 = [42 x i8] c"To run the file you just compiled, type:\0A\00"
@.str.3 = [17 x i8] c"\09./filename.out\0A\00"
@.str.4 = [15 x i8] c"\0AYou're done.\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [20 x i8] c"To compile C, type:\00"
@str.5 = [16 x i8] c"\09gcc filename.c\00"
@str.6 = [41 x i8] c"To run the file you just compiled, type:\00"
@str.7 = [16 x i8] c"\09./filename.out\00"
@str.8 = [14 x i8] c"\0AYou're done.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.7, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.8, i64 0, i64 0))
ret i32 0
}
void test2(void) {
  int i;
  i++;
  i++;
  i++;
  i++;
  i--;
  return;
}


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

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

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

LLVM IR (-O2):
define void @test2() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ item;

/* Variables and functions */
int /*<<< orphan*/ free(struct dll_item *);
scalar_t__ malloc(int);
int main() {
  typedef struct dll_item dll_item_t;
  struct dll_item {
    dll_item_t *prev;
    dll_item_t *next;
  };
  dll_item_t *item = (dll_item_t *)malloc(sizeof(item));
  item->prev = NULL;
  item->next = NULL;
  free(item);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x8,%edi
call   1040 <malloc@plt>
xorps  %xmm0,%xmm0
movups %xmm0,(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.dll_item = type { %struct.dll_item*, %struct.dll_item* }
%struct.dll_item.0 = type opaque
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.dll_item*
store i32 0, i32* %1
%3 = call i64 @malloc(i32 8)
%4 = inttoptr i64 %3 to %struct.dll_item*
store %struct.dll_item* %4, %struct.dll_item** %2
%5 = load %struct.dll_item*, %struct.dll_item** %2
%6 = getelementptr inbounds %struct.dll_item, %struct.dll_item* %5, i32 0, i32 0
store %struct.dll_item* null, %struct.dll_item** %6
%7 = load %struct.dll_item*, %struct.dll_item** %2
%8 = getelementptr inbounds %struct.dll_item, %struct.dll_item* %7, i32 0, i32 1
store %struct.dll_item* null, %struct.dll_item** %8
%9 = load %struct.dll_item*, %struct.dll_item** %2
%10 = bitcast %struct.dll_item* %9 to %struct.dll_item.0*
%11 = call i32 @free(%struct.dll_item.0* %10)
ret i32 0
}

LLVM IR (-O2):
%struct.dll_item.0 = type opaque
define i32 @main() {
%1 = tail call i64 @malloc(i32 8)
%2 = inttoptr i64 %1 to %struct.dll_item.0*
%3 = inttoptr i64 %1 to i8*
%4 = tail call i32 @free(%struct.dll_item.0* %2)
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ MaxHeapify(int *, int, int);
void MaxHeapCreat(uint32_t *array, uint32_t heapSize) {
  int i = 0;
  for (i = heapSize / 2; i >= 0; i--) {
    MaxHeapify(array, heapSize, i);
  }
}


x86 assembly (clang, -O0):
<MaxHeapCreat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     115b <MaxHeapCreat+0x4b>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <MaxHeapify@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <MaxHeapCreat+0x24>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MaxHeapCreat>:
push   %rbp
push   %r14
push   %rbx
cmp    $0xffffffff,%esi
jl     1141 <MaxHeapCreat+0x31>
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%ebp
shr    $0x1f,%ebp
add    %esi,%ebp
sar    %ebp
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <MaxHeapify@plt>
add    $0xffffffff,%ebp
jb     1130 <MaxHeapCreat+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @MaxHeapCreat(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
%6 = load i32, i32* %4
%7 = sdiv i32 %6, 2
store i32 %7, i32* %5
br label %8
8: ; preds = %16, %2
%9 = load i32, i32* %5
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %8
%12 = load i32*, i32** %3
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = call i32 @MaxHeapify(i32* %12, i32 %13, i32 %14)
br label %16
16: ; preds = %11
%17 = load i32, i32* %5
%18 = add nsw i32 %17, -1
store i32 %18, i32* %5
br label %8
19: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @MaxHeapCreat(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, -2
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = sdiv i32 %1, 2
br label %6
6: ; preds = %4, %6
%7 = phi i32 [ %9, %6 ], [ %5, %4 ]
%8 = tail call i32 @MaxHeapify(i32* %0, i32 %1, i32 %7)
%9 = add nsw i32 %7, -1
%10 = icmp eq i32 %7, 0
br i1 %10, label %11, label %6
11: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int free_buff(void *addr, int context) {
  if (context == 1) {
    free(addr);
    return 0;
  }
  if (context == 0) {
    return 0;
  }
  return -1;
}


x86 assembly (clang, -O0):
<free_buff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    113e <free_buff+0x2e>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
jmp    115b <free_buff+0x4b>
cmpl   $0x0,-0x14(%rbp)
jne    1154 <free_buff+0x44>
movl   $0x0,-0x4(%rbp)
jmp    115b <free_buff+0x4b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_buff>:
mov    %esi,%eax
test   %esi,%esi
je     112d <free_buff+0x1d>
cmp    $0x1,%eax
jne    1128 <free_buff+0x18>
push   %rax
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @free_buff(i8* nocapture %0, i32 %1) {
switch i32 %1, label %5 [
i32 1, label %3
i32 0, label %6
]
3: ; preds = %2
%4 = tail call i32 @free(i8* %0)
br label %6
5: ; preds = %2
br label %6
6: ; preds = %2, %5, %3
%7 = phi i32 [ 0, %3 ], [ -1, %5 ], [ %1, %2 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int _usage(void) {
  fputs("Usage: "
        "makepasswd"
        " [-ceilMmnpSs]\n"
        "       "
        "makepasswd"
        " -E [-ceilMmnSs]\n"
        "  -c	String of allowed characters (A-Za-z0-9`~!@#$%^&*()-_=+)\n"
        "  -E	Enumerate all possible values\n"
        "  -e	Encryption algorithm "
        "(none,base64,blowfish,des,md5,sha1,sha256,sha512,shmd5)\n"
        "  -i	Number of iterations in encryption algorithm\n"
        "  -l	Password length\n"
        "  -M	Maximum password length\n"
        "  -m	Minimum password length\n"
        "  -n	Number of passwords to generate\n"
        "  -p	Password to use\n"
        "  -S	Do not seed ourselves\n"
        "  -s	Salt to use\n",
        stderr);
  return 1;
}


x86 assembly (clang, -O0):
<_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_usage>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [477 x i8] c"Usage: makepasswd [-ceilMmnpSs]\0A makepasswd -E [-ceilMmnSs]\0A -c\09String of allowed characters (A-Za-z0-9`~!@#$%^&*()-_=+)\0A -E\09Enumerate all possible values\0A -e\09Encryption algorithm (none,base64,blowfish,des,md5,sha1,sha256,sha512,shmd5)\0A -i\09Number of iterations in encryption algorithm\0A -l\09Password length\0A -M\09Maximum password length\0A -m\09Minimum password length\0A -n\09Number of passwords to generate\0A -p\09Password to use\0A -S\09Do not seed ourselves\0A -s\09Salt to use\0A\00"
@stderr = global i32 0
define i32 @_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([477 x i8], [477 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}

LLVM IR (-O2):
@.str = [477 x i8] c"Usage: makepasswd [-ceilMmnpSs]\0A makepasswd -E [-ceilMmnSs]\0A -c\09String of allowed characters (A-Za-z0-9`~!@#$%^&*()-_=+)\0A -E\09Enumerate all possible values\0A -e\09Encryption algorithm (none,base64,blowfish,des,md5,sha1,sha256,sha512,shmd5)\0A -i\09Number of iterations in encryption algorithm\0A -l\09Password length\0A -M\09Maximum password length\0A -m\09Minimum password length\0A -n\09Number of passwords to generate\0A -p\09Password to use\0A -S\09Do not seed ourselves\0A -s\09Salt to use\0A\00"
@stderr = global i32 0
define i32 @_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([477 x i8], [477 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void say_two() { printf("2"); }


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

x86 assembly (clang, -O2):
<say_two>:
mov    $0x32,%edi
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"2\00"
define void @say_two() {
%1 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
define void @say_two() {
%1 = tail call i32 @putchar(i32 50)
ret void
}
unsigned short WDL_bswap16(const unsigned short int16) {
  return int16 >> 8 | int16 << 8;
}


x86 assembly (clang, -O0):
<WDL_bswap16>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sar    $0x8,%eax
movzwl -0x2(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<WDL_bswap16>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define zeroext i16 @WDL_bswap16(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = ashr i32 %4, 8
%6 = load i16, i16* %2
%7 = zext i16 %6 to i32
%8 = shl i32 %7, 8
%9 = or i32 %5, %8
%10 = trunc i32 %9 to i16
ret i16 %10
}

LLVM IR (-O2):
define zeroext i16 @WDL_bswap16(i16 zeroext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
/* Variables and functions */
double irnd();
double rnd(void) { return (1.0 / (((1UL << 32) - 1.0)) * irnd()); }


x86 assembly (clang, -O0):
<rnd>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <irnd@plt>
movaps %xmm0,%xmm1
movsd  0xeda(%rip),%xmm0
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rnd>:
push   %rax
xor    %eax,%eax
call   1030 <irnd@plt>
mulsd  0xee0(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @rnd() {
%1 = call double (...) @irnd()
%2 = fmul double 0x3DF0000000100000, %1
ret double %2
}

LLVM IR (-O2):
define double @rnd() {
%1 = tail call double (...) @irnd()
%2 = fmul double %1, 0x3DF0000000100000
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int i, answer = 1;
  for (i = 3; i <= 1001; i += 2) {
    answer += 4 * i * i - 6 * i - 6;
  }
  printf("%i\n", answer);
  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   $0x1,-0x18(%rbp)
movl   $0x3,-0x14(%rbp)
cmpl   $0x3e9,-0x14(%rbp)
jg     1168 <main+0x58>
mov    -0x14(%rbp),%eax
shl    $0x2,%eax
imul   -0x14(%rbp),%eax
imul   $0x6,-0x14(%rbp),%ecx
sub    %ecx,%eax
sub    $0x6,%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <main+0x24>
mov    -0x18(%rbp),%esi
lea    0xe8e(%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    $0x27e2a5c9,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 669165001)
ret i32 0
}
/* Type definitions */
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int inet_pton(int /*<<< orphan*/, char const *, int /*<<< orphan*/ *);
char Is_Valid_IP(const char *tIP) {
  struct sockaddr_in bIP;
  int result = inet_pton(AF_INET, tIP, &(bIP.sin_addr));
  return result == 1;
}


x86 assembly (clang, -O0):
<Is_Valid_IP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1030 <inet_pton@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
movsbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Is_Valid_IP>:
push   %rax
mov    %rdi,%rsi
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rdx
call   1030 <inet_pton@plt>
cmp    $0x1,%eax
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i32 }
@AF_INET = global i32 0
define signext i8 @Is_Valid_IP(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i32, i32* @AF_INET
%6 = load i8*, i8** %2
%7 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 0
%8 = call i32 @inet_pton(i32 %5, i8* %6, i32* %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 1
%11 = zext i1 %10 to i32
%12 = trunc i32 %11 to i8
ret i8 %12
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32 }
@AF_INET = global i32 0
define signext i8 @Is_Valid_IP(i8* %0) {
%2 = alloca %struct.sockaddr_in
%3 = bitcast %struct.sockaddr_in* %2 to i8*
%4 = load i32, i32* @AF_INET
%5 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
%6 = call i32 @inet_pton(i32 %4, i8* %0, i32* %5)
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i8
ret i8 %8
}
void EC_KEY_up_ref(void) {}


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

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

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

LLVM IR (-O2):
define void @EC_KEY_up_ref() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ stop_pause();
void paused_keyboard_handler(unsigned char key, int x, int y) {
  switch (key) {
  default:
    stop_pause();
    break;
  }
  return;
}


x86 assembly (clang, -O0):
<paused_keyboard_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0x0,%al
call   1030 <stop_pause@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @paused_keyboard_handler(i8 zeroext %0, i32 %1, i32 %2) {
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
store i8 %0, i8* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8, i8* %4
%8 = zext i8 %7 to i32
switch i32 %8, label %9 [
]
9: ; preds = %3
%10 = call i32 (...) @stop_pause()
br label %11
11: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @paused_keyboard_handler(i8 zeroext %0, i32 %1, i32 %2) {
%4 = tail call i32 (...) @stop_pause()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ prs_error(char *);
syntax() { prs_error("Syntax error"); }


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

x86 assembly (clang, -O2):
<syntax>:
lea    0xee9(%rip),%rdi
jmp    1030 <prs_error@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Syntax error\00"
define i32 @syntax() {
%1 = alloca i32
%2 = call i32 @prs_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [13 x i8] c"Syntax error\00"
define i32 @syntax() {
%1 = tail call i32 @prs_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ add_command(unsigned int *, int, int);
int /*<<< orphan*/ ipfw_init(int, char **, unsigned int, char const *,
                             int /*<<< orphan*/);
scalar_t__ optind;
int ipfw_set_policy(int args, char **arglist, const char *chain) {
  unsigned int command = 0;
  add_command(&command, 0x0400U, 0x0000U);
  ipfw_init(args, arglist, command, chain, 0);
  optind = 0;
  return (0);
}


x86 assembly (clang, -O0):
<ipfw_set_policy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x1c(%rbp),%rdi
mov    $0x400,%esi
xor    %edx,%edx
call   1040 <add_command@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1030 <ipfw_init@plt>
mov    0x2e81(%rip),%rax
movq   $0x0,(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ipfw_set_policy>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
movl   $0x0,0xc(%rsp)
lea    0xc(%rsp),%rdi
mov    $0x400,%esi
xor    %edx,%edx
call   1040 <add_command@plt>
mov    0xc(%rsp),%edx
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rcx
xor    %r8d,%r8d
call   1030 <ipfw_init@plt>
mov    0x2e84(%rip),%rax
movq   $0x0,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@optind = global i64 0
define i32 @ipfw_set_policy(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
store i32 0, i32* %7
%8 = call i32 @add_command(i32* %7, i32 1024, i32 0)
%9 = load i32, i32* %4
%10 = load i8**, i8*** %5
%11 = load i32, i32* %7
%12 = load i8*, i8** %6
%13 = call i32 @ipfw_init(i32 %9, i8** %10, i32 %11, i8* %12, i32 0)
store i64 0, i64* @optind
ret i32 0
}

LLVM IR (-O2):
@optind = global i64 0
define i32 @ipfw_set_policy(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%6 = call i32 @add_command(i32* %4, i32 1024, i32 0)
%7 = load i32, i32* %4
%8 = call i32 @ipfw_init(i32 %0, i8** %1, i32 %7, i8* %2, i32 0)
store i64 0, i64* @optind
ret i32 0
}
int test_imm_49int8_mem(signed char *val) {
  return ((*val) & (0x49 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_49int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, 73
%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_49int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 73
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}