xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int bitselect(int const, int);
uint64_t bitselectv(const uint64_t val, int ignore, int rank) {
  return bitselect(val & ~((ignore % 64) == 64 ? 0xffffffffffffffff
                                               : ((1ULL << (ignore % 64)) - 1)),
                   rank);
}


x86 assembly (clang, -O0):
<bitselectv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
cmp    $0x40,%edx
jne    114d <bitselectv+0x3d>
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    116c <bitselectv+0x5c>
mov    -0x8(%rbp),%eax
mov    $0x40,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
sub    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
xor    $0xffffffffffffffff,%rcx
and    %rcx,%rax
mov    %eax,%edi
mov    -0xc(%rbp),%esi
call   1030 <bitselect@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitselectv>:
mov    %esi,%ecx
lea    0x3f(%rcx),%eax
test   %esi,%esi
cmovns %esi,%eax
and    $0xc0,%eax
sub    %eax,%ecx
mov    $0xffffffffffffffff,%rax
shl    %cl,%rax
and    %eax,%edi
mov    %edx,%esi
jmp    1030 <bitselect@plt>

LLVM IR (-O0):
define i32 @bitselectv(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = load i32, i32* %5
%10 = srem i32 %9, 64
%11 = icmp eq i32 %10, 64
br i1 %11, label %12, label %13
12: ; preds = %3
br label %19
13: ; preds = %3
%14 = load i32, i32* %5
%15 = srem i32 %14, 64
%16 = zext i32 %15 to i64
%17 = shl i64 1, %16
%18 = sub i64 %17, 1
br label %19
19: ; preds = %13, %12
%20 = phi i64 [ -1, %12 ], [ %18, %13 ]
%21 = xor i64 %20, -1
%22 = and i64 %8, %21
%23 = trunc i64 %22 to i32
%24 = load i32, i32* %6
%25 = call i32 @bitselect(i32 %23, i32 %24)
ret i32 %25
}

LLVM IR (-O2):
define i32 @bitselectv(i32 %0, i32 %1, i32 %2) {
%4 = srem i32 %1, 64
%5 = zext i32 %4 to i64
%6 = shl nsw i64 -1, %5
%7 = trunc i64 %6 to i32
%8 = and i32 %7, %0
%9 = tail call i32 @bitselect(i32 %8, i32 %2)
ret i32 %9
}
void RTPathQueryInfoEx(void) {}


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

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

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

LLVM IR (-O2):
define void @RTPathQueryInfoEx() {
ret void
}
void asm_mb(void) { __asm__ __volatile__("" ::: "memory"); }


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

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

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

LLVM IR (-O2):
define void @asm_mb() {
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
int rsquigle(char c) { return c == '}'; }


x86 assembly (clang, -O0):
<rsquigle>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x7d,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rsquigle>:
xor    %eax,%eax
cmp    $0x7d,%dil
sete   %al
ret

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

LLVM IR (-O2):
define i32 @rsquigle(i8 signext %0) {
%2 = icmp eq i8 %0, 125
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
double time_now();
double time_since_replace(double *time) {
  double new = time_now();
  double out = new - *time;
  *time = new;
  return out;
}


x86 assembly (clang, -O0):
<time_since_replace>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <time_now@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_since_replace>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <time_now@plt>
movapd %xmm0,%xmm1
subsd  (%rbx),%xmm1
movsd  %xmm0,(%rbx)
movapd %xmm1,%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @time_since_replace(double* %0) {
%2 = alloca double*
%3 = alloca double
%4 = alloca double
store double* %0, double** %2
%5 = call double (...) @time_now()
store double %5, double* %3
%6 = load double, double* %3
%7 = load double*, double** %2
%8 = load double, double* %7
%9 = fsub double %6, %8
store double %9, double* %4
%10 = load double, double* %3
%11 = load double*, double** %2
store double %10, double* %11
%12 = load double, double* %4
ret double %12
}

LLVM IR (-O2):
define double @time_since_replace(double* nocapture %0) {
%2 = tail call double (...) @time_now()
%3 = load double, double* %0
%4 = fsub double %2, %3
store double %2, double* %0
ret double %4
}
int genbind_enumerate_node(struct genbind_node *node, void *ctx) {
  ((void)(node));
  (*((int *)ctx))++;
  return 0;
}


x86 assembly (clang, -O0):
<genbind_enumerate_node>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<genbind_enumerate_node>:
addl   $0x1,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.genbind_node = type opaque
define i32 @genbind_enumerate_node(%struct.genbind_node* %0, i8* %1) {
%3 = alloca %struct.genbind_node*
%4 = alloca i8*
store %struct.genbind_node* %0, %struct.genbind_node** %3
store i8* %1, i8** %4
%5 = load %struct.genbind_node*, %struct.genbind_node** %3
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
%9 = add nsw i32 %8, 1
store i32 %9, i32* %7
ret i32 0
}

LLVM IR (-O2):
%struct.genbind_node = type opaque
define i32 @genbind_enumerate_node(%struct.genbind_node* nocapture readnone %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i32*
%4 = load i32, i32* %3
%5 = add nsw i32 %4, 1
store i32 %5, i32* %3
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *);
int test_sim();
int main() {
  {
    int ret;
    printf("TEST %s:%s\n", "NOR Flash Simulation",
           ((ret = test_sim()) == 0) ? "PASS" : "FAIL");
    ;
    if (ret != 0)
      return ret;
  };
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <test_sim@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
lea    0xee4(%rip),%rdx
lea    0xed8(%rip),%rax
cmp    $0x0,%ecx
cmove  %rax,%rdx
lea    0xea9(%rip),%rdi
lea    0xeae(%rip),%rsi
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
je     1178 <main+0x58>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117f <main+0x5f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <test_sim@plt>
mov    %eax,%ebx
test   %eax,%eax
lea    0xeee(%rip),%rax
lea    0xeec(%rip),%rdx
cmove  %rax,%rdx
lea    0xebb(%rip),%rdi
lea    0xec0(%rip),%rsi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"TEST %s:%s\0A\00"
@.str.1 = [21 x i8] c"NOR Flash Simulation\00"
@.str.2 = [5 x i8] c"PASS\00"
@.str.3 = [5 x i8] c"FAIL\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @test_sim()
store i32 %3, i32* %2
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = load i32, i32* %2
store i32 %11, i32* %1
br label %13
12: ; preds = %0
store i32 0, i32* %1
br label %13
13: ; preds = %12, %10
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@.str = [12 x i8] c"TEST %s:%s\0A\00"
@.str.1 = [21 x i8] c"NOR Flash Simulation\00"
@.str.2 = [5 x i8] c"PASS\00"
@.str.3 = [5 x i8] c"FAIL\00"
define i32 @main() {
%1 = tail call i32 (...) @test_sim()
%2 = icmp eq i32 %1, 0
%3 = select i1 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void gk(void) {
  printf("Gabriel Kreiman\n");
  printf("kreiman@mit.edu\n");
  printf("All rights reserved (c)\n");
}


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

x86 assembly (clang, -O2):
<gk>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
lea    0xef0(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"Gabriel Kreiman\0A\00"
@.str.1 = [17 x i8] c"kreiman@mit.edu\0A\00"
@.str.2 = [25 x i8] c"All rights reserved (c)\0A\00"
define void @gk() {
%1 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [16 x i8] c"Gabriel Kreiman\00"
@str.3 = [16 x i8] c"kreiman@mit.edu\00"
@str.4 = [24 x i8] c"All rights reserved (c)\00"
define void @gk() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ YESEXPR;
char *nl_langinfo(int /*<<< orphan*/);
char *langinfo_yesexpr() { return nl_langinfo(YESEXPR); }


x86 assembly (clang, -O0):
<langinfo_yesexpr>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <nl_langinfo@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<langinfo_yesexpr>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <nl_langinfo@plt>

LLVM IR (-O0):
@YESEXPR = global i32 0
define i8* @langinfo_yesexpr() {
%1 = load i32, i32* @YESEXPR
%2 = call i8* @nl_langinfo(i32 %1)
ret i8* %2
}

LLVM IR (-O2):
@YESEXPR = global i32 0
define i8* @langinfo_yesexpr() {
%1 = load i32, i32* @YESEXPR
%2 = tail call i8* @nl_langinfo(i32 %1)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ test_array_cat();
int /*<<< orphan*/ test_array_copy();
int /*<<< orphan*/ test_array_init();
int /*<<< orphan*/ test_array_new();
int /*<<< orphan*/ test_array_op();
int /*<<< orphan*/ test_array_ptr();
int /*<<< orphan*/ test_array_ref();
int main() {
  test_array_new();
  test_array_init();
  test_array_copy();
  test_array_cat();
  test_array_ref();
  test_array_ptr();
  test_array_op();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <test_array_new@plt>
mov    $0x0,%al
call   1040 <test_array_init@plt>
mov    $0x0,%al
call   1050 <test_array_copy@plt>
mov    $0x0,%al
call   1090 <test_array_cat@plt>
mov    $0x0,%al
call   1060 <test_array_ref@plt>
mov    $0x0,%al
call   1080 <test_array_ptr@plt>
mov    $0x0,%al
call   1070 <test_array_op@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_array_new@plt>
xor    %eax,%eax
call   1040 <test_array_init@plt>
xor    %eax,%eax
call   1050 <test_array_copy@plt>
xor    %eax,%eax
call   1090 <test_array_cat@plt>
xor    %eax,%eax
call   1060 <test_array_ref@plt>
xor    %eax,%eax
call   1080 <test_array_ptr@plt>
xor    %eax,%eax
call   1070 <test_array_op@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_array_new()
%3 = call i32 (...) @test_array_init()
%4 = call i32 (...) @test_array_copy()
%5 = call i32 (...) @test_array_cat()
%6 = call i32 (...) @test_array_ref()
%7 = call i32 (...) @test_array_ptr()
%8 = call i32 (...) @test_array_op()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_array_new()
%2 = tail call i32 (...) @test_array_init()
%3 = tail call i32 (...) @test_array_copy()
%4 = tail call i32 (...) @test_array_cat()
%5 = tail call i32 (...) @test_array_ref()
%6 = tail call i32 (...) @test_array_ptr()
%7 = tail call i32 (...) @test_array_op()
ret i32 0
}
int test_extend2(int x, unsigned width) {
  int mask = 1 << (width - 1);
  int bit = (x & mask) << 1;
  mask <<= 1;
  while (mask) {
    x = bit | (~mask & x);
    mask <<= 1;
    bit <<= 1;
  }
  return x;
}


x86 assembly (clang, -O0):
<test_extend2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1161 <test_extend2+0x61>
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    -0x4(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112f <test_extend2+0x2f>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_extend2>:
lea    -0x1(%rsi),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
add    %edx,%ecx
je     1131 <test_extend2+0x31>
and    %edi,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    %edx,%edx
mov    %ecx,%eax
not    %eax
and    %edi,%eax
or     %edx,%eax
mov    %eax,%edi
add    %ecx,%ecx
jne    1120 <test_extend2+0x20>
ret
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @test_extend2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = sub i32 %7, 1
%9 = shl i32 1, %8
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* %5
%12 = and i32 %10, %11
%13 = shl i32 %12, 1
store i32 %13, i32* %6
%14 = load i32, i32* %5
%15 = shl i32 %14, 1
store i32 %15, i32* %5
br label %16
16: ; preds = %19, %2
%17 = load i32, i32* %5
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %30
19: ; preds = %16
%20 = load i32, i32* %6
%21 = load i32, i32* %5
%22 = xor i32 %21, -1
%23 = load i32, i32* %3
%24 = and i32 %22, %23
%25 = or i32 %20, %24
store i32 %25, i32* %3
%26 = load i32, i32* %5
%27 = shl i32 %26, 1
store i32 %27, i32* %5
%28 = load i32, i32* %6
%29 = shl i32 %28, 1
store i32 %29, i32* %6
br label %16
30: ; preds = %16
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
define i32 @test_extend2(i32 %0, i32 %1) {
%3 = add i32 %1, -1
%4 = shl nuw i32 1, %3
%5 = shl i32 %4, 1
%6 = icmp eq i32 %5, 0
br i1 %6, label %19, label %7
7: ; preds = %2
%8 = and i32 %4, %0
br label %9
9: ; preds = %7, %9
%10 = phi i32 [ %17, %9 ], [ %5, %7 ]
%11 = phi i32 [ %13, %9 ], [ %8, %7 ]
%12 = phi i32 [ %16, %9 ], [ %0, %7 ]
%13 = shl i32 %11, 1
%14 = xor i32 %10, -1
%15 = and i32 %12, %14
%16 = or i32 %13, %15
%17 = shl i32 %10, 1
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %9
19: ; preds = %9, %2
%20 = phi i32 [ %0, %2 ], [ %16, %9 ]
ret i32 %20
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
scalar_t__ isblank(char const);
int str_is_negative(const char *str) {
  assert(str != NULL);
  while (isblank(*str))
    str++;
  if (*str == '-')
    return (1);
  else
    return (0);
}


x86 assembly (clang, -O0):
<str_is_negative>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isblank@plt>
cmp    $0x0,%rax
je     1165 <str_is_negative+0x45>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113e <str_is_negative+0x1e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1181 <str_is_negative+0x61>
movl   $0x1,-0x4(%rbp)
jmp    1188 <str_is_negative+0x68>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_is_negative>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%rbx),%edi
call   1030 <isblank@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1140 <str_is_negative+0x20>
xor    %eax,%eax
cmpb   $0x2d,-0x1(%rbx)
sete   %al
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @str_is_negative(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
br label %5
5: ; preds = %5, %1
%6 = phi i8* [ %0, %1 ], [ %10, %5 ]
%7 = load i8, i8* %6
%8 = tail call i64 @isblank(i8 signext %7)
%9 = icmp eq i64 %8, 0
%10 = getelementptr inbounds i8, i8* %6, i64 1
br i1 %9, label %11, label %5
11: ; preds = %5
%12 = load i8, i8* %6
%13 = icmp eq i8 %12, 45
%14 = zext i1 %13 to i32
ret i32 %14
}
int main() {
  int limit[256], i;
  f(limit, 0, 255);
  for (i = 0; i < 256; ++i) {
    if (limit[i] != i)
      abort();
    __asm__ volatile("" : : : "memory");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0xff,%edx
mov    $0x0,%al
call   1040 <f@plt>
movl   $0x0,-0x414(%rbp)
cmpl   $0x100,-0x414(%rbp)
jge    1194 <main+0x74>
movslq -0x414(%rbp),%rax
mov    -0x410(%rbp,%rax,4),%eax
cmp    -0x414(%rbp),%eax
je     1180 <main+0x60>
call   1030 <abort@plt>
mov    -0x414(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x414(%rbp)
jmp    1151 <main+0x31>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
xor    %ebx,%ebx
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0xff,%edx
xor    %eax,%eax
call   1040 <f@plt>
nopl   0x0(%rax,%rax,1)
mov    (%rsp,%rbx,4),%eax
cmp    %rax,%rbx
jne    1160 <main+0x40>
add    $0x1,%rbx
cmp    $0x100,%rbx
jne    1140 <main+0x20>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [256 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = getelementptr inbounds [256 x i32], [256 x i32]* %2, i64 0, i64 0
%5 = call i32 (i32*, i32, i32, ...) bitcast (i32 (...)* @f to i32 (i32*, i32, i32, ...)*)(i32* %4, i32 0, i32 255)
store i32 0, i32* %3
br label %6
6: ; preds = %18, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 256
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [256 x i32], [256 x i32]* %2, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = load i32, i32* %3
%15 = icmp ne i32 %13, %14
br i1 %15, label %16, label %17
16: ; preds = %9
unreachable
17: ; preds = %9
br label %18
18: ; preds = %17
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %6
21: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [256 x i32]
%2 = bitcast [256 x i32]* %1 to i8*
%3 = getelementptr inbounds [256 x i32], [256 x i32]* %1, i64 0, i64 0
%4 = call i32 (i32*, i32, i32, ...) bitcast (i32 (...)* @f to i32 (i32*, i32, i32, ...)*)(i32* %3, i32 0, i32 255)
br label %5
5: ; preds = %0, %12
%6 = phi i64 [ 0, %0 ], [ %13, %12 ]
%7 = getelementptr inbounds [256 x i32], [256 x i32]* %1, i64 0, i64 %6
%8 = load i32, i32* %7
%9 = zext i32 %8 to i64
%10 = icmp eq i64 %6, %9
br i1 %10, label %12, label %11
11: ; preds = %5
unreachable
12: ; preds = %5
%13 = add nuw nsw i64 %6, 1
%14 = icmp eq i64 %13, 256
br i1 %14, label %15, label %5
15: ; preds = %12
ret i32 0
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *, int /*<<< orphan*/);
int copy_dobldobl_container_to_start_solutions(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc(258, a, b, c, 0);
  return fail;
}


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

x86 assembly (clang, -O2):
<copy_dobldobl_container_to_start_solutions>:
mov    $0x102,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc@plt>

LLVM IR (-O0):
define i32 @copy_dobldobl_container_to_start_solutions() {
%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_c2phc(i32 258, 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 @copy_dobldobl_container_to_start_solutions() {
%1 = tail call i32 @_ada_use_c2phc(i32 258, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void do_version(void) {
  printf("start-stop-daemon %s for Debian\n\n", "1.1.1.1");
  printf("Written by Marek Michalkiewicz, public domain.\n");
}


x86 assembly (clang, -O0):
<do_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xf00(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_version>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xef3(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeed(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"start-stop-daemon %s for Debian\0A\0A\00"
@.str.1 = [8 x i8] c"1.1.1.1\00"
@.str.2 = [48 x i8] c"Written by Marek Michalkiewicz, public domain.\0A\00"
define void @do_version() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"start-stop-daemon %s for Debian\0A\0A\00"
@.str.1 = [8 x i8] c"1.1.1.1\00"
@str = [47 x i8] c"Written by Marek Michalkiewicz, public domain.\00"
define void @do_version() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
int main(void) {
  int arr[10000];
  puts("Hello, world!");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"Hello, world!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10000 x i32]
store i32 0, i32* %1
%3 = call i32 @puts(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

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 0
}
/* Variables and functions */
int /*<<< orphan*/ e(int);
int /*<<< orphan*/ set_err(char *);
cmp_rev() {
  int i, j;
  int result;
  set_err("cmp_rev");
  i = 2;
  j = 1;
  result = ((j - i < 0) == (j - i < 0)) ? 1 : 0;
  if (!result)
    e(1);
}


x86 assembly (clang, -O0):
<cmp_rev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <set_err@plt>
movl   $0x2,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    $0x0,%eax
setl   %al
and    $0x1,%al
movzbl %al,%edx
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    $0x0,%eax
setl   %al
and    $0x1,%al
movzbl %al,%esi
xor    %eax,%eax
mov    $0x1,%ecx
cmp    %esi,%edx
cmove  %ecx,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1187 <cmp_rev+0x67>
mov    $0x1,%edi
call   1030 <e@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [8 x i8] c"cmp_rev\00"
define i32 @cmp_rev() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i32 @set_err(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %2
store i32 1, i32* %3
%6 = load i32, i32* %3
%7 = load i32, i32* %2
%8 = sub nsw i32 %6, %7
%9 = icmp slt i32 %8, 0
%10 = zext i1 %9 to i32
%11 = load i32, i32* %3
%12 = load i32, i32* %2
%13 = sub nsw i32 %11, %12
%14 = icmp slt i32 %13, 0
%15 = zext i1 %14 to i32
%16 = icmp eq i32 %10, %15
%17 = zext i1 %16 to i64
%18 = select i1 %16, i32 1, i32 0
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 0
br i1 %20, label %23, label %21
21: ; preds = %0
%22 = call i32 @e(i32 1)
br label %23
23: ; preds = %21, %0
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@.str = [8 x i8] c"cmp_rev\00"
define i32 @cmp_rev() {
%1 = tail call i32 @set_err(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
int main() { int array1[4][2] = {{0, 1}, {2, 3}, {4, 5}, {6, 7}}; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    0xef5(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xef2(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeef(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xeec(%rip),%rax
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.array1 = [4 x [2 x i32]] [[2 x i32] [i32 0, i32 1], [2 x i32] [i32 2, i32 3], [2 x i32] [i32 4, i32 5], [2 x i32] [i32 6, i32 7]]
define i32 @main() {
%1 = alloca [4 x [2 x i32]]
%2 = bitcast [4 x [2 x i32]]* %1 to i8*
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void winner() { printf("you are winner!\n"); }


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

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

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

LLVM IR (-O2):
@str = [16 x i8] c"you are winner!\00"
define void @winner() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *prv_malloc(size_t size) { return malloc(size); }


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

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

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

LLVM IR (-O2):
define noalias i8* @prv_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
unsigned long early_pfn_to_nid(unsigned long pfn) { return 0; }


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

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

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

LLVM IR (-O2):
define i64 @early_pfn_to_nid(i64 %0) {
ret i64 0
}
/* Variables and functions */
int /*<<< orphan*/ empty_function();
void use_empty_function() { empty_function(); }


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

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

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

LLVM IR (-O2):
define void @use_empty_function() {
%1 = tail call i32 (...) @empty_function()
ret void
}
int test_imm_ADint64_highword_reg(long long val) {
  return ((val >> 32) & (0xAD << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_ADint64_highword_reg>:
movabs $0xad00000000,%rax
test   %rax,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_ADint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 32
%5 = and i64 %4, 173
%6 = icmp ne i64 %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_ADint64_highword_reg(i64 %0) {
%2 = and i64 %0, 743029342208
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
void *malloc(unsigned long const);
void *xalloc(const unsigned long size) {
  void *ret = malloc(size);
  if (!ret)
    die("xalloc");
  return ret;
}


x86 assembly (clang, -O0):
<xalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <xalloc+0x30>
lea    0xeb5(%rip),%rdi
call   1040 <die@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <xalloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <die@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"xalloc\00"
define i8* @xalloc(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 ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @die(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [7 x i8] c"xalloc\00"
define noalias i8* @xalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @die(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
int32_t max(int32_t x, int32_t y) { return (x > y) ? x : y; }


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jle    1127 <max+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <max+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovg  %rdi,%rax
ret

LLVM IR (-O0):
define i64 @max(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 = load i64, i64* %4
%7 = icmp sgt i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i64, i64* %3
br label %12
10: ; preds = %2
%11 = load i64, i64* %4
br label %12
12: ; preds = %10, %8
%13 = phi i64 [ %9, %8 ], [ %11, %10 ]
ret i64 %13
}

LLVM IR (-O2):
define i64 @max(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
char *malloc(int);
char *alloc_1d_char(int ndim1) { return malloc(ndim1 * sizeof(char)); }


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

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

LLVM IR (-O0):
define i8* @alloc_1d_char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = mul i64 %4, 1
%6 = trunc i64 %5 to i32
%7 = call i8* @malloc(i32 %6)
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @alloc_1d_char(i32 %0) {
%2 = tail call i8* @malloc(i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getprogname();
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: %s -u|-h [-f netgroup 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 = [36 x i8] c"usage: %s -u|-h [-f netgroup file]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i8* (...) @getprogname()
%3 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"usage: %s -u|-h [-f netgroup 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 ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ core9_print(char *, char const *);
void U_EMRCHORD_print(const char *contents) {
  core9_print("U_EMRCHORD", contents);
}


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

x86 assembly (clang, -O2):
<U_EMRCHORD_print>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <core9_print@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"U_EMRCHORD\00"
define void @U_EMRCHORD_print(i8* %0) {
%2 = tail call i32 @core9_print(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ss2ssr(int);
void ss2ssr_(int *res) { ss2ssr(*res); }


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

x86 assembly (clang, -O2):
<ss2ssr_>:
mov    (%rdi),%edi
jmp    1030 <ss2ssr@plt>

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

LLVM IR (-O2):
define void @ss2ssr_(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @ss2ssr(i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ common();
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("hello from prog1.c\n");
  common();
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [19 x i8] c"hello from prog1.c\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @common()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ arm_drain_writebuffer();
void dmb(void) { arm_drain_writebuffer(); }


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

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

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

LLVM IR (-O2):
define void @dmb() {
%1 = tail call i32 (...) @arm_drain_writebuffer()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_r_comment_entities();
int /*<<< orphan*/ test_r_comments();
void all_r_tests() {
  test_r_comments();
  test_r_comment_entities();
}


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

x86 assembly (clang, -O2):
<all_r_tests>:
push   %rax
xor    %eax,%eax
call   1040 <test_r_comments@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <test_r_comment_entities@plt>

LLVM IR (-O0):
define void @all_r_tests() {
%1 = call i32 (...) @test_r_comments()
%2 = call i32 (...) @test_r_comment_entities()
ret void
}

LLVM IR (-O2):
define void @all_r_tests() {
%1 = tail call i32 (...) @test_r_comments()
%2 = tail call i32 (...) @test_r_comment_entities()
ret void
}
double ls_costN_nm4_sq(double x) { return x * x; }


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

x86 assembly (clang, -O2):
<ls_costN_nm4_sq>:
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @ls_costN_nm4_sq(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
ret double %5
}

LLVM IR (-O2):
define double @ls_costN_nm4_sq(double %0) {
%2 = fmul double %0, %0
ret double %2
}
__attribute__((no)) unsigned long long rosbg_di_srl(unsigned long long a,
                                                    unsigned long long b) {
  return a | (b >> 2);
}


x86 assembly (clang, -O0):
<rosbg_di_srl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
shr    $0x2,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rosbg_di_srl>:
mov    %rsi,%rax
shr    $0x2,%rax
or     %rdi,%rax
ret

LLVM IR (-O0):
define i64 @rosbg_di_srl(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 = load i64, i64* %4
%7 = lshr i64 %6, 2
%8 = or i64 %5, %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @rosbg_di_srl(i64 %0, i64 %1) {
%3 = lshr i64 %1, 2
%4 = or i64 %3, %0
ret i64 %4
}
int ft_isascii(int c) {
  if (c >= 0 && c <= 127) {
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<ft_isascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1127 <ft_isascii+0x27>
cmpl   $0x7f,-0x8(%rbp)
jg     1127 <ft_isascii+0x27>
movl   $0x1,-0x4(%rbp)
jmp    112e <ft_isascii+0x2e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isascii>:
xor    %eax,%eax
cmp    $0x80,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @ft_isascii(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 127
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %11
10: ; preds = %6, %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @ft_isascii(i32 %0) {
%2 = icmp ult i32 %0, 128
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
test_pass(char *test) {
  printf("\033[1m\033[34m"
         "%s Passed\n"
         "\033[0m",
         test);
}


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

x86 assembly (clang, -O2):
<test_pass>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"\1B[1m\1B[34m%s Passed\0A\1B[0m\00"
define i32 @test_pass(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
@.str = [24 x i8] c"\1B[1m\1B[34m%s Passed\0A\1B[0m\00"
define i32 @test_pass(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ unreachable();
int flt32(int a) {
  unsigned i = a / 4;
  unsigned j = i - 3;
  if (j == 7)
    return -1;
  if (i <= 2)
    return 0;
  if (i < j)
    unreachable();
  return 1;
}


x86 assembly (clang, -O0):
<flt32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x7,-0x10(%rbp)
jne    1148 <flt32+0x38>
movl   $0xffffffff,-0x4(%rbp)
jmp    1178 <flt32+0x68>
cmpl   $0x2,-0xc(%rbp)
ja     115e <flt32+0x4e>
movl   $0x0,-0x4(%rbp)
jmp    1178 <flt32+0x68>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jae    1171 <flt32+0x61>
mov    $0x0,%al
call   1030 <unreachable@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flt32>:
mov    %edi,%ecx
and    $0xfffffffc,%ecx
mov    $0xffffffff,%eax
cmp    $0x28,%ecx
je     1122 <flt32+0x22>
lea    0x3(%rdi),%ecx
test   %edi,%edi
cmovns %edi,%ecx
sar    $0x2,%ecx
xor    %eax,%eax
cmp    $0x3,%ecx
setae  %al
ret

LLVM IR (-O0):
define i32 @flt32(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = sdiv i32 %6, 4
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = sub i32 %8, 3
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, 7
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 -1, i32* %2
br label %24
13: ; preds = %1
%14 = load i32, i32* %4
%15 = icmp ule i32 %14, 2
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 0, i32* %2
br label %24
17: ; preds = %13
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = icmp ult i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 (...) @unreachable()
br label %23
23: ; preds = %21, %17
store i32 1, i32* %2
br label %24
24: ; preds = %23, %16, %12
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @flt32(i32 %0) {
%2 = and i32 %0, -4
%3 = icmp eq i32 %2, 40
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = sdiv i32 %0, 4
%6 = icmp ugt i32 %5, 2
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ -1, %1 ], [ %7, %4 ]
ret i32 %9
}
void PC_UART_SCB_IRQ_Interrupt(void) {}


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

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

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

LLVM IR (-O2):
define void @PC_UART_SCB_IRQ_Interrupt() {
ret void
}