xunge/DecIR huggingface dataset:
/* Variables and functions */
int *malloc(int const);
int /*<<< orphan*/ printf(char *, int, int);
void test1() {
  const int HEIGHTS = 3;
  int *heights = malloc(HEIGHTS);
  for (int i = 0; i < HEIGHTS; i++) {
    heights[i] = i * i;
    printf("%d: %d\n", i, heights[i]);
  }
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x3,-0x4(%rbp)
mov    $0x3,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jge    1188 <test1+0x68>
mov    -0x14(%rbp),%edx
imul   -0x14(%rbp),%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <test1+0x24>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %rbx
mov    $0x3,%edi
call   1040 <malloc@plt>
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x4,%edx
pop    %rbx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"%d: %d\0A\00"
define void @test1() {
%1 = tail call i32* @malloc(i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 1, i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 2, i32 4)
ret void
}
int bkl_eng_mode2_read(void *buf, unsigned int sizeMax) { return 0; }


x86 assembly (clang, -O0):
<bkl_eng_mode2_read>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @bkl_eng_mode2_read(i8* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ err(int, char *, char *);
int /*<<< orphan*/ *fopen(char *, char *);
FILE *opn(char *p) {
  FILE *fd;
  if ((fd = fopen(p, "r")) == NULL)
    err(1, "fopen %s", p);
  return fd;
}


x86 assembly (clang, -O0):
<opn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    115f <opn+0x3f>
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
lea    0xea8(%rip),%rsi
call   1030 <err@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<opn>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xed2(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    114f <opn+0x2f>
lea    0xec0(%rip),%rsi
mov    $0x1,%edi
mov    %r14,%rdx
call   1030 <err@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [9 x i8] c"fopen %s\00"
define noalias i32* @opn(i8* %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @err(i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %6
6: ; preds = %4, %1
ret i32* %2
}
/* Variables and functions */
int /*<<< orphan*/ __VERIFIER_assert(int);
int __VERIFIER_nondet_int();
int lt(int, int);
int main() {
  int x = __VERIFIER_nondet_int();
  int b = lt(x, 1000);
  __VERIFIER_assert(b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x3e8,%esi
call   1050 <lt@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <__VERIFIER_assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,%edi
mov    $0x3e8,%esi
call   1050 <lt@plt>
mov    %eax,%edi
call   1040 <__VERIFIER_assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @lt(i32 %5, i32 1000)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @__VERIFIER_assert(i32 %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 @lt(i32 %1, i32 1000)
%3 = tail call i32 @__VERIFIER_assert(i32 %2)
ret i32 0
}
void _on_trigger(void) {}


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

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

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

LLVM IR (-O2):
define void @_on_trigger() {
ret void
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
float getSpendTime(struct timeval timestart, struct timeval timeend) {
  return ((1000000 * (timeend.tv_sec - timestart.tv_sec) + timeend.tv_usec -
           timestart.tv_usec) /
          1000000);
}


x86 assembly (clang, -O0):
<getSpendTime>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    -0x8(%rbp),%eax
imul   $0xf4240,%eax,%eax
add    -0xc(%rbp),%eax
sub    -0x4(%rbp),%eax
mov    $0xf4240,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSpendTime>:
mov    %rsi,%rax
sub    %edi,%esi
shr    $0x20,%rdi
shr    $0x20,%rax
imul   $0xf4240,%esi,%ecx
sub    %edi,%eax
add    %ecx,%eax
cltq
imul   $0x431bde83,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x32,%rax
add    %ecx,%eax
cvtsi2ss %eax,%xmm0
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define float @getSpendTime(i64 %0, i64 %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = bitcast %struct.timeval* %3 to i64*
store i64 %0, i64* %5
%6 = bitcast %struct.timeval* %4 to i64*
store i64 %1, i64* %6
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%10 = load i32, i32* %9
%11 = sub nsw i32 %8, %10
%12 = mul nsw i32 1000000, %11
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 1
%14 = load i32, i32* %13
%15 = add nsw i32 %12, %14
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%17 = load i32, i32* %16
%18 = sub nsw i32 %15, %17
%19 = sdiv i32 %18, 1000000
%20 = sitofp i32 %19 to float
ret float %20
}

LLVM IR (-O2):
define float @getSpendTime(i64 %0, i64 %1) {
%3 = trunc i64 %0 to i32
%4 = lshr i64 %0, 32
%5 = trunc i64 %4 to i32
%6 = trunc i64 %1 to i32
%7 = lshr i64 %1, 32
%8 = trunc i64 %7 to i32
%9 = sub nsw i32 %6, %3
%10 = mul nsw i32 %9, 1000000
%11 = sub i32 %8, %5
%12 = add i32 %11, %10
%13 = sdiv i32 %12, 1000000
%14 = sitofp i32 %13 to float
ret float %14
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int *);
int /*<<< orphan*/ sprintf(char *, char *, int, int *);
void check_writeback_specifier() {
  int x;
  char *b;
  printf("%n", &x);
  sprintf(b, "%d%%%n", 1, &x);
}


x86 assembly (clang, -O0):
<check_writeback_specifier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed5(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x1,%edx
lea    -0x4(%rbp),%rcx
call   1040 <sprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_writeback_specifier>:
push   %rbx
sub    $0x10,%rsp
lea    0xed8(%rip),%rdi
lea    0xc(%rsp),%rbx
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xec0(%rip),%rsi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <sprintf@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%n\00"
@.str.1 = [7 x i8] c"%d%%%n\00"
define void @check_writeback_specifier() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = call i32 @sprintf(i8* dereferenceable(1) undef, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 1, i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
void Eelif(void) { error("Inappropriate #elif"); }


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"Inappropriate #elif\00"
define void @Eelif() {
%1 = call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"Inappropriate #elif\00"
define void @Eelif() {
%1 = tail call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret void
}
double mydeg2rad(double deg) { return deg * 3.14159265358979323846 / 180.; }


x86 assembly (clang, -O0):
<mydeg2rad>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @mydeg2rad(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 0x400921FB54442D18
%5 = fdiv double %4, 1.800000e+02
ret double %5
}

LLVM IR (-O2):
define double @mydeg2rad(double %0) {
%2 = fmul double %0, 0x400921FB54442D18
%3 = fdiv double %2, 1.800000e+02
ret double %3
}
/* Variables and functions */
scalar_t__ strcmp(char const *, char const *);
int strings_are_equal(const char *tried, const char *expected) {
  if ((tried == NULL) || (expected == NULL)) {
    return (tried == expected);
  } else {
    return (strcmp(tried, expected) == 0);
  }
}


x86 assembly (clang, -O0):
<strings_are_equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1136 <strings_are_equal+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    114e <strings_are_equal+0x3e>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    116a <strings_are_equal+0x5a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strings_are_equal>:
test   %rdi,%rdi
je     112e <strings_are_equal+0x1e>
test   %rsi,%rsi
je     112e <strings_are_equal+0x1e>
push   %rax
call   1030 <strcmp@plt>
test   %rax,%rax
sete   %al
add    $0x8,%rsp
movzbl %al,%eax
ret
cmp    %rsi,%rdi
sete   %al
movzbl %al,%eax
ret

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

LLVM IR (-O2):
define i32 @strings_are_equal(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = or i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = icmp eq i8* %0, %1
br label %11
8: ; preds = %2
%9 = tail call i64 @strcmp(i8* %0, i8* %1)
%10 = icmp eq i64 %9, 0
br label %11
11: ; preds = %8, %6
%12 = phi i1 [ %7, %6 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Variables and functions */
char *base64_encode_imp(char *, size_t, int);
char *base64_encode(char *data, size_t data_size) {
  return base64_encode_imp(data, data_size, true);
}


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

x86 assembly (clang, -O2):
<base64_encode>:
mov    $0x1,%edx
jmp    1030 <base64_encode_imp@plt>

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

LLVM IR (-O2):
define i8* @base64_encode(i8* %0, i64 %1) {
%3 = tail call i8* @base64_encode_imp(i8* %0, i64 %1, i32 1)
ret i8* %3
}
/* Type definitions */
typedef scalar_t__ ssize_t;

/* Variables and functions */
scalar_t__ read(int, void *, size_t);
void read_assert(int fd, void *buf, size_t count) {
  ssize_t a = read(fd, buf, count);
  if (a < 0) {
  }
}


x86 assembly (clang, -O0):
<read_assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <read@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jge    1147 <read_assert+0x37>
jmp    1147 <read_assert+0x37>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_assert>:
jmp    1030 <read@plt>

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

LLVM IR (-O2):
define void @read_assert(i32 %0, i8* nocapture %1, i64 %2) {
%4 = tail call i64 @read(i32 %0, i8* %1, i64 %2)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint64_t;

/* Variables and functions */
uint8_t isSwapped(uint64_t v) { return ((v >> 62) & 1); }


x86 assembly (clang, -O0):
<isSwapped>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e,%ecx
sar    %cl,%eax
and    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @isSwapped(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 62
%5 = and i32 %4, 1
ret i32 %5
}

LLVM IR (-O2):
define i32 @isSwapped(i32 %0) {
ret i32 poison
}
int sectorsPerCluster(char one) {
  int b = one;
  return b;
}


x86 assembly (clang, -O0):
<sectorsPerCluster>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @sectorsPerCluster(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @sectorsPerCluster(i8 signext %0) {
%2 = sext i8 %0 to i32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ m_put(int, char *);
void m_putc(int m, char c) { m_put(m, &c); }


x86 assembly (clang, -O0):
<m_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x5(%rbp),%rsi
call   1030 <m_put@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m_putc>:
push   %rax
mov    %sil,0x7(%rsp)
lea    0x7(%rsp),%rsi
call   1030 <m_put@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @m_putc(i32 %0, i8 signext %1) {
%3 = alloca i8
store i8 %1, i8* %3
%4 = call i32 @m_put(i32 %0, i8* %3)
ret void
}
/* Variables and functions */
short getdosmemword(int);
int PDC_get_cursor_mode() {
  short cmode = 0;
  cmode = getdosmemword(0x460);
  return (cmode);
}


x86 assembly (clang, -O0):
<PDC_get_cursor_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movw   $0x0,-0x2(%rbp)
mov    $0x460,%edi
call   1030 <getdosmemword@plt>
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PDC_get_cursor_mode>:
push   %rax
mov    $0x460,%edi
call   1030 <getdosmemword@plt>
cwtl
pop    %rcx
ret

LLVM IR (-O0):
define i32 @PDC_get_cursor_mode() {
%1 = alloca i16
store i16 0, i16* %1
%2 = call signext i16 @getdosmemword(i32 1120)
store i16 %2, i16* %1
%3 = load i16, i16* %1
%4 = sext i16 %3 to i32
ret i32 %4
}

LLVM IR (-O2):
define i32 @PDC_get_cursor_mode() {
%1 = tail call signext i16 @getdosmemword(i32 1120)
%2 = sext i16 %1 to i32
ret i32 %2
}
int do_113() { return 113; }


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

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

LLVM IR (-O0):
define i32 @do_113() {
ret i32 113
}

LLVM IR (-O2):
define i32 @do_113() {
ret i32 113
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
uint64_t scalar_hamming_weight(uint64_t x) {
  x -= (x >> 1) & 0x5555555555555555;
  x = ((x >> 2) & 0x3333333333333333) + (x & 0x3333333333333333);
  x += x >> 4;
  x &= 0x0f0f0f0f0f0f0f0f;
  x *= 0x0101010101010101;
  return x >> 56;
}


x86 assembly (clang, -O0):
<scalar_hamming_weight>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
movslq %eax,%rcx
movabs $0x5555555555555555,%rax
55 55 55
and    %rax,%rcx
movslq -0x4(%rbp),%rax
sub    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
cltq
movabs $0x3333333333333333,%rcx
33 33 33
and    %rcx,%rax
movslq -0x4(%rbp),%rcx
movabs $0x3333333333333333,%rdx
33 33 33
and    %rdx,%rcx
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0xf0f0f0f0f0f0f0f,%rcx
0f 0f 0f
and    %rcx,%rax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movabs $0x101010101010101,%rcx
01 01 01
imul   %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x38,%ecx
sar    %cl,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @scalar_hamming_weight(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 1
%5 = sext i32 %4 to i64
%6 = and i64 %5, 6148914691236517205
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = sub nsw i64 %8, %6
%10 = trunc i64 %9 to i32
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = ashr i32 %11, 2
%13 = sext i32 %12 to i64
%14 = and i64 %13, 3689348814741910323
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = and i64 %16, 3689348814741910323
%18 = add nsw i64 %14, %17
%19 = trunc i64 %18 to i32
store i32 %19, i32* %2
%20 = load i32, i32* %2
%21 = ashr i32 %20, 4
%22 = load i32, i32* %2
%23 = add nsw i32 %22, %21
store i32 %23, i32* %2
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = and i64 %25, 1085102592571150095
%27 = trunc i64 %26 to i32
store i32 %27, i32* %2
%28 = load i32, i32* %2
%29 = sext i32 %28 to i64
%30 = mul nsw i64 %29, 72340172838076673
%31 = trunc i64 %30 to i32
store i32 %31, i32* %2
%32 = load i32, i32* %2
%33 = ashr i32 %32, 56
ret i32 %33
}

LLVM IR (-O2):
define i32 @scalar_hamming_weight(i32 %0) {
ret i32 poison
}
void RasterAutoUnderFlowDisable(unsigned int baseAddr) {
  (*((volatile unsigned int *)(baseAddr + (0x4)))) &= ~(0x00000002u);
}


x86 assembly (clang, -O0):
<RasterAutoUnderFlowDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xfffffffd,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RasterAutoUnderFlowDisable>:
add    $0x4,%edi
andl   $0xfffffffd,(%rdi)
ret

LLVM IR (-O0):
define void @RasterAutoUnderFlowDisable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, 4
%5 = zext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = and i32 %7, -3
store volatile i32 %8, i32* %6
ret void
}

LLVM IR (-O2):
define void @RasterAutoUnderFlowDisable(i32 %0) {
%2 = add i32 %0, 4
%3 = zext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = and i32 %5, -3
store volatile i32 %6, i32* %4
ret void
}
char *strcat(char *c, const char *s) {
  char *ret = c;
  while (*c)
    c++;
  while (*s)
    *c++ = *s++;
  *c = '\0';
  return ret;
}


x86 assembly (clang, -O0):
<strcat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1132 <strcat+0x32>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1114 <strcat+0x14>
jmp    1137 <strcat+0x37>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     116b <strcat+0x6b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
jmp    1137 <strcat+0x37>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcat>:
mov    %rdi,%rax
mov    %rdi,%rcx
cs nopw 0x0(%rax,%rax,1)
mov    %rcx,%rdi
add    $0x1,%rcx
cmpb   $0x0,(%rdi)
jne    1110 <strcat+0x10>
mov    (%rsi),%dl
test   %dl,%dl
je     1146 <strcat+0x46>
mov    $0xffffffffffffffff,%rdi
nopl   0x0(%rax)
mov    %dl,(%rcx,%rdi,1)
movzbl 0x2(%rsi,%rdi,1),%edx
add    $0x1,%rdi
test   %dl,%dl
jne    1130 <strcat+0x30>
add    %rdi,%rcx
mov    %rcx,%rdi
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define i8* @strcat(i8* returned %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = load i8, i8* %1
%10 = icmp eq i8 %9, 0
br i1 %10, label %19, label %11
11: ; preds = %8, %11
%12 = phi i8 [ %17, %11 ], [ %9, %8 ]
%13 = phi i8* [ %16, %11 ], [ %4, %8 ]
%14 = phi i8* [ %15, %11 ], [ %1, %8 ]
%15 = getelementptr inbounds i8, i8* %14, i64 1
%16 = getelementptr inbounds i8, i8* %13, i64 1
store i8 %12, i8* %13
%17 = load i8, i8* %15
%18 = icmp eq i8 %17, 0
br i1 %18, label %19, label %11
19: ; preds = %11, %8
%20 = phi i8* [ %4, %8 ], [ %16, %11 ]
store i8 0, i8* %20
ret i8* %0
}
void dump_spd_registers(void) {}


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

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

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

LLVM IR (-O2):
define void @dump_spd_registers() {
ret void
}
/* Type definitions */
struct yaffs_dev {
  int dummy;
};

/* Variables and functions */
int yaffs_format_common(struct yaffs_dev *, int /*<<< orphan*/, int, int, int);
int yaffs_format_reldev(struct yaffs_dev *dev, int unmount_flag,
                        int force_unmount_flag, int remount_flag) {
  return yaffs_format_common(dev, (0), unmount_flag, force_unmount_flag,
                             remount_flag);
}


x86 assembly (clang, -O0):
<yaffs_format_reldev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
xor    %esi,%esi
call   1030 <yaffs_format_common@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yaffs_format_reldev>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
xor    %esi,%esi
jmp    1030 <yaffs_format_common@plt>

LLVM IR (-O0):
%struct.yaffs_dev = type { i32 }
define i32 @yaffs_format_reldev(%struct.yaffs_dev* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca %struct.yaffs_dev*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store %struct.yaffs_dev* %0, %struct.yaffs_dev** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load %struct.yaffs_dev*, %struct.yaffs_dev** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = call i32 @yaffs_format_common(%struct.yaffs_dev* %9, i32 0, i32 %10, i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.yaffs_dev = type { i32 }
define i32 @yaffs_format_reldev(%struct.yaffs_dev* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @yaffs_format_common(%struct.yaffs_dev* %0, i32 0, i32 %1, i32 %2, i32 %3)
ret i32 %5
}
long int longint_ignoring_longdouble(long int x, long double y) { return x; }


x86 assembly (clang, -O0):
<longint_ignoring_longdouble>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
mov    %rdi,-0x8(%rbp)
fstpt  -0x20(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<longint_ignoring_longdouble>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @longint_ignoring_longdouble(i64 %0, x86_fp80 %1) {
%3 = alloca i64
%4 = alloca x86_fp80
store i64 %0, i64* %3
store x86_fp80 %1, x86_fp80* %4
%5 = load i64, i64* %3
ret i64 %5
}

LLVM IR (-O2):
define i64 @longint_ignoring_longdouble(i64 returned %0, x86_fp80 %1) {
ret i64 %0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *xmalloc(size_t size) {
  void *t;
  t = malloc(size);
  if (t == NULL) {
    fprintf(stderr, "Could not allocate memory\n");
    exit(1);
  }
  return t;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1173 <xmalloc+0x43>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <xmalloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [27 x i8] c"Could not allocate memory\0A\00"
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [27 x i8] c"Could not allocate memory\0A\00"
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void Section4Second(int number) { printf(" %d |", number % 1000 / 100); }


x86 assembly (clang, -O0):
<Section4Second>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Section4Second>:
movslq %edi,%rax
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x26,%rcx
add    %edx,%ecx
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
cwtl
imul   $0x147b,%eax,%esi
mov    %esi,%eax
shr    $0x1f,%eax
sar    $0x13,%esi
add    %eax,%esi
lea    0xeb9(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c" %d |\00"
define void @Section4Second(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 1000
%5 = sdiv i32 %4, 100
%6 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c" %d |\00"
define void @Section4Second(i32 %0) {
%2 = srem i32 %0, 1000
%3 = trunc i32 %2 to i16
%4 = sdiv i16 %3, 100
%5 = sext i16 %4 to i32
%6 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo();
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ write(int, char *, int);
int main(void) {
  char *y;
  write(1, "A\n", 2);
  foo();
  write(1, "B\n", 2);
  y = malloc(8);
  write(1, "C\n", 2);
  free(y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
lea    0xea5(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    $0x0,%al
call   1060 <foo@plt>
mov    $0x1,%edi
lea    0xe8b(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x1,%edi
lea    0xe6a(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeb8(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1040 <write@plt>
xor    %eax,%eax
call   1060 <foo@plt>
lea    0xe9e(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1040 <write@plt>
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xe7e(%rip),%rsi
mov    $0x1,%edi
mov    $0x2,%edx
call   1040 <write@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"A\0A\00"
@.str.1 = [3 x i8] c"B\0A\00"
@.str.2 = [3 x i8] c"C\0A\00"
define i32 @main() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
%2 = tail call i32 (...) @foo()
%3 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 2)
%4 = tail call dereferenceable_or_null(8) i8* @malloc(i32 8)
%5 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 2)
%6 = tail call i32 @free(i8* %4)
ret i32 0
}
double ellipseFunc(double i, double j, double x, double y, double a, double b) {
  {
    return ((double)1 -
            (((x - i) * (x - i)) / (a * a) + ((y - j) * (y - j)) / (b * b)));
  }
}


x86 assembly (clang, -O0):
<ellipseFunc>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm1
subsd  -0x8(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
subsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
movsd  -0x30(%rbp),%xmm2
mulsd  -0x30(%rbp),%xmm2
divsd  %xmm2,%xmm0
addsd  %xmm0,%xmm1
movsd  0xe86(%rip),%xmm0
subsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ellipseFunc>:
unpcklpd %xmm3,%xmm2
unpcklpd %xmm1,%xmm0
subpd  %xmm0,%xmm2
mulpd  %xmm2,%xmm2
unpcklpd %xmm5,%xmm4
mulpd  %xmm4,%xmm4
divpd  %xmm4,%xmm2
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
addsd  %xmm2,%xmm1
movsd  0xed0(%rip),%xmm0
subsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @ellipseFunc(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store double %5, double* %12
%13 = load double, double* %9
%14 = load double, double* %7
%15 = fsub double %13, %14
%16 = load double, double* %9
%17 = load double, double* %7
%18 = fsub double %16, %17
%19 = fmul double %15, %18
%20 = load double, double* %11
%21 = load double, double* %11
%22 = fmul double %20, %21
%23 = fdiv double %19, %22
%24 = load double, double* %10
%25 = load double, double* %8
%26 = fsub double %24, %25
%27 = load double, double* %10
%28 = load double, double* %8
%29 = fsub double %27, %28
%30 = fmul double %26, %29
%31 = load double, double* %12
%32 = load double, double* %12
%33 = fmul double %31, %32
%34 = fdiv double %30, %33
%35 = fadd double %23, %34
%36 = fsub double 1.000000e+00, %35
ret double %36
}

LLVM IR (-O2):
define double @ellipseFunc(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = insertelement <2 x double> poison, double %2, i64 0
%8 = insertelement <2 x double> %7, double %3, i64 1
%9 = insertelement <2 x double> poison, double %0, i64 0
%10 = insertelement <2 x double> %9, double %1, i64 1
%11 = fsub <2 x double> %8, %10
%12 = fmul <2 x double> %11, %11
%13 = insertelement <2 x double> poison, double %4, i64 0
%14 = insertelement <2 x double> %13, double %5, i64 1
%15 = fmul <2 x double> %14, %14
%16 = fdiv <2 x double> %12, %15
%17 = shufflevector <2 x double> %16, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%18 = fadd <2 x double> %16, %17
%19 = extractelement <2 x double> %18, i64 0
%20 = fsub double 1.000000e+00, %19
ret double %20
}
/* Variables and functions */
int /*<<< orphan*/ image_ppm(double *, char *);
void image(double *f, char *fname) {
  image_ppm(f, fname);
  return;
}


x86 assembly (clang, -O0):
<image>:
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 <image_ppm@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<image>:
jmp    1030 <image_ppm@plt>

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

LLVM IR (-O2):
define void @image(double* %0, i8* %1) {
%3 = tail call i32 @image_ppm(double* %0, i8* %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *_popen(char const *, char *);
FILE *piperead(const char *cmd) { return _popen(cmd, "r"); }


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

x86 assembly (clang, -O2):
<piperead>:
lea    0xee9(%rip),%rsi
jmp    1030 <_popen@plt>

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

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
define i32* @piperead(i8* %0) {
%2 = tail call i32* @_popen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
__attribute__((hotpatch(1000000, 1000000))) void hp2(void) {
  printf("hello, world!\n");
}


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"hello, world!\00"
define void @hp2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
int f0(int x, int y, int z __attribute__((unused))) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @f0(i32 returned %0, i32 %1, i32 %2) {
ret i32 %0
}
unsigned int mb_ver(void) {
  return ((1 * 0x01000000) + (1 * 0x00010000) + (54));
}


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

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

LLVM IR (-O0):
define i32 @mb_ver() {
ret i32 16842806
}

LLVM IR (-O2):
define i32 @mb_ver() {
ret i32 16842806
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("hello, world.\n");
  return 112;
}


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"hello, world.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 112
}
/* Variables and functions */
int /*<<< orphan*/ ns2sphere(float, float, float, float, float, float, float);
void ns2sphere_(float *x, float *y, float *z, float *r, float *red,
                float *green, float *blue) {
  ns2sphere(*x, *y, *z, *r, *red, *green, *blue);
}


x86 assembly (clang, -O0):
<ns2sphere_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm3
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm4
mov    -0x30(%rbp),%rax
movss  (%rax),%xmm5
mov    0x10(%rbp),%rax
movss  (%rax),%xmm6
call   1030 <ns2sphere@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ns2sphere_>:
mov    0x8(%rsp),%rax
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
movss  (%rdx),%xmm2
movss  (%rcx),%xmm3
movss  (%r8),%xmm4
movss  (%r9),%xmm5
movss  (%rax),%xmm6
jmp    1030 <ns2sphere@plt>

LLVM IR (-O0):
define void @ns2sphere_(float* %0, float* %1, float* %2, float* %3, float* %4, float* %5, float* %6) {
%8 = alloca float*
%9 = alloca float*
%10 = alloca float*
%11 = alloca float*
%12 = alloca float*
%13 = alloca float*
%14 = alloca float*
store float* %0, float** %8
store float* %1, float** %9
store float* %2, float** %10
store float* %3, float** %11
store float* %4, float** %12
store float* %5, float** %13
store float* %6, float** %14
%15 = load float*, float** %8
%16 = load float, float* %15
%17 = load float*, float** %9
%18 = load float, float* %17
%19 = load float*, float** %10
%20 = load float, float* %19
%21 = load float*, float** %11
%22 = load float, float* %21
%23 = load float*, float** %12
%24 = load float, float* %23
%25 = load float*, float** %13
%26 = load float, float* %25
%27 = load float*, float** %14
%28 = load float, float* %27
%29 = call i32 @ns2sphere(float %16, float %18, float %20, float %22, float %24, float %26, float %28)
ret void
}

LLVM IR (-O2):
define void @ns2sphere_(float* nocapture %0, float* nocapture %1, float* nocapture %2, float* nocapture %3, float* nocapture %4, float* nocapture %5, float* nocapture %6) {
%8 = load float, float* %0
%9 = load float, float* %1
%10 = load float, float* %2
%11 = load float, float* %3
%12 = load float, float* %4
%13 = load float, float* %5
%14 = load float, float* %6
%15 = tail call i32 @ns2sphere(float %8, float %9, float %10, float %11, float %12, float %13, float %14)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getprogname();
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "usage: %s [-bs] [-w width] [file ...]\n",
                getprogname());
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xea8(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xeb8(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [39 x i8] c"usage: %s [-bs] [-w width] [file ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i8* (...) @getprogname()
%3 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [39 x i8] c"usage: %s [-bs] [-w width] [file ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i8* (...) @getprogname()
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ panic(char *);
void overflow_trap(void) { panic("exception(trap): overflow"); }


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"exception(trap): overflow\00"
define void @overflow_trap() {
%1 = call i32 @panic(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"exception(trap): overflow\00"
define void @overflow_trap() {
%1 = tail call i32 @panic(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_imm_B3int8_reg(signed char val) {
  return ((val) & (0xB3 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B3int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xb3,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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