xunge/DecIR huggingface dataset:
int count_bits(unsigned char c) {
  int count = 0;
  int i;
  for (i = 0; i < 8; i++)
    if (c & (1 << i))
      count++;
  return count;
}


x86 assembly (clang, -O0):
<count_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1159 <count_bits+0x59>
movzbl -0x1(%rbp),%eax
mov    -0xc(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
cmp    $0x0,%eax
je     1146 <count_bits+0x46>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114b <count_bits+0x4b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1118 <count_bits+0x18>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_bits>:
mov    %edi,%eax
and    $0x1,%eax
mov    %edi,%ecx
shr    %ecx
and    $0x1,%ecx
add    %eax,%ecx
mov    %edi,%eax
shr    $0x2,%eax
and    $0x1,%eax
add    %ecx,%eax
mov    %edi,%ecx
shr    $0x3,%ecx
and    $0x1,%ecx
add    %eax,%ecx
mov    %edi,%eax
shr    $0x4,%eax
and    $0x1,%eax
add    %ecx,%eax
mov    %edi,%ecx
shr    $0x5,%ecx
and    $0x1,%ecx
add    %eax,%ecx
mov    %edi,%eax
shr    $0x6,%eax
and    $0x1,%eax
add    %ecx,%eax
shr    $0x7,%edi
add    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @count_bits(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = and i32 %2, 1
%4 = lshr i32 %2, 1
%5 = and i32 %4, 1
%6 = add nuw nsw i32 %5, %3
%7 = lshr i32 %2, 2
%8 = and i32 %7, 1
%9 = add nuw nsw i32 %8, %6
%10 = lshr i32 %2, 3
%11 = and i32 %10, 1
%12 = add nuw nsw i32 %11, %9
%13 = lshr i32 %2, 4
%14 = and i32 %13, 1
%15 = add nuw nsw i32 %14, %12
%16 = lshr i32 %2, 5
%17 = and i32 %16, 1
%18 = add nuw nsw i32 %17, %15
%19 = lshr i32 %2, 6
%20 = and i32 %19, 1
%21 = add nuw nsw i32 %20, %18
%22 = lshr i32 %2, 7
%23 = add nuw nsw i32 %22, %21
ret i32 %23
}
void teletype_write(void) {}


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

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

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

LLVM IR (-O2):
define void @teletype_write() {
ret void
}
int sumDivisbleBy(int n, int p) { return n * (p / n) * ((p / n) + 1) / 2; }


x86 assembly (clang, -O0):
<sumDivisbleBy>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumDivisbleBy>:
mov    %esi,%eax
cltd
idiv   %edi
imul   %eax,%edi
add    $0x1,%eax
imul   %edi,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %ecx,%eax
sar    %eax
ret

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

LLVM IR (-O2):
define i32 @sumDivisbleBy(i32 %0, i32 %1) {
%3 = sdiv i32 %1, %0
%4 = mul nsw i32 %3, %0
%5 = add nsw i32 %3, 1
%6 = mul nsw i32 %4, %5
%7 = sdiv i32 %6, 2
ret i32 %7
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t uart0_getc() {
  while (!((*((volatile uint32_t *)0xE2900010)) & 0x01))
    ;
  return (*((volatile uint32_t *)0xE2900024));
}


x86 assembly (clang, -O0):
<uart0_getc>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <uart0_getc+0x9>
mov    $0xe2900010,%eax
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1128 <uart0_getc+0x28>
jmp    112d <uart0_getc+0x2d>
jmp    1109 <uart0_getc+0x9>
mov    $0xe2900024,%eax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart0_getc>:
mov    $0xe2900010,%eax
cs nopw 0x0(%rax,%rax,1)
nop
testl  $0x1,(%rax)
je     1110 <uart0_getc+0x10>
mov    0x14(%rax),%eax
ret

LLVM IR (-O0):
define i32 @uart0_getc() {
br label %1
1: ; preds = %6, %0
%2 = load volatile i32, i32* inttoptr (i64 3801088016 to i32*)
%3 = and i32 %2, 1
%4 = icmp ne i32 %3, 0
%5 = xor i1 %4, true
br i1 %5, label %6, label %7
6: ; preds = %1
br label %1
7: ; preds = %1
%8 = load volatile i32, i32* inttoptr (i64 3801088036 to i32*)
ret i32 %8
}

LLVM IR (-O2):
define i32 @uart0_getc() {
br label %1
1: ; preds = %1, %0
%2 = load volatile i32, i32* inttoptr (i64 3801088016 to i32*)
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 0
br i1 %4, label %1, label %5
5: ; preds = %1
%6 = load volatile i32, i32* inttoptr (i64 3801088036 to i32*)
ret i32 %6
}
double link_function_2nd_deriv_relation(double g_score, double g_deriv) {
  return 2 * g_deriv * g_deriv / (g_score + 8) - g_deriv;
}


x86 assembly (clang, -O0):
<link_function_2nd_deriv_relation>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  0xef2(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xed8(%rip),%xmm1
addsd  -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
subsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<link_function_2nd_deriv_relation>:
movapd %xmm1,%xmm2
addsd  %xmm1,%xmm2
mulsd  %xmm1,%xmm2
addsd  0xeec(%rip),%xmm0
divsd  %xmm0,%xmm2
subsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @link_function_2nd_deriv_relation(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fmul double 2.000000e+00, %5
%7 = load double, double* %4
%8 = fmul double %6, %7
%9 = load double, double* %3
%10 = fadd double %9, 8.000000e+00
%11 = fdiv double %8, %10
%12 = load double, double* %4
%13 = fsub double %11, %12
ret double %13
}

LLVM IR (-O2):
define double @link_function_2nd_deriv_relation(double %0, double %1) {
%3 = fmul double %1, 2.000000e+00
%4 = fmul double %3, %1
%5 = fadd double %0, 8.000000e+00
%6 = fdiv double %4, %5
%7 = fsub double %6, %1
ret double %7
}
void destroy_ramdump_device(void *dev) {}


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

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

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

LLVM IR (-O2):
define void @destroy_ramdump_device(i8* nocapture %0) {
ret void
}
/* Variables and functions */
size_t _min(size_t a, size_t b) { return (a < b ? a : b); }


x86 assembly (clang, -O0):
<_min>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1127 <_min+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <_min+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%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
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp ult 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 @_min(i64 %0, i64 %1) {
%3 = icmp ult i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
int f2fs_init_iostat(struct f2fs_sb_info *sbi) { return 0; }


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

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

LLVM IR (-O0):
%struct.f2fs_sb_info = type opaque
define i32 @f2fs_init_iostat(%struct.f2fs_sb_info* %0) {
%2 = alloca %struct.f2fs_sb_info*
store %struct.f2fs_sb_info* %0, %struct.f2fs_sb_info** %2
ret i32 0
}

LLVM IR (-O2):
%struct.f2fs_sb_info = type opaque
define i32 @f2fs_init_iostat(%struct.f2fs_sb_info* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int hLog10_ULL(unsigned long long);
int hNumDigits(unsigned long long a) { return hLog10_ULL(a) + 1; }


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

x86 assembly (clang, -O2):
<hNumDigits>:
push   %rax
call   1030 <hLog10_ULL@plt>
add    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @hNumDigits(i64 %0) {
%2 = tail call i32 @hLog10_ULL(i64 %0)
%3 = add nsw i32 %2, 1
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ nl_item;

/* Variables and functions */
int /*<<< orphan*/ __softboundmpx_store_return_metadata(char *, char *);
char *nl_langinfo(int /*<<< orphan*/);
__attribute__((__weak__, __always___)) char *
softboundmpx_nl_langinfo(nl_item item) {
  char *ret_ptr = nl_langinfo(item);
  __softboundmpx_store_return_metadata(ret_ptr, ret_ptr + 1024 * 1024);
  return ret_ptr;
}


x86 assembly (clang, -O0):
<softboundmpx_nl_langinfo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <nl_langinfo@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rsi
add    $0x100000,%rsi
call   1040 <__softboundmpx_store_return_metadata@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softboundmpx_nl_langinfo>:
push   %rbx
call   1030 <nl_langinfo@plt>
mov    %rax,%rbx
lea    0x100000(%rax),%rsi
mov    %rax,%rdi
call   1040 <__softboundmpx_store_return_metadata@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define weak i8* @softboundmpx_nl_langinfo(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8* @nl_langinfo(i32 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 1048576
%9 = call i32 @__softboundmpx_store_return_metadata(i8* %6, i8* %8)
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
define weak i8* @softboundmpx_nl_langinfo(i32 %0) {
%2 = tail call i8* @nl_langinfo(i32 %0)
%3 = getelementptr inbounds i8, i8* %2, i64 1048576
%4 = tail call i32 @__softboundmpx_store_return_metadata(i8* %2, i8* %3)
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ PKEY_USAGE_PERIOD;
typedef int /*<<< orphan*/ ASN1_VALUE;

/* Variables and functions */
scalar_t__ ASN1_item_d2i(int /*<<< orphan*/ **, unsigned char const **, long,
                         int /*<<< orphan*/ *);
int /*<<< orphan*/ PKEY_USAGE_PERIOD_it;
PKEY_USAGE_PERIOD *d2i_PKEY_USAGE_PERIOD(PKEY_USAGE_PERIOD **a,
                                         const unsigned char **in, long len) {
  return (PKEY_USAGE_PERIOD *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
                                            &PKEY_USAGE_PERIOD_it);
}


x86 assembly (clang, -O0):
<d2i_PKEY_USAGE_PERIOD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    0x2ec1(%rip),%rcx
call   1030 <ASN1_item_d2i@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2i_PKEY_USAGE_PERIOD>:
mov    0x2ee1(%rip),%rcx
jmp    1030 <ASN1_item_d2i@plt>

LLVM IR (-O0):
@PKEY_USAGE_PERIOD_it = global i32 0
define i32* @d2i_PKEY_USAGE_PERIOD(i32** %0, i8** %1, i64 %2) {
%4 = alloca i32**
%5 = alloca i8**
%6 = alloca i64
store i32** %0, i32*** %4
store i8** %1, i8*** %5
store i64 %2, i64* %6
%7 = load i32**, i32*** %4
%8 = load i8**, i8*** %5
%9 = load i64, i64* %6
%10 = call i64 @ASN1_item_d2i(i32** %7, i8** %8, i64 %9, i32* @PKEY_USAGE_PERIOD_it)
%11 = inttoptr i64 %10 to i32*
ret i32* %11
}

LLVM IR (-O2):
@PKEY_USAGE_PERIOD_it = global i32 0
define i32* @d2i_PKEY_USAGE_PERIOD(i32** %0, i8** %1, i64 %2) {
%4 = tail call i64 @ASN1_item_d2i(i32** %0, i8** %1, i64 %2, i32* @PKEY_USAGE_PERIOD_it)
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}
void ALTURA_TASK_FCN(void const *argument) {}


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

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

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

LLVM IR (-O2):
define void @ALTURA_TASK_FCN(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ prepare_execution_context();
int /*<<< orphan*/ prepare_free_list();
void init(void) {
  prepare_free_list();
  prepare_execution_context();
}


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

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

LLVM IR (-O0):
define void @init() {
%1 = call i32 (...) @prepare_free_list()
%2 = call i32 (...) @prepare_execution_context()
ret void
}

LLVM IR (-O2):
define void @init() {
%1 = tail call i32 (...) @prepare_free_list()
%2 = tail call i32 (...) @prepare_execution_context()
ret void
}
void RTErrInfoSet(void) {}


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

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

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

LLVM IR (-O2):
define void @RTErrInfoSet() {
ret void
}
/* Variables and functions */
int sqrt(int);
int isPrime(int n) {
  int i = 1, sqr = sqrt(n);
  if (n == 1)
    return 0;
  while (++i < sqr)
    if (n % i == 0)
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<isPrime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <sqrt@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1143 <isPrime+0x33>
movl   $0x0,-0x4(%rbp)
jmp    1182 <isPrime+0x72>
jmp    1148 <isPrime+0x38>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmp    -0x10(%rbp),%eax
jge    117b <isPrime+0x6b>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1176 <isPrime+0x66>
movl   $0x0,-0x4(%rbp)
jmp    1182 <isPrime+0x72>
jmp    1148 <isPrime+0x38>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrime>:
push   %rbx
mov    %edi,%ebx
call   1030 <sqrt@plt>
xor    %ecx,%ecx
cmp    $0x1,%ebx
je     1147 <isPrime+0x37>
mov    %eax,%esi
cmp    $0x3,%eax
mov    $0x2,%edi
cmovl  %edi,%esi
nopl   0x0(%rax)
cmp    %edi,%esi
je     1142 <isPrime+0x32>
mov    %ebx,%eax
cltd
idiv   %edi
add    $0x1,%edi
test   %edx,%edx
jne    1130 <isPrime+0x20>
jmp    1147 <isPrime+0x37>
mov    $0x1,%ecx
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @isPrime(i32 %0) {
%2 = tail call i32 @sqrt(i32 %0)
%3 = icmp eq i32 %0, 1
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = call i32 @llvm.smax.i32(i32 %2, i32 2)
%6 = add nsw i32 %5, -1
br label %7
7: ; preds = %4, %11
%8 = phi i32 [ %9, %11 ], [ 1, %4 ]
%9 = add nuw nsw i32 %8, 1
%10 = icmp eq i32 %8, %6
br i1 %10, label %14, label %11
11: ; preds = %7
%12 = srem i32 %0, %9
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %7
14: ; preds = %7, %11, %1
%15 = phi i32 [ 0, %1 ], [ 1, %7 ], [ 0, %11 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void eat(int phil) { printf("\nPhilosopher %d is eating", phil); }


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

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

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

LLVM IR (-O2):
@.str = [26 x i8] c"\0APhilosopher %d is eating\00"
define void @eat(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int _open(const uint8_t *path, int32_t flags, int32_t mode) { return -1; }


x86 assembly (clang, -O0):
<_open>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @_open(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
ret i32 -1
}

LLVM IR (-O2):
define i32 @_open(i32* nocapture readnone %0, i32 %1, i32 %2) {
ret i32 -1
}
void clear_usb_ram(void) {
  unsigned long *p = (unsigned long *)0x40006000;
  int i;
  for (i = 0; i < 512; i += 2) {
    *p++ = 0;
  }
}


x86 assembly (clang, -O0):
<clear_usb_ram>:
push   %rbp
mov    %rsp,%rbp
mov    $0x40006000,%eax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x200,-0xc(%rbp)
jge    1145 <clear_usb_ram+0x45>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x8(%rbp)
movq   $0x0,(%rax)
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    1114 <clear_usb_ram+0x14>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_usb_ram>:
push   %rax
mov    $0x40006000,%edi
mov    $0x800,%edx
xor    %esi,%esi
call   1030 <memset@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @clear_usb_ram() {
%1 = alloca i64*
%2 = alloca i32
store i64* inttoptr (i64 1073766400 to i64*), i64** %1
store i32 0, i32* %2
br label %3
3: ; preds = %9, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 512
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i64*, i64** %1
%8 = getelementptr inbounds i64, i64* %7, i32 1
store i64* %8, i64** %1
store i64 0, i64* %7
br label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = add nsw i32 %10, 2
store i32 %11, i32* %2
br label %3
12: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @clear_usb_ram() {
ret void
}
int _OPEN(const char *name, int flags, int mode) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @_OPEN(i8* nocapture readnone %0, i32 %1, i32 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int waitpid(int, int *, int /*<<< orphan*/);
void sfunc(int sig) {
  int ret = 0, status;
  do {
    ret = waitpid(-1, &status, WNOHANG);
  } while (ret > 0);
}


x86 assembly (clang, -O0):
<sfunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    0x2ebf(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
lea    -0xc(%rbp),%rsi
call   1030 <waitpid@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1122 <sfunc+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sfunc>:
push   %r14
push   %rbx
push   %rax
mov    0x2ecd(%rip),%r14
lea    0x4(%rsp),%rbx
mov    (%r14),%edx
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1030 <waitpid@plt>
test   %eax,%eax
jg     1120 <sfunc+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
define void @sfunc(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %5
5: ; preds = %8, %1
%6 = load i32, i32* @WNOHANG
%7 = call i32 @waitpid(i32 -1, i32* %4, i32 %6)
store i32 %7, i32* %3
br label %8
8: ; preds = %5
%9 = load i32, i32* %3
%10 = icmp sgt i32 %9, 0
br i1 %10, label %5, label %11
11: ; preds = %8
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
define void @sfunc(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
br label %4
4: ; preds = %4, %1
%5 = load i32, i32* @WNOHANG
%6 = call i32 @waitpid(i32 -1, i32* %2, i32 %5)
%7 = icmp sgt i32 %6, 0
br i1 %7, label %4, label %8
8: ; preds = %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ f(char *);
main() {
  int i;
  char x = '\0';
  for (i = 0; i < 100; ++i) {
    f(&x);
    if (x != 'x')
      abort();
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x9(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jge    1184 <main+0x54>
lea    -0x9(%rbp),%rdi
call   1040 <f@plt>
movsbl -0x9(%rbp),%eax
cmp    $0x78,%eax
je     1171 <main+0x41>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1176 <main+0x46>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    114a <main+0x1a>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
movb   $0x0,0x7(%rsp)
mov    $0x64,%ebp
lea    0x7(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1040 <f@plt>
cmpb   $0x78,0x7(%rsp)
jne    116b <main+0x3b>
add    $0xffffffff,%ebp
jne    1150 <main+0x20>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
store i8 0, i8* %3
store i32 0, i32* %2
br label %4
4: ; preds = %15, %0
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 100
br i1 %6, label %7, label %18
7: ; preds = %4
%8 = call i32 @f(i8* %3)
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 120
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %7
br label %15
15: ; preds = %14
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %4
18: ; preds = %4
%19 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i8
store i8 0, i8* %1
br label %5
2: ; preds = %5
%3 = add nuw nsw i32 %6, 1
%4 = icmp eq i32 %3, 100
br i1 %4, label %12, label %5
5: ; preds = %0, %2
%6 = phi i32 [ 0, %0 ], [ %3, %2 ]
%7 = call i32 @f(i8* %1)
%8 = load i8, i8* %1
%9 = icmp eq i8 %8, 120
br i1 %9, label %2, label %10
10: ; preds = %5
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %2
%13 = call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
struct stat {
  int /*<<< orphan*/ st_mode;
};

/* Variables and functions */
int /*<<< orphan*/ S_IFCHR;
int _stat(const char *filepath __attribute__((unused)), struct stat *st) {
  st->st_mode = S_IFCHR;
  return 0;
}


x86 assembly (clang, -O0):
<_stat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ecd(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_stat>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@S_IFCHR = global i32 0
define i32 @_stat(i8* %0, %struct.stat* %1) {
%3 = alloca i8*
%4 = alloca %struct.stat*
store i8* %0, i8** %3
store %struct.stat* %1, %struct.stat** %4
%5 = load i32, i32* @S_IFCHR
%6 = load %struct.stat*, %struct.stat** %4
%7 = getelementptr inbounds %struct.stat, %struct.stat* %6, i32 0, i32 0
store i32 %5, i32* %7
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@S_IFCHR = global i32 0
define i32 @_stat(i8* nocapture readnone %0, %struct.stat* nocapture writeonly %1) {
%3 = load i32, i32* @S_IFCHR
%4 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
store i32 %3, i32* %4
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int read_char_from_file(char filename[]) {
  FILE *file;
  int f_char;
  file = fopen(filename, "rt");
  f_char = fgetc(file);
  fclose(file);
  return f_char;
}


x86 assembly (clang, -O0):
<read_char_from_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_char_from_file>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <fgetc@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <fclose@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"rt\00"
define i32 @read_char_from_file(i8* nocapture %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @fgetc(i32* %2)
%4 = tail call i32 @fclose(i32* %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ mystrlen(char const *);
int /*<<< orphan*/ write(int, char const *, int /*<<< orphan*/);
void Error(const char *message) {
  write(1, "ERROR: ", mystrlen("ERROR: "));
  write(1, message, mystrlen(message));
  _exit(-1);
}


x86 assembly (clang, -O0):
<Error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1050 <mystrlen@plt>
mov    %eax,%edx
mov    $0x1,%edi
lea    0xeaa(%rip),%rsi
call   1040 <write@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <mystrlen@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1040 <write@plt>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<Error>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xec2(%rip),%r14
mov    %r14,%rdi
call   1050 <mystrlen@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %rbx,%rdi
call   1050 <mystrlen@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"ERROR: \00"
define void @Error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @mystrlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @write(i32 1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i8*, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @mystrlen(i8* %6)
%8 = call i32 @write(i32 1, i8* %5, i32 %7)
%9 = call i32 @_exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"ERROR: \00"
define void @Error(i8* %0) {
%2 = tail call i32 @mystrlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @mystrlen(i8* %0)
%5 = tail call i32 @write(i32 1, i8* %0, i32 %4)
%6 = tail call i32 @_exit(i32 -1)
unreachable
}
int getMinDiceThrows(struct Graph *G) {}


x86 assembly (clang, -O0):
<getMinDiceThrows>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.Graph = type opaque
define i32 @getMinDiceThrows(%struct.Graph* %0) {
%2 = alloca i32
%3 = alloca %struct.Graph*
store %struct.Graph* %0, %struct.Graph** %3
%4 = load i32, i32* %2
ret i32 %4
}

LLVM IR (-O2):
%struct.Graph = type opaque
define i32 @getMinDiceThrows(%struct.Graph* nocapture readnone %0) {
ret i32 undef
}
int test_imm_90uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x90 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_90uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 9437184
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
unsigned long __builtin_arm_rsr64(char *);
unsigned long rsr64() { return __builtin_arm_rsr64("1:2:3:4:5"); }


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"1:2:3:4:5\00"
define i64 @rsr64() {
%1 = call i64 @__builtin_arm_rsr64(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i64 %1
}

LLVM IR (-O2):
@.str = [10 x i8] c"1:2:3:4:5\00"
define i64 @rsr64() {
%1 = tail call i64 @__builtin_arm_rsr64(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i64 %1
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void store_bigendian(unsigned char *x, uint32_t u) {
  x[3] = u;
  u >>= 8;
  x[2] = u;
  u >>= 8;
  x[1] = u;
  u >>= 8;
  x[0] = u;
}


x86 assembly (clang, -O0):
<store_bigendian>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<store_bigendian>:
bswap  %esi
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @store_bigendian(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = trunc i32 %5 to i8
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 3
store i8 %6, i8* %8
%9 = load i32, i32* %4
%10 = ashr i32 %9, 8
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = trunc i32 %11 to i8
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 2
store i8 %12, i8* %14
%15 = load i32, i32* %4
%16 = ashr i32 %15, 8
store i32 %16, i32* %4
%17 = load i32, i32* %4
%18 = trunc i32 %17 to i8
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 1
store i8 %18, i8* %20
%21 = load i32, i32* %4
%22 = ashr i32 %21, 8
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = trunc i32 %23 to i8
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 0
store i8 %24, i8* %26
ret void
}

LLVM IR (-O2):
define void @store_bigendian(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
%4 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %3, i8* %4
%5 = lshr i32 %1, 8
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %6, i8* %7
%8 = lshr i32 %1, 16
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %9, i8* %10
%11 = lshr i32 %1, 24
%12 = trunc i32 %11 to i8
store i8 %12, i8* %0
ret void
}
int tabpos(int pos, int *tab) { return tab[pos] || pos >= 100; }


x86 assembly (clang, -O0):
<tabpos>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
movslq -0x4(%rbp),%rdx
mov    $0x1,%al
cmpl   $0x0,(%rcx,%rdx,4)
mov    %al,-0x11(%rbp)
jne    112c <tabpos+0x2c>
cmpl   $0x64,-0x4(%rbp)
setge  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tabpos>:
movslq %edi,%rax
cmpl   $0x0,(%rsi,%rax,4)
setne  %cl
cmp    $0x64,%eax
setge  %al
or     %cl,%al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @tabpos(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 = load i32, i32* %3
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
%10 = icmp ne i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load i32, i32* %3
%13 = icmp sge i32 %12, 100
br label %14
14: ; preds = %11, %2
%15 = phi i1 [ true, %2 ], [ %13, %11 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @tabpos(i32 %0, i32* nocapture %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds i32, i32* %1, i64 %3
%5 = load i32, i32* %4
%6 = icmp ne i32 %5, 0
%7 = icmp sgt i32 %0, 99
%8 = or i1 %7, %6
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ escape(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
main() {
  char t[] = "Hello\tWorld\r\n\v";
  printf("%s\n", t);
  char s[1000];
  escape(s, t);
  printf("%s\n", s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x400,%rsp
mov    0xece(%rip),%rax
mov    %rax,-0xf(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x7(%rbp)
mov    0xec6(%rip),%ax
mov    %ax,-0x3(%rbp)
mov    0xebe(%rip),%al
mov    %al,-0x1(%rbp)
lea    -0xf(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
lea    -0x400(%rbp),%rdi
lea    -0xf(%rbp),%rsi
call   1040 <escape@plt>
lea    -0x400(%rbp),%rsi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
movabs $0xb0a0d646c726f,%rax
mov    %rax,0x7(%rsp)
movabs $0x6f57096f6c6c6548,%rax
09 57 6f
mov    %rax,(%rsp)
lea    0xebf(%rip),%r14
mov    %rsp,%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <escape@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.t = [15 x i8] c"Hello\09World\0D\0A\0B\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca [1000 x i8]
%3 = bitcast [15 x i8]* %1 to i8*
%4 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%8 = call i32 @escape(i8* %6, i8* %7)
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.t = [15 x i8] c"Hello\09World\0D\0A\0B\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [15 x i8]
%2 = alloca [1000 x i8]
%3 = getelementptr inbounds [15 x i8], [15 x i8]* %1, i64 0, i64 0
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [1000 x i8], [1000 x i8]* %2, i64 0, i64 0
%6 = call i32 @escape(i8* %5, i8* %3)
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %5)
ret i32 0
}
void fd18(int n) {
P0A:
  goto P0A;
  {
    typedef int(*b)[n];
  p01A:
    goto p01A;
    goto a;
  a : {
    typedef int(*c)[n];
  P012A:
    goto P012A;
    0;
  }
  P01B:
    goto P01B;
    {
      typedef int(*d)[n];
    P013A:
      goto P013A;
      0;
    }
  P01C:
    goto P01C;
    ;
    typedef int(*e)[n];
  P014A:
    goto P014A;
    0;
  };
P0B:
  goto P0B;
  {
    typedef int(*f)[n];
  P02A:
    goto P02A;
    {
      typedef int(*g)[n];
    P024A:
      goto P024A;
      0;
    };
  P02B:
    goto P02B;
    {
      typedef int(*h)[n];
    P025A:
      goto P025A;
      0;
    };
  P02C:
    goto P02C;
    ;
    typedef int(*i)[n];
  P026A:
    goto P026A;
    0;
  };
P0C:
  goto P0C;
  ;
  typedef int(*j)[n];
P03A:
  goto P03A;
  0;
P03B:
  goto P03B;
}


x86 assembly (clang, -O0):
<fd18>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <fd18+0x7>

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

LLVM IR (-O0):
define void @fd18(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %3, %1
br label %3
4: ; No predecessors!
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %7, %4
br label %7
8: ; No predecessors!
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
br label %11
11: ; preds = %11, %8
br label %11
12: ; preds = %12
br label %12
13: ; No predecessors!
%14 = load i32, i32* %2
%15 = zext i32 %14 to i64
br label %16
16: ; preds = %16, %13
br label %16
17: ; preds = %17
br label %17
18: ; No predecessors!
%19 = load i32, i32* %2
%20 = zext i32 %19 to i64
br label %21
21: ; preds = %21, %18
br label %21
22: ; preds = %22
br label %22
23: ; No predecessors!
%24 = load i32, i32* %2
%25 = zext i32 %24 to i64
br label %26
26: ; preds = %26, %23
br label %26
27: ; No predecessors!
%28 = load i32, i32* %2
%29 = zext i32 %28 to i64
br label %30
30: ; preds = %30, %27
br label %30
31: ; preds = %31
br label %31
32: ; No predecessors!
%33 = load i32, i32* %2
%34 = zext i32 %33 to i64
br label %35
35: ; preds = %35, %32
br label %35
36: ; preds = %36
br label %36
37: ; No predecessors!
%38 = load i32, i32* %2
%39 = zext i32 %38 to i64
br label %40
40: ; preds = %40, %37
br label %40
41: ; preds = %41
br label %41
42: ; No predecessors!
%43 = load i32, i32* %2
%44 = zext i32 %43 to i64
br label %45
45: ; preds = %45, %42
br label %45
46: ; preds = %46
br label %46
}

LLVM IR (-O2):
define void @fd18(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ _PROCEDURE_LINKAGE_TABLE_();
void strcpy() {
  _PROCEDURE_LINKAGE_TABLE_();
  return;
}


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

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

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

LLVM IR (-O2):
define void @strcpy() {
%1 = tail call i32 (...) @_PROCEDURE_LINKAGE_TABLE_()
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("Hello world\n");
  return EXIT_SUCCESS;
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"Hello world\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [12 x i8] c"Hello world\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
/* Variables and functions */
char *malloc(int const);
int /*<<< orphan*/ memcpy(char *, char const *const, int const);
int strlen(char const *const);
char *util_copy_string(const char *const string) {
  const int string_size = sizeof(char) * (strlen(string) + 1);
  char *string_copy = malloc(string_size);
  memcpy(string_copy, string, string_size);
  return string_copy;
}


x86 assembly (clang, -O0):
<util_copy_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_copy_string>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
lea    0x1(%rax),%ebp
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @util_copy_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = add nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = mul i64 1, %8
%10 = trunc i64 %9 to i32
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = call i8* @malloc(i32 %11)
store i8* %12, i8** %4
%13 = load i8*, i8** %4
%14 = load i8*, i8** %2
%15 = load i32, i32* %3
%16 = call i32 @memcpy(i8* %13, i8* %14, i32 %15)
%17 = load i8*, i8** %4
ret i8* %17
}

LLVM IR (-O2):
define i8* @util_copy_string(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @memcpy(i8* %4, i8* %0, i32 %3)
ret i8* %4
}
/* Variables and functions */
int nondet_int();
main() {
  int x = nondet_int();
  int y = nondet_int();
  if (y > 0) {
    while (x < 100) {
      x = x + y;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <nondet_int@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    115f <main+0x4f>
jmp    1142 <main+0x32>
cmpl   $0x64,-0x8(%rbp)
jge    115a <main+0x4a>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <main+0x32>
jmp    115f <main+0x4f>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <nondet_int@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <nondet_int@plt>
test   %eax,%eax
jle    1137 <main+0x27>
cmp    $0x63,%ebx
jg     1137 <main+0x27>
nopw   0x0(%rax,%rax,1)
add    %eax,%ebx
cmp    $0x64,%ebx
jl     1130 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @nondet_int()
%2 = tail call i32 (...) @nondet_int()
%3 = icmp sgt i32 %2, 0
%4 = icmp slt i32 %1, 100
%5 = select i1 %3, i1 %4, i1 false
br i1 %5, label %6, label %10
6: ; preds = %0, %6
%7 = phi i32 [ %8, %6 ], [ %1, %0 ]
%8 = add nsw i32 %7, %2
%9 = icmp slt i32 %8, 100
br i1 %9, label %6, label %10
10: ; preds = %6, %0
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ siginfo_t;

/* Variables and functions */
int /*<<< orphan*/ asm_sig_print(int, int /*<<< orphan*/ *, void *);
void sigfn_fpe(int signum, siginfo_t *siginfo, void *puctx) {
  asm_sig_print(signum, siginfo, puctx);
}


x86 assembly (clang, -O0):
<sigfn_fpe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <asm_sig_print@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigfn_fpe>:
jmp    1030 <asm_sig_print@plt>

LLVM IR (-O0):
define void @sigfn_fpe(i32 %0, i32* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i8*
store i32 %0, i32* %4
store i32* %1, i32** %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = load i32*, i32** %5
%9 = load i8*, i8** %6
%10 = call i32 @asm_sig_print(i32 %7, i32* %8, i8* %9)
ret void
}

LLVM IR (-O2):
define void @sigfn_fpe(i32 %0, i32* %1, i8* %2) {
%4 = tail call i32 @asm_sig_print(i32 %0, i32* %1, i8* %2)
ret void
}