xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void success() { printf("Your password was correct :)\n"); }


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

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

LLVM IR (-O0):
@.str = [30 x i8] c"Your password was correct :)\0A\00"
define void @success() {
%1 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [29 x i8] c"Your password was correct :)\00"
define void @success() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
ret void
}
int SD_Swap32(int val) {
  int buf;
  buf = val;
  val <<= 24;
  val |= (buf << 8) & 0xff0000;
  val |= (buf >> 8) & 0xff00;
  val |= (buf >> 24) & 0xff;
  return val;
}


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

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

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

LLVM IR (-O2):
define i32 @SD_Swap32(i32 %0) {
%2 = tail call i32 @llvm.bswap.i32(i32 %0)
ret i32 %2
}
plus(int i) { return i + 1; }


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

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

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

LLVM IR (-O2):
define i32 @plus(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int fact(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int n, m;
  printf("Enter a number: ");
  scanf("%d", &n);
  m = fact(n);
  printf("The factorial of %d is %d.\n", n, m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%edi
call   1040 <fact@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe9f(%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    0xec8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <fact@plt>
mov    0x4(%rsp),%esi
lea    0xeb0(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"The factorial of %d is %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = call i32 @fact(i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"Enter a number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [28 x i8] c"The factorial of %d is %d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @fact(i32 %5)
%7 = load i32, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %6)
ret i32 0
}
void event_slur(t) int t;
{}


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

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

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

LLVM IR (-O2):
define void @event_slur(i32 %0) {
ret void
}
int test_imm_30int16_mem(short *val) {
  return ((*val) & (0x30 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_30int16_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, 48
%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_30int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 48
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ DecodeDEa_xxxxdddxssmmmrrr();
int /*<<< orphan*/ DoBinOpAdd(int /*<<< orphan*/);
void DoCodeAddREa(void) { DoBinOpAdd(DecodeDEa_xxxxdddxssmmmrrr()); }


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

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

LLVM IR (-O0):
define void @DoCodeAddREa() {
%1 = call i32 (...) @DecodeDEa_xxxxdddxssmmmrrr()
%2 = call i32 @DoBinOpAdd(i32 %1)
ret void
}

LLVM IR (-O2):
define void @DoCodeAddREa() {
%1 = tail call i32 (...) @DecodeDEa_xxxxdddxssmmmrrr()
%2 = tail call i32 @DoBinOpAdd(i32 %1)
ret void
}
void XReparentWindow() {}


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

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

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

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

/* Variables and functions */
unsigned int UINT64_C(int);
bool test_flag(const uint64_t *array, unsigned int idx) {
  return (array[idx >> 6] & (UINT64_C(1) << (idx & 0x3f))) != 0;
}


x86 assembly (clang, -O0):
<test_flag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
shr    $0x6,%ecx
mov    %ecx,%ecx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x10(%rbp)
mov    $0x1,%edi
call   1030 <UINT64_C@plt>
mov    %eax,%edx
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
and    $0x3f,%ecx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_flag>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %esi,%eax
shr    $0x6,%eax
mov    (%rdi,%rax,4),%ebp
mov    $0x1,%edi
call   1030 <UINT64_C@plt>
mov    %ebx,%ecx
shl    %cl,%eax
xor    %ecx,%ecx
test   %ebp,%eax
setne  %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @test_flag(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 = load i32, i32* %4
%7 = lshr i32 %6, 6
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %5, i64 %8
%10 = load i32, i32* %9
%11 = call i32 @UINT64_C(i32 1)
%12 = load i32, i32* %4
%13 = and i32 %12, 63
%14 = shl i32 %11, %13
%15 = and i32 %10, %14
%16 = icmp ne i32 %15, 0
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @test_flag(i32* nocapture %0, i32 %1) {
%3 = lshr i32 %1, 6
%4 = zext i32 %3 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = tail call i32 @UINT64_C(i32 1)
%8 = and i32 %1, 63
%9 = shl i32 %7, %8
%10 = and i32 %9, %6
%11 = icmp ne i32 %10, 0
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void cl_abort_c(void *p) { abort(); }


x86 assembly (clang, -O0):
<cl_abort_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<cl_abort_c>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @cl_abort_c(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @cl_abort_c(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char const *, char *, int *, int *, int *, int *,
                          int *);
int get_prefix_len_from_prefix(const char *prefix) {
  int a, b, c, d, len;
  sscanf(prefix, "%i.%i.%i.%i/%i", &a, &b, &c, &d, &len);
  return len;
}


x86 assembly (clang, -O0):
<get_prefix_len_from_prefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
lea    -0x18(%rbp),%r9
lea    -0x1c(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <sscanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_prefix_len_from_prefix>:
sub    $0x28,%rsp
lea    0x14(%rsp),%rax
mov    %rax,(%rsp)
lea    0xedc(%rip),%rsi
lea    0x24(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0x1c(%rsp),%r8
lea    0x18(%rsp),%r9
call   1030 <sscanf@plt>
mov    0x14(%rsp),%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"%i.%i.%i.%i/%i\00"
define i32 @get_prefix_len_from_prefix(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %2
%8 = load i8*, i8** %2
%9 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6, i32* %7)
%10 = load i32, i32* %7
ret i32 %10
}

LLVM IR (-O2):
@.str = [15 x i8] c"%i.%i.%i.%i/%i\00"
define i32 @get_prefix_len_from_prefix(i8* nocapture %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %2 to i8*
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = bitcast i32* %6 to i8*
%12 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5, i32* %6)
%13 = load i32, i32* %6
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ handle_RETRACT(int /*<<< orphan*/);
int gen_RETRACT(void) {
  handle_RETRACT(0);
  return 0;
}


x86 assembly (clang, -O0):
<gen_RETRACT>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <handle_RETRACT@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @gen_RETRACT() {
%1 = call i32 @handle_RETRACT(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @gen_RETRACT() {
%1 = tail call i32 @handle_RETRACT(i32 0)
ret i32 0
}
long decimal_to_binary(long n) {
  int remainder;
  long binary = 0, i = 1;
  while (n != 0) {
    remainder = n % 2;
    n = n / 2;
    binary = binary + (remainder * i);
    i = i * 10;
  }
  return binary;
}


x86 assembly (clang, -O0):
<decimal_to_binary>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x1,-0x20(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     116a <decimal_to_binary+0x6a>
mov    -0x8(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %edx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
imul   -0x20(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
imul   $0xa,-0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1118 <decimal_to_binary+0x18>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decimal_to_binary>:
test   %rdi,%rdi
je     1146 <decimal_to_binary+0x46>
mov    $0x1,%ecx
xor    %eax,%eax
nopl   0x0(%rax)
mov    %rdi,%rdx
shr    $0x3f,%rdx
add    %rdi,%rdx
mov    %rdx,%r8
sar    %r8
and    $0xfffffffffffffffe,%rdx
mov    %rdi,%rsi
sub    %rdx,%rsi
imul   %rcx,%rsi
add    %rsi,%rax
add    %rcx,%rcx
lea    (%rcx,%rcx,4),%rcx
add    $0x1,%rdi
cmp    $0x2,%rdi
mov    %r8,%rdi
ja     1110 <decimal_to_binary+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @decimal_to_binary(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %14, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %11, %3 ], [ 1, %1 ]
%5 = phi i64 [ %10, %3 ], [ 0, %1 ]
%6 = phi i64 [ %8, %3 ], [ %0, %1 ]
%7 = srem i64 %6, 2
%8 = sdiv i64 %6, 2
%9 = mul nsw i64 %4, %7
%10 = add nsw i64 %9, %5
%11 = mul nsw i64 %4, 10
%12 = add i64 %6, 1
%13 = icmp ult i64 %12, 3
br i1 %13, label %14, label %3
14: ; preds = %3, %1
%15 = phi i64 [ 0, %1 ], [ %10, %3 ]
ret i64 %15
}
/* Variables and functions */
int ceil(int /*<<< orphan*/);
int /*<<< orphan*/ sqrt(int);
int isPrime(int num) {
  int j;
  int isPrime = 1;
  for (j = 2; j <= ceil(sqrt(num)); j++) {
    if ((num % j) == 0)
      isPrime = 0;
  }
  return isPrime;
}


x86 assembly (clang, -O0):
<isPrime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <sqrt@plt>
mov    %eax,%edi
call   1030 <ceil@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jg     1185 <isPrime+0x65>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
jne    1172 <isPrime+0x52>
movl   $0x0,-0xc(%rbp)
jmp    1177 <isPrime+0x57>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <isPrime+0x19>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrime>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
call   1040 <sqrt@plt>
mov    %eax,%edi
call   1030 <ceil@plt>
mov    $0x1,%ebp
cmp    $0x2,%eax
jl     1171 <isPrime+0x51>
mov    $0x1,%ebx
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    %r14d,%eax
cltd
idiv   %ebx
test   %edx,%edx
cmove  %edx,%ebp
mov    %r14d,%edi
call   1040 <sqrt@plt>
mov    %eax,%edi
call   1030 <ceil@plt>
cmp    %eax,%ebx
jl     1150 <isPrime+0x30>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @isPrime(i32 %0) {
%2 = tail call i32 @sqrt(i32 %0)
%3 = tail call i32 @ceil(i32 %2)
%4 = icmp slt i32 %3, 2
br i1 %4, label %15, label %5
5: ; preds = %1, %5
%6 = phi i32 [ %10, %5 ], [ 1, %1 ]
%7 = phi i32 [ %11, %5 ], [ 2, %1 ]
%8 = srem i32 %0, %7
%9 = icmp eq i32 %8, 0
%10 = select i1 %9, i32 0, i32 %6
%11 = add nuw nsw i32 %7, 1
%12 = tail call i32 @sqrt(i32 %0)
%13 = tail call i32 @ceil(i32 %12)
%14 = icmp slt i32 %7, %13
br i1 %14, label %5, label %15
15: ; preds = %5, %1
%16 = phi i32 [ 1, %1 ], [ %10, %5 ]
ret i32 %16
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
long long time_to_ns(struct timespec *);
long long get_ns(void) {
  struct timespec ts;
  clock_gettime(CLOCK_REALTIME, &ts);
  return time_to_ns(&ts);
}


x86 assembly (clang, -O0):
<get_ns>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
lea    -0x8(%rbp),%rdi
call   1040 <time_to_ns@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ns>:
push   %rbx
sub    $0x10,%rsp
mov    0x2eb4(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rbx
mov    %rbx,%rsi
call   1030 <clock_gettime@plt>
mov    %rbx,%rdi
call   1040 <time_to_ns@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i64 @get_ns() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_REALTIME
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = call i64 @time_to_ns(%struct.timespec* %1)
ret i64 %4
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i64 @get_ns() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_REALTIME
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = call i64 @time_to_ns(%struct.timespec* %1)
ret i64 %5
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memcpy(void *, void const *, size_t);
void *g_memdup(const void *src, size_t len) {
  void *dst = malloc(len);
  memcpy(dst, src, len);
  return dst;
}


x86 assembly (clang, -O0):
<g_memdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_memdup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @g_memdup(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i64, i64* %4
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
%11 = call i32 @memcpy(i8* %8, i8* %9, i64 %10)
%12 = load i8*, i8** %5
ret i8* %12
}

LLVM IR (-O2):
define i8* @g_memdup(i8* %0, i64 %1) {
%3 = tail call i8* @malloc(i64 %1)
%4 = tail call i32 @memcpy(i8* %3, i8* %0, i64 %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ fooll(long long *);
void testlonglong() {
  long long ll = 2;
  fooll(&ll);
}


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

x86 assembly (clang, -O2):
<testlonglong>:
push   %rax
movq   $0x2,(%rsp)
mov    %rsp,%rdi
call   1030 <fooll@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @testlonglong() {
%1 = alloca i64
store i64 2, i64* %1
%2 = call i32 @fooll(i64* %1)
ret void
}

LLVM IR (-O2):
define void @testlonglong() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 2, i64* %1
%3 = call i32 @fooll(i64* %1)
ret void
}
int main(void) {
  int i = 3;
  i--;
  return i;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a, b, c;
  a = 10;
  b = 20;
  c = a + b;
  printf("%d", c);
  return 0;
}


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

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

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

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

/* Variables and functions */
uint64_t xorShift64(uint64_t x) {
  x ^= x << 13;
  x ^= x >> 7;
  x ^= x << 17;
  return x;
}


x86 assembly (clang, -O0):
<xorShift64>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0xd,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x7,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x11,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xorShift64>:
mov    %edi,%eax
shl    $0xd,%eax
xor    %edi,%eax
mov    %eax,%ecx
sar    $0x7,%ecx
xor    %eax,%ecx
mov    %ecx,%eax
shl    $0x11,%eax
xor    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @xorShift64(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = shl i32 %3, 13
%5 = load i32, i32* %2
%6 = xor i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = ashr i32 %7, 7
%9 = load i32, i32* %2
%10 = xor i32 %9, %8
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = shl i32 %11, 17
%13 = load i32, i32* %2
%14 = xor i32 %13, %12
store i32 %14, i32* %2
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @xorShift64(i32 %0) {
%2 = shl i32 %0, 13
%3 = xor i32 %2, %0
%4 = ashr i32 %3, 7
%5 = xor i32 %4, %3
%6 = shl i32 %5, 17
%7 = xor i32 %6, %5
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
void turnSX() {
  printf("SX\n\r");
  system("echo  1600000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle");
  system("echo  1600000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle");
}


x86 assembly (clang, -O0):
<turnSX>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
lea    0xece(%rip),%rdi
call   1030 <system@plt>
lea    0xefa(%rip),%rdi
call   1030 <system@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<turnSX>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
call   1030 <system@plt>
lea    0xefd(%rip),%rdi
pop    %rax
jmp    1030 <system@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"SX\0A\0D\00"
@.str.1 = [56 x i8] c"echo 1600000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle\00"
@.str.2 = [56 x i8] c"echo 1600000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle\00"
define void @turnSX() {
%1 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @system(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @system(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"SX\0A\0D\00"
@.str.1 = [56 x i8] c"echo 1600000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle\00"
@.str.2 = [56 x i8] c"echo 1600000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle\00"
define void @turnSX() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @system(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ mmio_readl(void const *);
uint32_t mmio_le_readl(const void *addr) { return (mmio_readl(addr)); }


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

x86 assembly (clang, -O2):
<mmio_le_readl>:
jmp    1030 <mmio_readl@plt>

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

LLVM IR (-O2):
define i32 @mmio_le_readl(i8* %0) {
%2 = tail call i32 @mmio_readl(i8* %0)
ret i32 %2
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_event_add_exit(void *e, void **s, void *callback, void *userdata) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_event_add_exit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
mov    0x2ec3(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_event_add_exit>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_event_add_exit(i8* %0, i8** %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i32, i32* @EINVAL
%10 = sub nsw i32 0, %9
ret i32 %10
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_event_add_exit(i8* nocapture readnone %0, i8** nocapture readnone %1, i8* nocapture readnone %2, i8* nocapture readnone %3) {
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}
double PAWMetersToFeet(double meters) { return meters * 3.281; }


x86 assembly (clang, -O0):
<PAWMetersToFeet>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<PAWMetersToFeet>:
mulsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @PAWMetersToFeet(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 3.281000e+00
ret double %4
}

LLVM IR (-O2):
define double @PAWMetersToFeet(double %0) {
%2 = fmul double %0, 3.281000e+00
ret double %2
}
/* Variables and functions */
int atoi(char const *);
int WpeStringToNumber(const char *s) {
  while ((*s) == ' ') {
    s++;
  }
  return (atoi(s));
}


x86 assembly (clang, -O0):
<WpeStringToNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    113d <WpeStringToNumber+0x2d>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <WpeStringToNumber+0xc>
mov    -0x8(%rbp),%rdi
call   1030 <atoi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WpeStringToNumber>:
add    $0xffffffffffffffff,%rdi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmpb   $0x20,0x1(%rdi)
lea    0x1(%rdi),%rdi
je     1120 <WpeStringToNumber+0x10>
jmp    1030 <atoi@plt>

LLVM IR (-O0):
define i32 @WpeStringToNumber(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %8, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 32
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %2
br label %3
11: ; preds = %3
%12 = load i8*, i8** %2
%13 = call i32 @atoi(i8* %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @WpeStringToNumber(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 32
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %2, label %7
7: ; preds = %2
%8 = tail call i32 @atoi(i8* %3)
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void close_fds(int *fds, const size_t nfds) {
  if (nfds > 0) {
    close(fds[0]);
    if (nfds == 2)
      close(fds[1]);
  }
}


x86 assembly (clang, -O0):
<close_fds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jbe    1152 <close_fds+0x42>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <close@plt>
cmpq   $0x2,-0x10(%rbp)
jne    114d <close_fds+0x3d>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edi
call   1030 <close@plt>
jmp    1152 <close_fds+0x42>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<close_fds>:
push   %r14
push   %rbx
push   %rax
test   %rsi,%rsi
je     113c <close_fds+0x2c>
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rdi),%edi
call   1030 <close@plt>
cmp    $0x2,%rbx
jne    113c <close_fds+0x2c>
mov    0x4(%r14),%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <close@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @close_fds(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
store i32* %0, i32** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = icmp ugt i64 %5, 0
br i1 %6, label %7, label %20
7: ; preds = %2
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 0
%10 = load i32, i32* %9
%11 = call i32 @close(i32 %10)
%12 = load i64, i64* %4
%13 = icmp eq i64 %12, 2
br i1 %13, label %14, label %19
14: ; preds = %7
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 1
%17 = load i32, i32* %16
%18 = call i32 @close(i32 %17)
br label %19
19: ; preds = %14, %7
br label %20
20: ; preds = %19, %2
ret void
}

LLVM IR (-O2):
define void @close_fds(i32* nocapture %0, i64 %1) {
%3 = icmp eq i64 %1, 0
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = load i32, i32* %0
%6 = tail call i32 @close(i32 %5)
%7 = icmp eq i64 %1, 2
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = getelementptr inbounds i32, i32* %0, i64 1
%10 = load i32, i32* %9
%11 = tail call i32 @close(i32 %10)
br label %12
12: ; preds = %4, %8, %2
ret void
}
int test_imm_78int64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x78 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_78int64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 515396075520
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
scalar_t__ isupper(int);
int tolower(int);
int ToLower(int c) { return isupper(c) ? tolower(c) : c; }


x86 assembly (clang, -O0):
<ToLower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <isupper@plt>
cmp    $0x0,%rax
je     114d <ToLower+0x2d>
mov    -0x4(%rbp),%edi
call   1030 <tolower@plt>
mov    %eax,-0x8(%rbp)
jmp    1153 <ToLower+0x33>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ToLower>:
push   %rbx
mov    %edi,%ebx
call   1040 <isupper@plt>
test   %rax,%rax
je     1135 <ToLower+0x15>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <tolower@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ToLower(i32 %0) {
%2 = tail call i64 @isupper(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @tolower(i32 %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ %0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ glutPostRedisplay();
void Key(unsigned char key, int x, int y) {
  switch (key) {
  case 27:
    exit(0);
  default:
    glutPostRedisplay();
    return;
  }
}


x86 assembly (clang, -O0):
<Key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x1(%rbp),%al
sub    $0x1b,%al
jne    114b <Key+0x2b>
jmp    1144 <Key+0x24>
xor    %edi,%edi
call   1040 <exit@plt>
mov    $0x0,%al
call   1030 <glutPostRedisplay@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Key>:
cmp    $0x1b,%dil
je     112d <Key+0xd>
xor    %eax,%eax
jmp    1030 <glutPostRedisplay@plt>
push   %rax
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @Key(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 %11 [
i32 27, label %9
]
9: ; preds = %3
%10 = call i32 @exit(i32 0)
unreachable
11: ; preds = %3
%12 = call i32 (...) @glutPostRedisplay()
ret void
}

LLVM IR (-O2):
define void @Key(i8 zeroext %0, i32 %1, i32 %2) {
%4 = icmp eq i8 %0, 27
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @exit(i32 0)
unreachable
7: ; preds = %3
%8 = tail call i32 (...) @glutPostRedisplay()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
void print_f(float num) { printf("%f\n", num); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define void @print_f(float %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %0)
ret void
}
void bar(i) { baz(i); }


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <baz@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @bar(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @baz to i32 (i32, ...)*)(i32 %0)
ret void
}
void openmp_parallel_crash_test() {
#pragma omp parallel
  ;
}


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

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

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

LLVM IR (-O2):
define void @openmp_parallel_crash_test() {
ret void
}
void ddiscard(x) double x __attribute__((__unused__));
{}


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

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

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

LLVM IR (-O2):
define void @ddiscard(double %0) {
ret void
}
void free_assembler(void **block_jumps_table, int *block_jumps_number,
                    void **block_riprel_table, int *block_riprel_number) {}


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

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

LLVM IR (-O0):
define void @free_assembler(i8** %0, i32* %1, i8** %2, i32* %3) {
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8**
%8 = alloca i32*
store i8** %0, i8*** %5
store i32* %1, i32** %6
store i8** %2, i8*** %7
store i32* %3, i32** %8
ret void
}

LLVM IR (-O2):
define void @free_assembler(i8** nocapture %0, i32* nocapture %1, i8** nocapture %2, i32* nocapture %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hola Mundo\n");
  printf("Adios\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [11 x i8] c"Hola Mundo\00"
@str.2 = [6 x i8] c"Adios\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int *alloca(int);
int main() {
  int *x = alloca(sizeof(int));
  int *y = alloca(sizeof(int));
  *y = 1;
  while (*x > 0) {
    *x = *x - *y;
    *y = *y + 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x0,(%rax)
jle    1178 <main+0x68>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
sub    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1145 <main+0x35>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x4,%edi
call   1030 <alloca@plt>
mov    %rax,%rbx
mov    $0x4,%edi
call   1030 <alloca@plt>
movl   $0x1,(%rax)
mov    (%rbx),%ecx
test   %ecx,%ecx
jle    1151 <main+0x41>
mov    $0x1,%edx
nopl   0x0(%rax)
sub    %edx,%ecx
mov    %ecx,(%rbx)
mov    (%rax),%edx
add    $0x1,%edx
mov    %edx,(%rax)
mov    (%rbx),%ecx
test   %ecx,%ecx
jg     1140 <main+0x30>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @alloca(i32 4)
%2 = tail call i32* @alloca(i32 4)
store i32 1, i32* %2
%3 = load i32, i32* %1
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %13
5: ; preds = %0, %5
%6 = phi i32 [ %11, %5 ], [ %3, %0 ]
%7 = phi i32 [ %10, %5 ], [ 1, %0 ]
%8 = sub nsw i32 %6, %7
store i32 %8, i32* %1
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 0
br i1 %12, label %5, label %13
13: ; preds = %5, %0
ret i32 0
}
void pintarMenu() {}


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

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

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

LLVM IR (-O2):
define void @pintarMenu() {
ret void
}
void func(int i __attribute__((unused))) {}


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

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

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

LLVM IR (-O2):
define void @func(i32 %0) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pem_password_cb;
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ EVP_PKEY;

/* Variables and functions */
int do_pk8pkey_fp(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                  int /*<<< orphan*/, int, int /*<<< orphan*/ *, char *, int,
                  int /*<<< orphan*/ *, void *);
int PEM_write_PKCS8PrivateKey_nid(FILE *fp, EVP_PKEY *x, int nid, char *kstr,
                                  int klen, pem_password_cb *cb, void *u) {
  return do_pk8pkey_fp(fp, x, 0, nid, NULL, kstr, klen, cb, u);
}


x86 assembly (clang, -O0):
<PEM_write_PKCS8PrivateKey_nid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
mov    -0x20(%rbp),%r9
mov    -0x24(%rbp),%r11d
mov    -0x30(%rbp),%r10
mov    0x10(%rbp),%rax
xor    %edx,%edx
xor    %r8d,%r8d
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1030 <do_pk8pkey_fp@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PEM_write_PKCS8PrivateKey_nid>:
push   %rax
mov    %r9,%rax
mov    %r8d,%r10d
mov    %rcx,%r9
mov    %edx,%ecx
sub    $0x8,%rsp
xor    %edx,%edx
xor    %r8d,%r8d
push   0x18(%rsp)
push   %rax
push   %r10
call   1030 <do_pk8pkey_fp@plt>
add    $0x20,%rsp
pop    %rcx
ret

LLVM IR (-O0):
define i32 @PEM_write_PKCS8PrivateKey_nid(i32* %0, i32* %1, i32 %2, i8* %3, i32 %4, i32* %5, i8* %6) {
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i8*
store i32* %0, i32** %8
store i32* %1, i32** %9
store i32 %2, i32* %10
store i8* %3, i8** %11
store i32 %4, i32* %12
store i32* %5, i32** %13
store i8* %6, i8** %14
%15 = load i32*, i32** %8
%16 = load i32*, i32** %9
%17 = load i32, i32* %10
%18 = load i8*, i8** %11
%19 = load i32, i32* %12
%20 = load i32*, i32** %13
%21 = load i8*, i8** %14
%22 = call i32 @do_pk8pkey_fp(i32* %15, i32* %16, i32 0, i32 %17, i32* null, i8* %18, i32 %19, i32* %20, i8* %21)
ret i32 %22
}

LLVM IR (-O2):
define i32 @PEM_write_PKCS8PrivateKey_nid(i32* %0, i32* %1, i32 %2, i8* %3, i32 %4, i32* %5, i8* %6) {
%8 = tail call i32 @do_pk8pkey_fp(i32* %0, i32* %1, i32 0, i32 %2, i32* null, i8* %3, i32 %4, i32* %5, i8* %6)
ret i32 %8
}
/* Variables and functions */
int INT_MIN;
int mul3div4(int x) {
  int mul3 = x + (x << 1);
  int is_negative = mul3 & INT_MIN;
  is_negative && (mul3 = mul3 + 4 - 1);
  return mul3 >> 2;
}


x86 assembly (clang, -O0):
<mul3div4>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2ec9(%rip),%rcx
and    (%rcx),%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xd(%rbp)
je     1148 <mul3div4+0x48>
mov    -0x8(%rbp),%eax
add    $0x4,%eax
sub    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
mov    -0x8(%rbp),%eax
sar    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mul3div4>:
lea    (%rdi,%rdi,2),%ecx
mov    0x2ede(%rip),%rax
test   %ecx,(%rax)
lea    0x3(%rdi,%rdi,2),%eax
cmove  %ecx,%eax
sar    $0x2,%eax
ret

LLVM IR (-O0):
@INT_MIN = global i32 0
define i32 @mul3div4(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = shl i32 %6, 1
%8 = add nsw i32 %5, %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = load i32, i32* @INT_MIN
%11 = and i32 %9, %10
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %1
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 4
%17 = sub nsw i32 %16, 1
store i32 %17, i32* %3
%18 = icmp ne i32 %17, 0
br label %19
19: ; preds = %14, %1
%20 = phi i1 [ false, %1 ], [ %18, %14 ]
%21 = zext i1 %20 to i32
%22 = load i32, i32* %3
%23 = ashr i32 %22, 2
ret i32 %23
}

LLVM IR (-O2):
@INT_MIN = global i32 0
define i32 @mul3div4(i32 %0) {
%2 = mul i32 %0, 3
%3 = load i32, i32* @INT_MIN
%4 = and i32 %3, %2
%5 = icmp eq i32 %4, 0
%6 = add nsw i32 %2, 3
%7 = select i1 %5, i32 %2, i32 %6
%8 = ashr i32 %7, 2
ret i32 %8
}