xunge/DecIR huggingface dataset:
/* Variables and functions */
int abs(int);
int negate(int);
int multiply(int n, int m) {
  int out = 0;
  int abs_m = abs(m);
  for (int i = 0; i < abs_m; i++) {
    out += n;
  }
  if (m < 0) {
    out = negate(out);
  }
  return out;
}


x86 assembly (clang, -O0):
<multiply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    116a <multiply+0x4a>
mov    -0x4(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1147 <multiply+0x27>
cmpl   $0x0,-0x8(%rbp)
jge    117f <multiply+0x5f>
mov    -0xc(%rbp),%edi
call   1040 <negate@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiply>:
test   %esi,%esi
je     1123 <multiply+0x13>
mov    %esi,%eax
neg    %eax
cmovs  %esi,%eax
imul   %edi,%eax
test   %esi,%esi
js     1126 <multiply+0x16>
ret
xor    %eax,%eax
ret
mov    %eax,%edi
jmp    1030 <negate@plt>

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

LLVM IR (-O2):
define i32 @multiply(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = tail call i32 @llvm.abs.i32(i32 %1, i1 true)
%6 = mul i32 %5, %0
%7 = icmp slt i32 %1, 0
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 @negate(i32 %6)
br label %10
10: ; preds = %2, %8, %4
%11 = phi i32 [ %9, %8 ], [ %6, %4 ], [ 0, %2 ]
ret i32 %11
}
/* Variables and functions */
__attribute__((visibility("default"))) void *
sd_bus_slot_get_current_userdata(void *slot) {
  return NULL;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @sd_bus_slot_get_current_userdata(i8* nocapture readnone %0) {
ret i8* null
}
int ffsll(long long int x) {
  long long int cnt;
  long long int tmp;
  asm("bsfq %2,%0\n"
      "cmoveq %1,%0\n"
      : "=&r"(cnt), "=r"(tmp)
      : "rm"(x), "1"(-1));
  return cnt + 1;
}


x86 assembly (clang, -O0):
<ffsll>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0xffffffff,%eax
bsf    -0x20(%rbp),%rcx
cmove  %rax,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffsll>:
mov    %rdi,-0x8(%rsp)
mov    $0xffffffff,%ecx
bsf    -0x8(%rsp),%rax
cmove  %rcx,%rax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @ffsll(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = call { i64, i64 } asm "bsfq $2,$0\0Acmoveq $1,$0\0A", "=&r,=r,rm,1,~{dirflag},~{fpsr},~{flags}"(i64 %5, i64 4294967295)
%7 = extractvalue { i64, i64 } %6, 0
%8 = extractvalue { i64, i64 } %6, 1
store i64 %7, i64* %3
store i64 %8, i64* %4
%9 = load i64, i64* %3
%10 = add nsw i64 %9, 1
%11 = trunc i64 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @ffsll(i64 %0) {
%2 = tail call { i64, i64 } asm "bsfq $2,$0\0Acmoveq $1,$0\0A", "=&r,=r,rm,1,~{dirflag},~{fpsr},~{flags}"(i64 %0, i64 4294967295)
%3 = extractvalue { i64, i64 } %2, 0
%4 = trunc i64 %3 to i32
%5 = add i32 %4, 1
ret i32 %5
}
/* Type definitions */
typedef int uint64_t;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int *, int);
int64_t sign_extend(uint64_t a, int bits) {
  int64_t sret;
  ;
  if ((a & (1 << (bits - 1))) != 0) {
    a = ((uint64_t)0xffffffffffffffffLL << bits) | a;
    memcpy(&sret, &a, 8);
    return sret;
  }
  return (int64_t)a;
}


x86 assembly (clang, -O0):
<sign_extend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1168 <sign_extend+0x58>
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116e <sign_extend+0x5e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign_extend>:
mov    %edi,%eax
lea    -0x1(%rsi),%ecx
movzbl %cl,%ecx
bt     %ecx,%edi
jae    1146 <sign_extend+0x36>
push   %rax
mov    $0xffffffff,%edx
mov    %esi,%ecx
shl    %cl,%edx
or     %eax,%edx
mov    %edx,0x4(%rsp)
mov    %rsp,%rdi
lea    0x4(%rsp),%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
mov    (%rsp),%eax
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define i32 @sign_extend(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = add nsw i32 %1, -1
%7 = shl nuw i32 1, %6
%8 = and i32 %7, %0
%9 = icmp eq i32 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = shl nsw i32 -1, %1
%12 = or i32 %11, %0
store i32 %12, i32* %3
%13 = call i32 @memcpy(i32* %4, i32* %3, i32 8)
%14 = load i32, i32* %4
br label %15
15: ; preds = %2, %10
%16 = phi i32 [ %14, %10 ], [ %0, %2 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ cgdefp(int);
int /*<<< orphan*/ gendata();
void gendefp(int v) {
  gendata();
  cgdefp(v);
}


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

x86 assembly (clang, -O2):
<gendefp>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <gendata@plt>
mov    %ebx,%edi
pop    %rbx
jmp    1030 <cgdefp@plt>

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

LLVM IR (-O2):
define void @gendefp(i32 %0) {
%2 = tail call i32 (...) @gendata()
%3 = tail call i32 @cgdefp(i32 %0)
ret void
}
int test_imm_85uint8_mem(unsigned char *val) {
  return ((*val) & (0x85 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_85uint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, 133
%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_85uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -123
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
char *get_relative_path(char const *, char const *);
scalar_t__ malloc(scalar_t__);
scalar_t__ strlen(char const *);
char const *get_relocated_path(char const *from, char const *to,
                               char const *actual_from) {
  char const *relative_from_to = get_relative_path(from, to);
  char *actual_to =
      (char *)malloc(strlen(actual_from) + 2 + strlen(relative_from_to));
  return actual_to;
}


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

x86 assembly (clang, -O2):
<get_relocated_path>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
call   1030 <get_relative_path@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strlen@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
lea    (%rbx,%rax,1),%rdi
add    $0x2,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <malloc@plt>

LLVM IR (-O0):
define i8* @get_relocated_path(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = call i8* @get_relative_path(i8* %9, i8* %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %6
%13 = call i64 @strlen(i8* %12)
%14 = add nsw i64 %13, 2
%15 = load i8*, i8** %7
%16 = call i64 @strlen(i8* %15)
%17 = add nsw i64 %14, %16
%18 = call i64 @malloc(i64 %17)
%19 = inttoptr i64 %18 to i8*
store i8* %19, i8** %8
%20 = load i8*, i8** %8
ret i8* %20
}

LLVM IR (-O2):
define i8* @get_relocated_path(i8* %0, i8* %1, i8* nocapture %2) {
%4 = tail call i8* @get_relative_path(i8* %0, i8* %1)
%5 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%6 = add nsw i64 %5, 2
%7 = tail call i64 @strlen(i8* dereferenceable(1) %4)
%8 = add nsw i64 %6, %7
%9 = tail call i64 @malloc(i64 %8)
%10 = inttoptr i64 %9 to i8*
ret i8* %10
}
void input_net_message() {}


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

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

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

LLVM IR (-O2):
define void @input_net_message() {
ret void
}
/* Variables and functions */
size_t Min(const size_t a, const size_t b) {
  if (a < b)
    return a;
  return b;
}


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

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

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

LLVM IR (-O2):
define i64 @Min(i64 %0, i64 %1) {
%3 = icmp ult i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
int isatty(int x) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @isatty(i32 %0) {
ret i32 0
}
unsigned long spl_debug_set_subsys(unsigned long mask) { return (0); }


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

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

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

LLVM IR (-O2):
define i64 @spl_debug_set_subsys(i64 %0) {
ret i64 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int powercap_sysfs_control_type_set_enabled(char *, int /*<<< orphan*/);
int powercap_rapl_control_set_enabled(int val) {
  return powercap_sysfs_control_type_set_enabled("intel-rapl", (uint32_t)val);
}


x86 assembly (clang, -O0):
<powercap_rapl_control_set_enabled>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <powercap_sysfs_control_type_set_enabled@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<powercap_rapl_control_set_enabled>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <powercap_sysfs_control_type_set_enabled@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"intel-rapl\00"
define i32 @powercap_rapl_control_set_enabled(i32 %0) {
%2 = tail call i32 @powercap_sysfs_control_type_set_enabled(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i32 %2
}
int dynarray_nochk_count(void **ar) {
  int len = 0;
  if (!ar)
    return 0;
  while (ar[len])
    len++;
  return len;
}


x86 assembly (clang, -O0):
<dynarray_nochk_count>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1126 <dynarray_nochk_count+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1152 <dynarray_nochk_count+0x52>
jmp    112b <dynarray_nochk_count+0x2b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     114c <dynarray_nochk_count+0x4c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112b <dynarray_nochk_count+0x2b>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dynarray_nochk_count>:
test   %rdi,%rdi
je     111e <dynarray_nochk_count+0x1e>
mov    $0xffffffff,%eax
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
cmpq   $0x0,(%rdi)
lea    0x8(%rdi),%rdi
jne    1110 <dynarray_nochk_count+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @dynarray_nochk_count(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %8, %3 ], [ 0, %1 ]
%5 = getelementptr inbounds i8*, i8** %0, i64 %4
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
%8 = add nuw i64 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = trunc i64 %4 to i32
br label %11
11: ; preds = %9, %1
%12 = phi i32 [ 0, %1 ], [ %10, %9 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ clear_screen();
void clearscreen() { clear_screen(); }


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

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

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

LLVM IR (-O2):
define void @clearscreen() {
%1 = tail call i32 (...) @clear_screen()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void fatal(const char *message) {
  fprintf(stderr, "Error: %s\n", message);
  exit(1);
}


x86 assembly (clang, -O0):
<fatal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fatal>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %s\0A\00"
define void @fatal(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %s\0A\00"
define void @fatal(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
void Uniform11(int *iy, float *yfl) {
  *iy = (4855 * *iy + 1731) & 8191;
  *yfl = *iy / 8192.0f;
}


x86 assembly (clang, -O0):
<Uniform11>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
imul   $0x12f7,(%rax),%ecx
add    $0x6c3,%ecx
and    $0x1fff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
cvtsi2ssl (%rax),%xmm0
movss  0xec8(%rip),%xmm1
divss  %xmm1,%xmm0
mov    -0x10(%rbp),%rax
movss  %xmm0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<Uniform11>:
imul   $0x12f7,(%rdi),%eax
add    $0x6c3,%eax
and    $0x1fff,%eax
cvtsi2ss %eax,%xmm0
mov    %eax,(%rdi)
mulss  0xee2(%rip),%xmm0
movss  %xmm0,(%rsi)
ret

LLVM IR (-O0):
define void @Uniform11(i32* %0, float* %1) {
%3 = alloca i32*
%4 = alloca float*
store i32* %0, i32** %3
store float* %1, float** %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = mul nsw i32 4855, %6
%8 = add nsw i32 %7, 1731
%9 = and i32 %8, 8191
%10 = load i32*, i32** %3
store i32 %9, i32* %10
%11 = load i32*, i32** %3
%12 = load i32, i32* %11
%13 = sitofp i32 %12 to float
%14 = fdiv float %13, 8.192000e+03
%15 = load float*, float** %4
store float %14, float* %15
ret void
}

LLVM IR (-O2):
define void @Uniform11(i32* nocapture %0, float* nocapture writeonly %1) {
%3 = load i32, i32* %0
%4 = mul nsw i32 %3, 4855
%5 = add nsw i32 %4, 1731
%6 = and i32 %5, 8191
store i32 %6, i32* %0
%7 = sitofp i32 %6 to float
%8 = fmul float %7, 0x3F20000000000000
store float %8, float* %1
ret void
}
int stdin_init(void) { return (-1); }


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

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

LLVM IR (-O0):
define i32 @stdin_init() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @stdin_init() {
ret i32 -1
}
int test_imm_B2int16_reg(short val) {
  return ((val) & (-0xB2 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_B2int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, -178
%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_B2int16_reg(i16 signext %0) {
%2 = and i16 %0, -178
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
void *memchr(const void *s, int c, size_t n) {
  const unsigned char *sp = s;
  while (n--) {
    if (*sp == (unsigned char)c)
      return (void *)sp;
    sp++;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<memchr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x20(%rbp)
cmp    $0x0,%rax
je     1163 <memchr+0x63>
mov    -0x28(%rbp),%rax
movzbl (%rax),%eax
mov    -0x14(%rbp),%ecx
movzbl %cl,%ecx
cmp    %ecx,%eax
jne    1152 <memchr+0x52>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116b <memchr+0x6b>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1117 <memchr+0x17>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memchr>:
test   %rdx,%rdx
je     1122 <memchr+0x22>
mov    %rdi,%rax
nopl   0x0(%rax,%rax,1)
cmp    %sil,(%rax)
je     1124 <memchr+0x24>
add    $0xffffffffffffffff,%rdx
add    $0x1,%rax
test   %rdx,%rdx
jne    1110 <memchr+0x10>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @memchr(i8* %0, i32 %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %16, label %5
5: ; preds = %3
%6 = trunc i32 %1 to i8
br label %7
7: ; preds = %5, %13
%8 = phi i64 [ %2, %5 ], [ %10, %13 ]
%9 = phi i8* [ %0, %5 ], [ %14, %13 ]
%10 = add i64 %8, -1
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, %6
br i1 %12, label %16, label %13
13: ; preds = %7
%14 = getelementptr inbounds i8, i8* %9, i64 1
%15 = icmp eq i64 %10, 0
br i1 %15, label %16, label %7
16: ; preds = %7, %13, %3
%17 = phi i8* [ null, %3 ], [ null, %13 ], [ %9, %7 ]
ret i8* %17
}
void avio_rl32() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ svcPanic();
int gettimeofday(struct timeval *p, void *z) { svcPanic(); }


x86 assembly (clang, -O0):
<gettimeofday>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    $0x0,%al
call   1030 <svcPanic@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @gettimeofday(%struct.timeval* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.timeval*
%5 = alloca i8*
store %struct.timeval* %0, %struct.timeval** %4
store i8* %1, i8** %5
%6 = call i32 (...) @svcPanic()
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @gettimeofday(%struct.timeval* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = tail call i32 (...) @svcPanic()
ret i32 undef
}
/* Variables and functions */
double pow(int, int);
double mpow(int n, int k) { return k == 0 ? 1 : pow(n, k); }


x86 assembly (clang, -O0):
<mpow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    113a <mpow+0x2a>
movsd  0xed0(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    114a <mpow+0x3a>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <pow@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mpow>:
test   %esi,%esi
je     1119 <mpow+0x9>
jmp    1030 <pow@plt>
movsd  0xedf(%rip),%xmm0
ret

LLVM IR (-O0):
define double @mpow(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %2
br label %12
8: ; preds = %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call double @pow(i32 %9, i32 %10)
br label %12
12: ; preds = %8, %7
%13 = phi double [ 1.000000e+00, %7 ], [ %11, %8 ]
ret double %13
}

LLVM IR (-O2):
define double @mpow(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call double @pow(i32 %0, i32 %1)
br label %6
6: ; preds = %2, %4
%7 = phi double [ %5, %4 ], [ 1.000000e+00, %2 ]
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ __console_tx_hex8(int, unsigned char);
void print_notice_hex8(unsigned char value) { __console_tx_hex8(5, value); }


x86 assembly (clang, -O0):
<print_notice_hex8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x5,%edi
movzbl -0x1(%rbp),%esi
call   1030 <__console_tx_hex8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_notice_hex8>:
mov    %edi,%esi
mov    $0x5,%edi
jmp    1030 <__console_tx_hex8@plt>

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

LLVM IR (-O2):
define void @print_notice_hex8(i8 zeroext %0) {
%2 = tail call i32 @__console_tx_hex8(i32 5, i8 zeroext %0)
ret void
}
void RTNetIPv4PseudoChecksumBits(void) {}


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

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

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

LLVM IR (-O2):
define void @RTNetIPv4PseudoChecksumBits() {
ret void
}
/* Variables and functions */
char *malloc(int);
void c_zeros(char **ptrA, int size) {
  *ptrA = malloc(size);
  char *A = *ptrA;
  int i;
  for (i = 0; i < size; i++)
    A[i] = 0;
}


x86 assembly (clang, -O0):
<c_zeros>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1169 <c_zeros+0x59>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1143 <c_zeros+0x33>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_zeros>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%edi
call   1040 <malloc@plt>
mov    %rax,(%r14)
test   %ebx,%ebx
jle    1143 <c_zeros+0x23>
mov    %ebx,%edx
mov    %rax,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @c_zeros(i8** nocapture writeonly %0, i32 %1) {
%3 = tail call i8* @malloc(i32 %1)
store i8* %3, i8** %0
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = zext i32 %1 to i64
br label %7
7: ; preds = %5, %2
ret void
}
int neg_bool(_Bool a) { return !a; }


x86 assembly (clang, -O0):
<neg_bool>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
and    $0x1,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<neg_bool>:
xor    $0x1,%dil
movzbl %dil,%eax
ret

LLVM IR (-O0):
define i32 @neg_bool(i1 zeroext %0) {
%2 = alloca i8
%3 = zext i1 %0 to i8
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = trunc i8 %4 to i1
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @neg_bool(i1 zeroext %0) {
%2 = xor i1 %0, true
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ NVIC_SystemReset();
void frdm_kl25z_shutdown(void) { NVIC_SystemReset(); }


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

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

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

LLVM IR (-O2):
define void @frdm_kl25z_shutdown() {
%1 = tail call i32 (...) @NVIC_SystemReset()
ret void
}
int foo(int a, int b) { return 2 + a - b; }


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

x86 assembly (clang, -O2):
<foo>:
sub    %esi,%edi
lea    0x2(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 2
%4 = sub i32 %3, %1
ret i32 %4
}
void noOp(unsigned short A, unsigned short B, unsigned short C) { return; }


x86 assembly (clang, -O0):
<noOp>:
push   %rbp
mov    %rsp,%rbp
mov    %dx,%ax
mov    %si,%cx
mov    %di,%dx
mov    %dx,-0x2(%rbp)
mov    %cx,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @noOp(i16 zeroext %0, i16 zeroext %1, i16 zeroext %2) {
%4 = alloca i16
%5 = alloca i16
%6 = alloca i16
store i16 %0, i16* %4
store i16 %1, i16* %5
store i16 %2, i16* %6
ret void
}

LLVM IR (-O2):
define void @noOp(i16 zeroext %0, i16 zeroext %1, i16 zeroext %2) {
ret void
}
int isfinite(x)
double x;
{
  union {
    double d;
    unsigned short s[4];
    unsigned int i[2];
  } u;
  u.d = x;
  if (sizeof(int) == 4) {
    if ((u.i[1] & 0x7ff00000) != 0x7ff00000)
      return 1;
    return (0);
  } else {
    if ((u.s[3] & 0x7ff0) != 0x7ff0)
      return 1;
    return (0);
  }
}


x86 assembly (clang, -O0):
<isfinite>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x14(%rbp),%eax
and    $0x7ff00000,%eax
cmp    $0x7ff00000,%eax
je     1132 <isfinite+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1139 <isfinite+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isfinite>:
movq   %xmm0,%rcx
not    %rcx
movabs $0x7ff0000000000000,%rdx
xor    %eax,%eax
test   %rdx,%rcx
setne  %al
ret

LLVM IR (-O0):
%union.anon = type { double }
define i32 @isfinite(double %0) {
%2 = alloca i32
%3 = alloca double
%4 = alloca %union.anon
store double %0, double* %3
%5 = load double, double* %3
%6 = bitcast %union.anon* %4 to double*
store double %5, double* %6
%7 = bitcast %union.anon* %4 to [2 x i32]*
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%9 = load i32, i32* %8
%10 = and i32 %9, 2146435072
%11 = icmp ne i32 %10, 2146435072
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 1, i32* %2
br label %14
13: ; preds = %1
store i32 0, i32* %2
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @isfinite(double %0) {
%2 = bitcast double %0 to i64
%3 = and i64 %2, 9218868437227405312
%4 = icmp ne i64 %3, 9218868437227405312
%5 = zext i1 %4 to i32
ret i32 %5
}
void task2_function(void *data) {
  char **msg = (char **)data;
  while (1) {
    char *ptr;
    while (!*msg) {
      __asm__ volatile("" ::: "memory");
      schedule();
    }
    ptr = *msg;
    myputs(ptr);
    *msg = 0;
  }
}


x86 assembly (clang, -O0):
<task2_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1139 <task2_function+0x19>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1153 <task2_function+0x33>
jmp    115f <task2_function+0x3f>
mov    $0x0,%al
call   1030 <schedule@plt>
jmp    1139 <task2_function+0x19>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1040 <myputs@plt>
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
jmp    1134 <task2_function+0x14>

x86 assembly (clang, -O2):
<task2_function>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
jne    113f <task2_function+0x1f>
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <schedule@plt>
mov    (%rbx),%rdi
test   %rdi,%rdi
je     1130 <task2_function+0x10>
xor    %eax,%eax
call   1040 <myputs@plt>
movq   $0x0,(%rbx)
xor    %edi,%edi
test   %rdi,%rdi
je     1130 <task2_function+0x10>
jmp    113f <task2_function+0x1f>

LLVM IR (-O0):
define void @task2_function(i8* %0) {
%2 = alloca i8*
%3 = alloca i8**
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to i8**
store i8** %6, i8*** %3
br label %7
7: ; preds = %1, %15
br label %8
8: ; preds = %13, %7
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = icmp ne i8* %10, null
%12 = xor i1 %11, true
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = call i32 (...) @schedule()
br label %8
15: ; preds = %8
%16 = load i8**, i8*** %3
%17 = load i8*, i8** %16
store i8* %17, i8** %4
%18 = load i8*, i8** %4
%19 = call i32 (i8*, ...) bitcast (i32 (...)* @myputs to i32 (i8*, ...)*)(i8* %18)
%20 = load i8**, i8*** %3
store i8* null, i8** %20
br label %7
}

LLVM IR (-O2):
define void @task2_function(i8* nocapture %0) {
%2 = bitcast i8* %0 to i8**
%3 = load i8*, i8** %2
br label %4
4: ; preds = %11, %1
%5 = phi i8* [ null, %11 ], [ %3, %1 ]
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %4, %7
tail call void asm sideeffect "", "~{memory},~{dirflag},~{fpsr},~{flags}"()
%8 = tail call i32 (...) @schedule()
%9 = load i8*, i8** %2
%10 = icmp eq i8* %9, null
br i1 %10, label %7, label %11
11: ; preds = %7, %4
%12 = phi i8* [ %5, %4 ], [ %9, %7 ]
%13 = tail call i32 (i8*, ...) bitcast (i32 (...)* @myputs to i32 (i8*, ...)*)(i8* %12)
store i8* null, i8** %2
br label %4
}
int refnum_to_scsi_id(signed short refnum) { return (~refnum) - 32; }


x86 assembly (clang, -O0):
<refnum_to_scsi_id>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
xor    $0xffffffff,%eax
sub    $0x20,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<refnum_to_scsi_id>:
not    %edi
lea    -0x20(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @refnum_to_scsi_id(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = xor i32 %4, -1
%6 = sub nsw i32 %5, 32
ret i32 %6
}

LLVM IR (-O2):
define i32 @refnum_to_scsi_id(i16 signext %0) {
%2 = xor i16 %0, -1
%3 = sext i16 %2 to i32
%4 = add nsw i32 %3, -32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char const *, char const *);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
void path_join(char *dst, const char *path1, const char *path2) {
  if (strlen(path1) > 0) {
    sprintf(dst, "%s/%s", path1, path2);
  } else {
    strcpy(dst, path2);
  }
}


x86 assembly (clang, -O0):
<path_join>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
jle    1174 <path_join+0x44>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe96(%rip),%rsi
call   1050 <sprintf@plt>
jmp    1181 <path_join+0x51>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<path_join>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %rsi,%rdi
call   1040 <strlen@plt>
test   %rax,%rax
jle    1165 <path_join+0x35>
lea    0xeae(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <sprintf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%s/%s\00"
define void @path_join(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %5
%8 = call i64 @strlen(i8* %7)
%9 = icmp sgt i64 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = load i8*, i8** %5
%13 = load i8*, i8** %6
%14 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13)
br label %19
15: ; preds = %3
%16 = load i8*, i8** %4
%17 = load i8*, i8** %6
%18 = call i32 @strcpy(i8* %16, i8* %17)
br label %19
19: ; preds = %15, %10
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s/%s\00"
define void @path_join(i8* %0, i8* %1, i8* %2) {
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = icmp sgt i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
br label %10
8: ; preds = %3
%9 = tail call i32 @strcpy(i8* %0, i8* %2)
br label %10
10: ; preds = %8, %6
ret void
}
int gcd(int a, int b) {
  while ((a %= b) && (b %= a))
    ;
  return a == 0 ? b : a;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
xor    %eax,%eax
cmp    $0x0,%edx
mov    %al,-0x9(%rbp)
je     1139 <gcd+0x39>
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
cmp    $0x0,%edx
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    1149 <gcd+0x49>
jmp    114e <gcd+0x4e>
jmp    110a <gcd+0xa>
cmpl   $0x0,-0x4(%rbp)
jne    1163 <gcd+0x63>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1169 <gcd+0x69>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1119 <gcd+0x19>
mov    %edx,%edi
mov    %esi,%eax
cltd
idiv   %edi
mov    %edx,%esi
test   %edx,%edx
jne    1100 <gcd>
mov    %edi,%eax
ret
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
br label %3
3: ; preds = %8, %2
%4 = phi i32 [ %0, %2 ], [ %6, %8 ]
%5 = phi i32 [ %1, %2 ], [ %9, %8 ]
%6 = srem i32 %4, %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = srem i32 %5, %6
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %3
11: ; preds = %3, %8
%12 = phi i32 [ %5, %3 ], [ %6, %8 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void sign_off(void) {
  puts("Thus terminates another awesome program by ");
  puts("SeeSaw Software");
}


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

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

LLVM IR (-O0):
@.str = [44 x i8] c"Thus terminates another awesome program by \00"
@.str.1 = [16 x i8] c"SeeSaw Software\00"
define void @sign_off() {
%1 = call i32 @puts(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [44 x i8] c"Thus terminates another awesome program by \00"
@.str.1 = [16 x i8] c"SeeSaw Software\00"
define void @sign_off() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int /*<<< orphan*/ u_printf(char *, char const *, int /*<<< orphan*/);
void um_printf(const char *fmt, va_list valist) {
  u_printf("MANAGER", fmt, valist);
}


x86 assembly (clang, -O0):
<um_printf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rdi
call   1030 <u_printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<um_printf>:
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee4(%rip),%rdi
jmp    1030 <u_printf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"MANAGER\00"
define void @um_printf(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @u_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"MANAGER\00"
define void @um_printf(i8* %0, i32 %1) {
%3 = tail call i32 @u_printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ *boxUnsigned(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ digitalRead(int /*<<< orphan*/);
int /*<<< orphan*/ unboxUnsigned(int /*<<< orphan*/ *);
uint32_t *arduinoDigitalRead(uint32_t context_len, uint32_t *stackvar) {
  uint32_t pin;
  uint32_t value;
  pin = unboxUnsigned(stackvar);
  value = digitalRead(pin);
  return boxUnsigned(context_len, value);
}


x86 assembly (clang, -O0):
<arduinoDigitalRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <unboxUnsigned@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <digitalRead@plt>
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <boxUnsigned@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arduinoDigitalRead>:
push   %rbx
mov    %edi,%ebx
mov    %rsi,%rdi
call   1050 <unboxUnsigned@plt>
mov    %eax,%edi
call   1030 <digitalRead@plt>
mov    %ebx,%edi
mov    %eax,%esi
pop    %rbx
jmp    1040 <boxUnsigned@plt>

LLVM IR (-O0):
define i32* @arduinoDigitalRead(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 = call i32 @unboxUnsigned(i32* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = call i32 @digitalRead(i32 %9)
store i32 %10, i32* %6
%11 = load i32, i32* %3
%12 = load i32, i32* %6
%13 = call i32* @boxUnsigned(i32 %11, i32 %12)
ret i32* %13
}

LLVM IR (-O2):
define i32* @arduinoDigitalRead(i32 %0, i32* %1) {
%3 = tail call i32 @unboxUnsigned(i32* %1)
%4 = tail call i32 @digitalRead(i32 %3)
%5 = tail call i32* @boxUnsigned(i32 %0, i32 %4)
ret i32* %5
}