xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ terminal_initialize();
int /*<<< orphan*/ terminal_writestring(char *);
void kernel_main() {
  terminal_initialize();
  terminal_writestring("Hello, kernel World!");
}


x86 assembly (clang, -O0):
<kernel_main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <terminal_initialize@plt>
lea    0xece(%rip),%rdi
call   1030 <terminal_writestring@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel_main>:
push   %rax
xor    %eax,%eax
call   1040 <terminal_initialize@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1030 <terminal_writestring@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Hello, kernel World!\00"
define void @kernel_main() {
%1 = call i32 (...) @terminal_initialize()
%2 = call i32 @terminal_writestring(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Hello, kernel World!\00"
define void @kernel_main() {
%1 = tail call i32 (...) @terminal_initialize()
%2 = tail call i32 @terminal_writestring(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
double timeval_diff(struct timeval *last_time, struct timeval *cur_time) {
  return (double)(cur_time->tv_sec - last_time->tv_sec) +
         (double)(cur_time->tv_usec - last_time->tv_usec) / 1e6;
}


x86 assembly (clang, -O0):
<timeval_diff>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x8(%rbp),%rcx
sub    0x8(%rcx),%rax
cvtsi2sd %rax,%xmm0
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x8(%rbp),%rcx
sub    (%rcx),%rax
cvtsi2sd %rax,%xmm1
movsd  0xec4(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<timeval_diff>:
mov    (%rsi),%rax
mov    0x8(%rsi),%rcx
sub    0x8(%rdi),%rcx
cvtsi2sd %rcx,%xmm1
sub    (%rdi),%rax
cvtsi2sd %rax,%xmm0
divsd  0xee0(%rip),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @timeval_diff(%struct.timeval* %0, %struct.timeval* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %3
store %struct.timeval* %1, %struct.timeval** %4
%5 = load %struct.timeval*, %struct.timeval** %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
%7 = load i64, i64* %6
%8 = load %struct.timeval*, %struct.timeval** %3
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 1
%10 = load i64, i64* %9
%11 = sub nsw i64 %7, %10
%12 = sitofp i64 %11 to double
%13 = load %struct.timeval*, %struct.timeval** %4
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 0
%15 = load i64, i64* %14
%16 = load %struct.timeval*, %struct.timeval** %3
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %16, i32 0, i32 0
%18 = load i64, i64* %17
%19 = sub nsw i64 %15, %18
%20 = sitofp i64 %19 to double
%21 = fdiv double %20, 1.000000e+06
%22 = fadd double %12, %21
ret double %22
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @timeval_diff(%struct.timeval* nocapture %0, %struct.timeval* nocapture %1) {
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%4 = load i64, i64* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%6 = load i64, i64* %5
%7 = sub nsw i64 %4, %6
%8 = sitofp i64 %7 to double
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%10 = load i64, i64* %9
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%12 = load i64, i64* %11
%13 = sub nsw i64 %10, %12
%14 = sitofp i64 %13 to double
%15 = fdiv double %14, 1.000000e+06
%16 = fadd double %15, %8
ret double %16
}
f(long a) { return (--a > 0); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
xor    %eax,%eax
cmp    $0x2,%rdi
setge  %al
ret

LLVM IR (-O0):
define i32 @f(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 %3, -1
store i64 %4, i64* %2
%5 = icmp sgt i64 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @f(i64 %0) {
%2 = icmp sgt i64 %0, 1
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ scrputs(char *);
void attrclr(void) { scrputs("\033[m"); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[m\00"
define void @attrclr() {
%1 = tail call i32 @scrputs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
double ops_solve(int n) { return 2.0 / 3.0 * n * n * n; }


x86 assembly (clang, -O0):
<ops_solve>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm1
movsd  0xeec(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
mulsd  %xmm1,%xmm0
cvtsi2sdl -0x4(%rbp),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ops_solve>:
cvtsi2sd %edi,%xmm1
movsd  0xef4(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @ops_solve(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = fmul double 0x3FE5555555555555, %4
%6 = load i32, i32* %2
%7 = sitofp i32 %6 to double
%8 = fmul double %5, %7
%9 = load i32, i32* %2
%10 = sitofp i32 %9 to double
%11 = fmul double %8, %10
ret double %11
}

LLVM IR (-O2):
define double @ops_solve(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fmul double %2, 0x3FE5555555555555
%4 = fmul double %3, %2
%5 = fmul double %4, %2
ret double %5
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int standard_Newton_Laurent_step(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(326, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<standard_Newton_Laurent_step>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x146,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<standard_Newton_Laurent_step>:
mov    $0x146,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @standard_Newton_Laurent_step() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc4c(i32 326, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @standard_Newton_Laurent_step() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 326, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
/* Variables and functions */
size_t strlen(const char *str) {
  int len = 0;
  for (const char *s = str; *s; s++) {
    len += 1;
  }
  return len;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     113e <strlen+0x3e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <strlen+0x17>
movslq -0xc(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111f <strlen+0x1f>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rcx),%rax
cmpb   $0x0,0x1(%rdi,%rcx,1)
mov    %rax,%rcx
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %6, label %8
4: ; preds = %8
%5 = zext i32 %11 to i64
br label %6
6: ; preds = %4, %1
%7 = phi i64 [ 0, %1 ], [ %5, %4 ]
ret i64 %7
8: ; preds = %1, %8
%9 = phi i8* [ %12, %8 ], [ %0, %1 ]
%10 = phi i32 [ %11, %8 ], [ 0, %1 ]
%11 = add nuw nsw i32 %10, 1
%12 = getelementptr inbounds i8, i8* %9, i64 1
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %4, label %8
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *buildLogSuffix() {
  char *suffix = malloc(sizeof(char) * strlen(".log"));
  strcpy(suffix, ".log");
  return suffix;
}


x86 assembly (clang, -O0):
<buildLogSuffix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1040 <strlen@plt>
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buildLogSuffix>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%r14
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c".log\00"
define i8* @buildLogSuffix() {
%1 = alloca i8*
%2 = call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = sext i32 %2 to i64
%4 = mul i64 1, %3
%5 = trunc i64 %4 to i32
%6 = call i8* @malloc(i32 %5)
store i8* %6, i8** %1
%7 = load i8*, i8** %1
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%9 = load i8*, i8** %1
ret i8* %9
}

LLVM IR (-O2):
@.str = [5 x i8] c".log\00"
define i8* @buildLogSuffix() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i8* @malloc(i32 %1)
%3 = tail call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %2
}
int test_imm_A7int8_mem(signed char *val) {
  return ((*val) & (-0xA7 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_A7int8_mem>:
movsbl (%rdi),%eax
test   $0xffffff59,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_A7int8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, -167
%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_A7int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -167
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char fgetc(int /*<<< orphan*/ *);
void dump_io(FILE *fd) {
  char c;
  while ((c = fgetc(fd)) != '\n' && c != '\0' && c != '\r')
    ;
}


x86 assembly (clang, -O0):
<dump_io>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %al,-0x9(%rbp)
movsbl %al,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0xa(%rbp)
je     1158 <dump_io+0x48>
movsbl -0x9(%rbp),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xa(%rbp)
je     1158 <dump_io+0x48>
movsbl -0x9(%rbp),%eax
cmp    $0xd,%eax
setne  %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
test   $0x1,%al
jne    1168 <dump_io+0x58>
jmp    116d <dump_io+0x5d>
jmp    111c <dump_io+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_io>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x2401,%r14d
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <fgetc@plt>
cmp    $0xd,%al
ja     1120 <dump_io+0x10>
movzbl %al,%eax
bt     %rax,%r14
jae    1120 <dump_io+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @dump_io(i32* %0) {
%2 = alloca i32*
%3 = alloca i8
store i32* %0, i32** %2
br label %4
4: ; preds = %19, %1
%5 = load i32*, i32** %2
%6 = call signext i8 @fgetc(i32* %5)
store i8 %6, i8* %3
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 10
br i1 %8, label %9, label %17
9: ; preds = %4
%10 = load i8, i8* %3
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i8, i8* %3
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 13
br label %17
17: ; preds = %13, %9, %4
%18 = phi i1 [ false, %9 ], [ false, %4 ], [ %16, %13 ]
br i1 %18, label %19, label %20
19: ; preds = %17
br label %4
20: ; preds = %17
ret void
}

LLVM IR (-O2):
define void @dump_io(i32* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call signext i8 @fgetc(i32* %0)
switch i8 %3, label %2 [
i8 13, label %4
i8 10, label %4
i8 0, label %4
]
4: ; preds = %2, %2, %2
ret void
}
int succ(int value) { return value + 1; }


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

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

LLVM IR (-O0):
define i32 @succ(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 @succ(i32 %0) {
%2 = add nsw i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void type_as_string() { abort(); }


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

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

LLVM IR (-O0):
define void @type_as_string() {
%1 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @type_as_string() {
%1 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ is_prime(int);
int run_optimized() {
  int b = 84 * 100 + 100000;
  int c = b + 17000;
  int h = 0;
  for (; b <= c; b += 17) {
    if (!is_prime(b)) {
      h += 1;
    }
  }
  return h;
}


x86 assembly (clang, -O0):
<run_optimized>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1a770,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4268,%eax
mov    %eax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     116a <run_optimized+0x5a>
mov    -0x4(%rbp),%edi
call   1030 <is_prime@plt>
cmp    $0x0,%eax
jne    1157 <run_optimized+0x47>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115c <run_optimized+0x4c>
mov    -0x4(%rbp),%eax
add    $0x11,%eax
mov    %eax,-0x4(%rbp)
jmp    1131 <run_optimized+0x21>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<run_optimized>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
mov    $0x1a75f,%ebp
nopw   0x0(%rax,%rax,1)
add    $0x11,%ebp
mov    %ebp,%edi
call   1030 <is_prime@plt>
cmp    $0x1,%eax
adc    $0x0,%ebx
cmp    $0x1e9c8,%ebp
jb     1120 <run_optimized+0x10>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @run_optimized() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %7, %1 ]
%3 = phi i32 [ 108400, %0 ], [ %8, %1 ]
%4 = tail call i32 @is_prime(i32 %3)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = add nuw nsw i32 %2, %6
%8 = add nuw nsw i32 %3, 17
%9 = icmp ult i32 %3, 125384
br i1 %9, label %1, label %10
10: ; preds = %1
ret i32 %7
}
void foo121(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo121(i32 %0) {
ret void
}
int test_imm_A5int32_mem(int *val) {
  return ((*val) & (0xA5 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_A5int32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 165
%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_A5int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 165
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
float dist3dsqrd(const float x, const float y, const float z) {
  return x * x + y * y + z * z;
}


x86 assembly (clang, -O0):
<dist3dsqrd>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x4(%rbp),%xmm2
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dist3dsqrd>:
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
mulss  %xmm2,%xmm2
addss  %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @dist3dsqrd(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %4
%9 = load float, float* %5
%10 = load float, float* %5
%11 = fmul float %9, %10
%12 = call float @llvm.fmuladd.f32(float %7, float %8, float %11)
%13 = load float, float* %6
%14 = load float, float* %6
%15 = call float @llvm.fmuladd.f32(float %13, float %14, float %12)
ret float %15
}

LLVM IR (-O2):
define float @dist3dsqrd(float %0, float %1, float %2) {
%4 = fmul float %1, %1
%5 = tail call float @llvm.fmuladd.f32(float %0, float %0, float %4)
%6 = tail call float @llvm.fmuladd.f32(float %2, float %2, float %5)
ret float %6
}
int tsize(int type) {
  if (type & 0x10)
    return 1;
  switch (type & 0x0f) {
  default:
    return 0;
  case 1:
    return 0;
  case 2:
    return 1;
  case 3:
    return 6;
  }
}


x86 assembly (clang, -O0):
<tsize>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x10,%eax
cmp    $0x0,%eax
je     1122 <tsize+0x22>
movl   $0x1,-0x4(%rbp)
jmp    1186 <tsize+0x86>
mov    -0x8(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     1167 <tsize+0x67>
jmp    1139 <tsize+0x39>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1173 <tsize+0x73>
jmp    114a <tsize+0x4a>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     117f <tsize+0x7f>
jmp    115b <tsize+0x5b>
movl   $0x0,-0x4(%rbp)
jmp    1186 <tsize+0x86>
movl   $0x0,-0x4(%rbp)
jmp    1186 <tsize+0x86>
movl   $0x1,-0x4(%rbp)
jmp    1186 <tsize+0x86>
movl   $0x6,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tsize>:
mov    $0x1,%eax
test   $0x10,%dil
jne    1121 <tsize+0x21>
and    $0xf,%edi
xor    %ecx,%ecx
cmp    $0x2,%edi
sete   %cl
cmp    $0x3,%edi
mov    $0x6,%eax
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @tsize(i32 %0) {
%2 = and i32 %0, 16
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %10
4: ; preds = %1
%5 = and i32 %0, 15
%6 = icmp eq i32 %5, 2
%7 = zext i1 %6 to i32
%8 = icmp eq i32 %5, 3
%9 = select i1 %8, i32 6, i32 %7
br label %10
10: ; preds = %4, %1
%11 = phi i32 [ 1, %1 ], [ %9, %4 ]
ret i32 %11
}
/* Variables and functions */
double snorm();
double sample_Nor(double mu, double si2) { return si2 * snorm() + mu; }


x86 assembly (clang, -O0):
<sample_Nor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1030 <snorm@plt>
movaps %xmm0,%xmm2
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sample_Nor>:
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1030 <snorm@plt>
mulsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @sample_Nor(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = call double (...) @snorm()
%7 = load double, double* %3
%8 = call double @llvm.fmuladd.f64(double %5, double %6, double %7)
ret double %8
}

LLVM IR (-O2):
define double @sample_Nor(double %0, double %1) {
%3 = tail call double (...) @snorm()
%4 = tail call double @llvm.fmuladd.f64(double %1, double %3, double %0)
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *zmalloc(size_t);
void *zcalloc(size_t num, size_t size) {
  size_t num_bytes = num * size;
  void *block = zmalloc(num_bytes);
  if (block == NULL)
    return (void *)block;
  memset(block, 0, num_bytes);
  return block;
}


x86 assembly (clang, -O0):
<zcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1040 <zmalloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1162 <zcalloc+0x42>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1179 <zcalloc+0x59>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zcalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
imul   %rsi,%rbx
mov    %rbx,%rdi
call   1040 <zmalloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     1148 <zcalloc+0x28>
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @zcalloc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i8* @zmalloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @memset(i8* %4, i32 0, i64 %3)
br label %8
8: ; preds = %2, %6
ret i8* %4
}
int average(int num1, int num2, int num3) {
  int add = num1 + num2 + num3;
  int avg = add / 3;
  return (avg);
}


x86 assembly (clang, -O0):
<average>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<average>:
add    %esi,%edi
add    %edx,%edi
movslq %edi,%rax
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @average(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %4
%10 = load i32, i32* %5
%11 = add nsw i32 %9, %10
%12 = load i32, i32* %6
%13 = add nsw i32 %11, %12
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = sdiv i32 %14, 3
store i32 %15, i32* %8
%16 = load i32, i32* %8
ret i32 %16
}

LLVM IR (-O2):
define i32 @average(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = add nsw i32 %4, %2
%6 = sdiv i32 %5, 3
ret i32 %6
}
void print(void *data) { printf("%s\n", data); }


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

x86 assembly (clang, -O2):
<print>:
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
define void @print(i8* nocapture %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UART1_RX_TX_DriverIRQHandler();
__attribute__((weak)) void UART1_RX_TX_IRQHandler(void) {
  UART1_RX_TX_DriverIRQHandler();
}


x86 assembly (clang, -O0):
<UART1_RX_TX_IRQHandler>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <UART1_RX_TX_DriverIRQHandler@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define weak void @UART1_RX_TX_IRQHandler() {
%1 = call i32 (...) @UART1_RX_TX_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @UART1_RX_TX_IRQHandler() {
%1 = tail call i32 (...) @UART1_RX_TX_DriverIRQHandler()
ret void
}
unsigned long int set_mode(unsigned long int ttmr, unsigned long int mode) {
  ttmr &= ~0xc0000000;
  ttmr |= mode & 0xc0000000;
  return ttmr;
}


x86 assembly (clang, -O0):
<set_mode>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
and    $0x3fffffff,%rax
mov    %rax,-0x8(%rbp)
movabs $0xc0000000,%rax
and    -0x10(%rbp),%rax
or     -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_mode>:
and    $0x3fffffff,%edi
and    $0xc0000000,%esi
lea    (%rsi,%rdi,1),%rax
ret

LLVM IR (-O0):
define i64 @set_mode(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = and i64 %5, 1073741823
store i64 %6, i64* %3
%7 = load i64, i64* %4
%8 = and i64 %7, 3221225472
%9 = load i64, i64* %3
%10 = or i64 %9, %8
store i64 %10, i64* %3
%11 = load i64, i64* %3
ret i64 %11
}

LLVM IR (-O2):
define i64 @set_mode(i64 %0, i64 %1) {
%3 = and i64 %0, 1073741823
%4 = and i64 %1, 3221225472
%5 = or i64 %4, %3
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ kb_wait_1();
int /*<<< orphan*/ kb_wait_2();
int /*<<< orphan*/ kb_wait_2_1();
int /*<<< orphan*/ kb_wait_2_2();
int /*<<< orphan*/ kb_wait_3();
int /*<<< orphan*/ kb_wait_4();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("begin\n");
  kb_wait_1();
  kb_wait_2();
  kb_wait_2_1();
  kb_wait_2_2();
  kb_wait_3();
  kb_wait_4();
  printf("end\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
call   1060 <printf@plt>
mov    $0x0,%al
call   1080 <kb_wait_1@plt>
mov    $0x0,%al
call   1030 <kb_wait_2@plt>
mov    $0x0,%al
call   1040 <kb_wait_2_1@plt>
mov    $0x0,%al
call   1090 <kb_wait_2_2@plt>
mov    $0x0,%al
call   1070 <kb_wait_3@plt>
mov    $0x0,%al
call   1050 <kb_wait_4@plt>
lea    0xe4b(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xe88(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1080 <kb_wait_1@plt>
xor    %eax,%eax
call   1030 <kb_wait_2@plt>
xor    %eax,%eax
call   1040 <kb_wait_2_1@plt>
xor    %eax,%eax
call   1090 <kb_wait_2_2@plt>
xor    %eax,%eax
call   1070 <kb_wait_3@plt>
xor    %eax,%eax
call   1060 <kb_wait_4@plt>
lea    0xe58(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"begin\0A\00"
@.str.1 = [5 x i8] c"end\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @kb_wait_1()
%4 = call i32 (...) @kb_wait_2()
%5 = call i32 (...) @kb_wait_2_1()
%6 = call i32 (...) @kb_wait_2_2()
%7 = call i32 (...) @kb_wait_3()
%8 = call i32 (...) @kb_wait_4()
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [6 x i8] c"begin\00"
@str.2 = [4 x i8] c"end\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @kb_wait_1()
%3 = tail call i32 (...) @kb_wait_2()
%4 = tail call i32 (...) @kb_wait_2_1()
%5 = tail call i32 (...) @kb_wait_2_2()
%6 = tail call i32 (...) @kb_wait_3()
%7 = tail call i32 (...) @kb_wait_4()
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
unsigned sizeint(int n) {
  unsigned size = (n < 0) ? 1 : 0;
  n = (n < 0) ? -n : n;
  if (n == 0) {
    ++size;
  }
  while (n > 0) {
    ++size;
    n /= 10;
  }
  return size;
}


x86 assembly (clang, -O0):
<sizeint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovl  %ecx,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1131 <sizeint+0x31>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1137 <sizeint+0x37>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1150 <sizeint+0x50>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1155 <sizeint+0x55>
cmpl   $0x0,-0x4(%rbp)
jle    117b <sizeint+0x7b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    1155 <sizeint+0x55>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sizeint>:
mov    %edi,%ecx
shr    $0x1f,%ecx
xor    %eax,%eax
test   %edi,%edi
sete   %al
add    %ecx,%eax
test   %edi,%edi
je     1134 <sizeint+0x34>
mov    %edi,%ecx
neg    %ecx
cmovs  %edi,%ecx
mov    $0xcccccccd,%edx
xchg   %ax,%ax
add    $0x1,%eax
mov    %ecx,%esi
imul   %rdx,%rsi
shr    $0x23,%rsi
cmp    $0x9,%ecx
mov    %esi,%ecx
ja     1120 <sizeint+0x20>
ret

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

LLVM IR (-O2):
define i32 @sizeint(i32 %0) {
%2 = lshr i32 %0, 31
%3 = icmp eq i32 %0, 0
%4 = zext i1 %3 to i32
%5 = add nuw nsw i32 %2, %4
br i1 %3, label %14, label %6
6: ; preds = %1
%7 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
br label %8
8: ; preds = %6, %8
%9 = phi i32 [ %11, %8 ], [ %5, %6 ]
%10 = phi i32 [ %12, %8 ], [ %7, %6 ]
%11 = add i32 %9, 1
%12 = udiv i32 %10, 10
%13 = icmp ult i32 %10, 10
br i1 %13, label %14, label %8
14: ; preds = %8, %1
%15 = phi i32 [ %5, %1 ], [ %11, %8 ]
ret i32 %15
}
main() {
  void *a;
la:
  a = &&la;
  goto la;
  goto *(a + 2);
  goto *a;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lea    -0x7(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    110b <main+0xb>

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
br label %3
3: ; preds = %3, %4, %0
store i8* blockaddress(@main, %3), i8** %2
br label %3
4: ; No predecessors!
indirectbr i8* undef, [label %3]
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int copy_standard_laursys_witset(int dim) {
  int *b;
  double *c;
  int fail = _ada_use_c2phc4c(852, &dim, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<copy_standard_laursys_witset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x354,%edi
lea    -0x4(%rbp),%rsi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_standard_laursys_witset>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x354,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @copy_standard_laursys_witset(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_ada_use_c2phc4c(i32 852, i32* %2, i32* undef, double* undef, i32 0)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ userMultiply();
int main(int argc, char *argv[]) {
  userMultiply();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <userMultiply@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @userMultiply()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @userMultiply()
ret i32 0
}
extern void SetULongLong(unsigned long long *llg) { *llg = 15324; }


x86 assembly (clang, -O0):
<SetULongLong>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movq   $0x3bdc,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SetULongLong>:
movq   $0x3bdc,(%rdi)
ret

LLVM IR (-O0):
define void @SetULongLong(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
store i64 15324, i64* %3
ret void
}

LLVM IR (-O2):
define void @SetULongLong(i64* nocapture writeonly %0) {
store i64 15324, i64* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isdigit(int);
void t_isdigit_0xd5() {
  Assert_real((isdigit(213) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isdigit.c",
              1070, ("isdigit should be 0 for 0xd5"));
}


x86 assembly (clang, -O0):
<t_isdigit_0xd5>:
push   %rbp
mov    %rsp,%rbp
mov    $0xd5,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x42e,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isdigit_0xd5>:
push   %rax
mov    $0xd5,%edi
call   1030 <isdigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x42e,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0xd5\00"
define void @t_isdigit_0xd5() {
%1 = call i64 @isdigit(i32 213)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1070, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isdigit.c\00"
@.str.1 = [29 x i8] c"isdigit should be 0 for 0xd5\00"
define void @t_isdigit_0xd5() {
%1 = tail call i64 @isdigit(i32 213)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1070, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void ARGBToRAW() {}


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

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

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

LLVM IR (-O2):
define void @ARGBToRAW() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ t1();
void main() { t1(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <t1@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @main() {
%1 = call i32 (...) @t1()
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @t1()
ret void
}
signed short f4(int x) { return x; }


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

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

LLVM IR (-O0):
define signext i16 @f4(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = trunc i32 %3 to i16
ret i16 %4
}

LLVM IR (-O2):
define signext i16 @f4(i32 %0) {
%2 = trunc i32 %0 to i16
ret i16 %2
}
int shrfunc1(int x) { return x + 4; }


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

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

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

LLVM IR (-O2):
define i32 @shrfunc1(i32 %0) {
%2 = add nsw i32 %0, 4
ret i32 %2
}
short return_short() { return 42; }


x86 assembly (clang, -O0):
<return_short>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2a,%ax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<return_short>:
mov    $0x2a,%ax
ret

LLVM IR (-O0):
define signext i16 @return_short() {
ret i16 42
}

LLVM IR (-O2):
define signext i16 @return_short() {
ret i16 42
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ printid(int);
int main() {
  int a = 4, b = 36, c;
  c = a << b;
  print("c 64");
  printid(c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x4,-0x8(%rbp)
movl   $0x24,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    %cl,%eax
mov    %eax,-0x10(%rbp)
lea    0xeb1(%rip),%rdi
call   1030 <print@plt>
mov    -0x10(%rbp),%edi
call   1040 <printid@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"c 64\00"
define i32 @main() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printid(i32 poison)
ret i32 0
}
int numeric(char c) { return '0' <= c && c <= '9'; }


x86 assembly (clang, -O0):
<numeric>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
xor    %eax,%eax
mov    $0x30,%ecx
cmp    %edx,%ecx
mov    %al,-0x2(%rbp)
jg     112d <numeric+0x2d>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<numeric>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @numeric(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sle i32 48, %4
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @numeric(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutexattr_t;

/* Variables and functions */
int __infer_nondet_int();
int pthread_mutexattr_destroy(pthread_mutexattr_t *attr) {
  if (attr == 0)
    while (1)
      ;
  return __infer_nondet_int();
}


x86 assembly (clang, -O0):
<pthread_mutexattr_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1131 <pthread_mutexattr_destroy+0x21>
jmp    112c <pthread_mutexattr_destroy+0x1c>
jmp    112c <pthread_mutexattr_destroy+0x1c>
mov    $0x0,%al
call   1030 <__infer_nondet_int@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_mutexattr_destroy>:
test   %rdi,%rdi
je     1120 <pthread_mutexattr_destroy+0x10>
xor    %eax,%eax
jmp    1030 <__infer_nondet_int@plt>
nopl   0x0(%rax)
jmp    1120 <pthread_mutexattr_destroy+0x10>

LLVM IR (-O0):
define i32 @pthread_mutexattr_destroy(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
br label %6
6: ; preds = %5, %6
br label %6
7: ; preds = %1
%8 = call i32 (...) @__infer_nondet_int()
ret i32 %8
}

LLVM IR (-O2):
define i32 @pthread_mutexattr_destroy(i32* readnone %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %3, label %4
3: ; preds = %1, %3
br label %3
4: ; preds = %1
%5 = tail call i32 (...) @__infer_nondet_int()
ret i32 %5
}
/* Variables and functions */
void *malloc(int);
void *stb__arr_malloc(int size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<stb__arr_malloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @stb__arr_malloc(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *, float *, int *);
int main(void) {
  int i1, i2;
  float f1;
  scanf("%d%f%d", &i1, &f1, &i2);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xee5(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1030 <scanf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d%f%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %2, float* %4, i32* %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d%f%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast float* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, float* %3, i32* %2)
ret i32 0
}