xunge/DecIR huggingface dataset:
int byte_row_hkscs(int byte) {
  if (byte >= 0x80 && byte < 0xff)
    return byte - 0x80;
  else
    return -1;
}


x86 assembly (clang, -O0):
<byte_row_hkscs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x80,-0x8(%rbp)
jl     1131 <byte_row_hkscs+0x31>
cmpl   $0xff,-0x8(%rbp)
jge    1131 <byte_row_hkscs+0x31>
mov    -0x8(%rbp),%eax
sub    $0x80,%eax
mov    %eax,-0x4(%rbp)
jmp    1138 <byte_row_hkscs+0x38>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<byte_row_hkscs>:
lea    -0x80(%rdi),%ecx
cmp    $0x7f,%ecx
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @byte_row_hkscs(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 128
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 255
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 128
store i32 %11, i32* %2
br label %13
12: ; preds = %6, %1
store i32 -1, i32* %2
br label %13
13: ; preds = %12, %9
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @byte_row_hkscs(i32 %0) {
%2 = add i32 %0, -128
%3 = icmp ult i32 %2, 127
%4 = select i1 %3, i32 %2, i32 -1
ret i32 %4
}
int label_case(char x) {
  int ret = 0;
  switch (x) {
  case 1:
    ret++;
    goto l;
  l:
  case 2:
  case 3:
    ret++;
    break;
  }
  return ret;
}


x86 assembly (clang, -O0):
<label_case>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     113a <label_case+0x3a>
jmp    1126 <label_case+0x26>
mov    -0xc(%rbp),%eax
add    $0xfffffffe,%eax
sub    $0x2,%eax
jb     1148 <label_case+0x48>
jmp    1151 <label_case+0x51>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1148 <label_case+0x48>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<label_case>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0x2,%edi
ja     1117 <label_case+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @label_case(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %3
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
switch i32 %5, label %13 [
i32 1, label %6
i32 2, label %10
i32 3, label %10
]
6: ; preds = %1
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
store i32 %8, i32* %3
br label %9
9: ; preds = %6
br label %10
10: ; preds = %1, %1, %9
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %13
13: ; preds = %1, %10
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
@switch.table.label_case = [3 x i32] [i32 2, i32 1, i32 1]
define i32 @label_case(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -1
%4 = icmp ult i32 %3, 3
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = sext i32 %3 to i64
%7 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.label_case, i64 0, i64 %6
%8 = load i32, i32* %7
br label %9
9: ; preds = %1, %5
%10 = phi i32 [ 0, %1 ], [ %8, %5 ]
ret i32 %10
}
/* Variables and functions */
double StringToNumberInternal(char *, int, char const, char const);
double StringToNumberFromFile2(char *input, const char decimalSeparator,
                               const char thousandSeparator) {
  return StringToNumberInternal(input, 1, decimalSeparator, thousandSeparator);
}


x86 assembly (clang, -O0):
<StringToNumberFromFile2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x9(%rbp),%al
mov    $0x1,%esi
movsbl %al,%edx
movsbl -0xa(%rbp),%ecx
call   1030 <StringToNumberInternal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StringToNumberFromFile2>:
mov    %edx,%ecx
mov    %esi,%edx
mov    $0x1,%esi
jmp    1030 <StringToNumberInternal@plt>

LLVM IR (-O0):
define double @StringToNumberFromFile2(i8* %0, i8 signext %1, i8 signext %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** %4
%8 = load i8, i8* %5
%9 = load i8, i8* %6
%10 = call double @StringToNumberInternal(i8* %7, i32 1, i8 signext %8, i8 signext %9)
ret double %10
}

LLVM IR (-O2):
define double @StringToNumberFromFile2(i8* %0, i8 signext %1, i8 signext %2) {
%4 = tail call double @StringToNumberInternal(i8* %0, i32 1, i8 signext %1, i8 signext %2)
ret double %4
}
/* Variables and functions */
int fact(int);
int binomial_slow(int n, int p) { return fact(n) / (fact(p) * fact(n - p)); }


x86 assembly (clang, -O0):
<binomial_slow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <fact@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <fact@plt>
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1030 <fact@plt>
mov    -0x10(%rbp),%ecx
mov    %eax,%edx
mov    -0xc(%rbp),%eax
imul   %edx,%ecx
cltd
idiv   %ecx
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binomial_slow>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
call   1030 <fact@plt>
mov    %eax,%r14d
mov    %ebx,%edi
call   1030 <fact@plt>
mov    %eax,%r15d
sub    %ebx,%ebp
mov    %ebp,%edi
call   1030 <fact@plt>
mov    %eax,%ecx
imul   %r15d,%ecx
mov    %r14d,%eax
cltd
idiv   %ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @binomial_slow(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 = call i32 @fact(i32 %5)
%7 = load i32, i32* %4
%8 = call i32 @fact(i32 %7)
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = sub nsw i32 %9, %10
%12 = call i32 @fact(i32 %11)
%13 = mul nsw i32 %8, %12
%14 = sdiv i32 %6, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @binomial_slow(i32 %0, i32 %1) {
%3 = tail call i32 @fact(i32 %0)
%4 = tail call i32 @fact(i32 %1)
%5 = sub nsw i32 %0, %1
%6 = tail call i32 @fact(i32 %5)
%7 = mul nsw i32 %6, %4
%8 = sdiv i32 %3, %7
ret i32 %8
}
void __attribute__((no)) HEX00_timesInit(void) {}


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
define void @HEX00_timesInit() {
ret void
}
void think(int i) { return; }


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

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

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

LLVM IR (-O2):
define void @think(i32 %0) {
ret void
}
/* Variables and functions */
int f104(int *);
int f105(int *p) { return f104(p); }


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

x86 assembly (clang, -O2):
<f105>:
jmp    1030 <f104@plt>

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

LLVM IR (-O2):
define i32 @f105(i32* %0) {
%2 = tail call i32 @f104(i32* %0)
ret i32 %2
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
scalar_t__ nrf_802154_rssi_sample_temp_corr_value_get();
uint8_t nrf_802154_rssi_sample_corrected_get(uint8_t rssi_sample) {
  return rssi_sample + nrf_802154_rssi_sample_temp_corr_value_get();
}


x86 assembly (clang, -O0):
<nrf_802154_rssi_sample_corrected_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <nrf_802154_rssi_sample_temp_corr_value_get@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nrf_802154_rssi_sample_corrected_get>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <nrf_802154_rssi_sample_temp_corr_value_get@plt>
add    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @nrf_802154_rssi_sample_corrected_get(i64 %0) {
%2 = tail call i64 (...) @nrf_802154_rssi_sample_temp_corr_value_get()
%3 = add nsw i64 %2, %0
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ send_tms_zeros(int);
int runidle(int num) {
  int num_ = num;
  int block_size;
  while (num_ > 16384) {
    send_tms_zeros(16384);
    num_ -= 16384;
  }
  if (num_) {
    send_tms_zeros(num_);
  }
  return 1;
}


x86 assembly (clang, -O0):
<runidle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x4000,-0x8(%rbp)
jle    1148 <runidle+0x38>
mov    $0x4000,%edi
call   1030 <send_tms_zeros@plt>
mov    -0x8(%rbp),%eax
sub    $0x4000,%eax
mov    %eax,-0x8(%rbp)
jmp    1121 <runidle+0x11>
cmpl   $0x0,-0x8(%rbp)
je     115a <runidle+0x4a>
mov    -0x8(%rbp),%edi
call   1030 <send_tms_zeros@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runidle>:
push   %rbx
cmp    $0x4001,%edi
jl     113c <runidle+0x2c>
mov    %edi,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x4000,%edi
call   1030 <send_tms_zeros@plt>
lea    -0x4000(%rbx),%edi
cmp    $0x8000,%ebx
mov    %edi,%ebx
ja     1120 <runidle+0x10>
jmp    1140 <runidle+0x30>
test   %edi,%edi
je     1145 <runidle+0x35>
call   1030 <send_tms_zeros@plt>
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @runidle(i32 %0) {
%2 = icmp sgt i32 %0, 16384
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ %0, %1 ]
%5 = tail call i32 @send_tms_zeros(i32 16384)
%6 = add nsw i32 %4, -16384
%7 = icmp ugt i32 %4, 32768
br i1 %7, label %3, label %10
8: ; preds = %1
%9 = icmp eq i32 %0, 0
br i1 %9, label %13, label %10
10: ; preds = %3, %8
%11 = phi i32 [ %0, %8 ], [ %6, %3 ]
%12 = tail call i32 @send_tms_zeros(i32 %11)
br label %13
13: ; preds = %10, %8
ret i32 1
}
f(x) int x;
{
  if (x != 7)
    abort();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
je     112a <f+0x1a>
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
cmp    $0x7,%edi
jne    1116 <f+0x6>
ret
push   %rax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ne i32 %4, 7
br i1 %5, label %6, label %7
6: ; preds = %1
unreachable
7: ; preds = %1
%8 = load i32, i32* %2
ret i32 %8
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = icmp eq i32 %0, 7
br i1 %2, label %4, label %3
3: ; preds = %1
tail call void @abort()
unreachable
4: ; preds = %1
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ addToTree(char *);
int /*<<< orphan*/ dequeueList();
int /*<<< orphan*/ peekList();
scalar_t__ strcmp(int /*<<< orphan*/, char *);
int equal() {
  if (strcmp(peekList(), "=") != 0) {
    return 0;
  }
  dequeueList();
  addToTree("=");
  return 1;
}


x86 assembly (clang, -O0):
<equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <peekList@plt>
mov    %eax,%edi
lea    0xea8(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1173 <equal+0x33>
movl   $0x0,-0x4(%rbp)
jmp    118d <equal+0x4d>
mov    $0x0,%al
call   1060 <dequeueList@plt>
lea    0xe7f(%rip),%rdi
call   1040 <addToTree@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equal>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <peekList@plt>
lea    0xeaf(%rip),%rsi
mov    %eax,%edi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1175 <equal+0x35>
xor    %eax,%eax
call   1060 <dequeueList@plt>
lea    0xe95(%rip),%rdi
call   1040 <addToTree@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c"=\00"
define i32 @equal() {
%1 = alloca i32
%2 = call i32 (...) @peekList()
%3 = call i64 @strcmp(i32 %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 0, i32* %1
br label %9
6: ; preds = %0
%7 = call i32 (...) @dequeueList()
%8 = call i32 @addToTree(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %9
9: ; preds = %6, %5
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
@.str = [2 x i8] c"=\00"
define i32 @equal() {
%1 = tail call i32 (...) @peekList()
%2 = tail call i64 @strcmp(i32 %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = tail call i32 (...) @dequeueList()
%6 = tail call i32 @addToTree(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %0, %4
%8 = phi i32 [ 1, %4 ], [ 0, %0 ]
ret i32 %8
}
int ___stub_so_lib_is_not_empty(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @___stub_so_lib_is_not_empty() {
ret i32 0
}

LLVM IR (-O2):
define i32 @___stub_so_lib_is_not_empty() {
ret i32 0
}
/* Variables and functions */
scalar_t__ price_len(int);
int price_lzlen(int offset, int length, int used) {
  int res = 1;
  if (offset >= 5400) {
    length--;
  }
  if (offset >= 0x060000) {
    length--;
  }
  res += price_len(length - 2 + 2);
  return res;
}


x86 assembly (clang, -O0):
<price_lzlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x1518,-0x4(%rbp)
jl     113e <price_lzlen+0x2e>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x60000,-0x4(%rbp)
jl     1154 <price_lzlen+0x44>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
add    $0x2,%edi
call   1030 <price_len@plt>
mov    %rax,%rcx
movslq -0x10(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<price_lzlen>:
push   %rax
xor    %eax,%eax
cmp    $0x1518,%edi
setge  %al
sub    %eax,%esi
xor    %eax,%eax
cmp    $0x60000,%edi
setge  %al
sub    %eax,%esi
mov    %esi,%edi
call   1030 <price_len@plt>
add    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @price_lzlen(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, 5399
%5 = sext i1 %4 to i32
%6 = add nsw i32 %5, %1
%7 = icmp sgt i32 %0, 393215
%8 = sext i1 %7 to i32
%9 = add nsw i32 %6, %8
%10 = tail call i64 @price_len(i32 %9)
%11 = trunc i64 %10 to i32
%12 = add i32 %11, 1
ret i32 %12
}
void test_identifier_conflicts_with_cplusplus(void) { int new; }


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

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

LLVM IR (-O0):
define void @test_identifier_conflicts_with_cplusplus() {
%1 = alloca i32
ret void
}

LLVM IR (-O2):
define void @test_identifier_conflicts_with_cplusplus() {
ret void
}
int ishexchar(const char x) {
  return ('0' <= x && x <= '9') || ('a' <= x && x <= 'f') ||
         ('A' <= x && x <= 'F');
}


x86 assembly (clang, -O0):
<ishexchar>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jg     112d <ishexchar+0x2d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x39,%ecx
mov    %al,-0x2(%rbp)
jle    1179 <ishexchar+0x79>
movsbl -0x1(%rbp),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
jg     1150 <ishexchar+0x50>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x66,%ecx
mov    %al,-0x2(%rbp)
jle    1179 <ishexchar+0x79>
movsbl -0x1(%rbp),%edx
xor    %eax,%eax
mov    $0x41,%ecx
cmp    %edx,%ecx
mov    %al,-0x3(%rbp)
jg     1173 <ishexchar+0x73>
movsbl -0x1(%rbp),%eax
cmp    $0x46,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ishexchar>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
setb   %al
and    $0xdf,%dil
add    $0xbf,%dil
cmp    $0x6,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @ishexchar(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sle i32 48, %4
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br i1 %9, label %28, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sle i32 97, %12
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 102
br i1 %17, label %28, label %18
18: ; preds = %14, %10
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp sle i32 65, %20
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
%25 = icmp sle i32 %24, 70
br label %26
26: ; preds = %22, %18
%27 = phi i1 [ false, %18 ], [ %25, %22 ]
br label %28
28: ; preds = %26, %14, %6
%29 = phi i1 [ true, %14 ], [ true, %6 ], [ %27, %26 ]
%30 = zext i1 %29 to i32
ret i32 %30
}

LLVM IR (-O2):
define i32 @ishexchar(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = and i8 %0, -33
%5 = add i8 %4, -65
%6 = icmp ult i8 %5, 6
%7 = or i1 %3, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int u8isloweri(int /*<<< orphan*/);
int /*<<< orphan*/ u8tointc(char *);
int u8islowerc(char *c) { return u8isloweri(u8tointc(c)); }


x86 assembly (clang, -O0):
<u8islowerc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <u8tointc@plt>
mov    %eax,%edi
call   1040 <u8isloweri@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<u8islowerc>:
push   %rax
call   1030 <u8tointc@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <u8isloweri@plt>

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

LLVM IR (-O2):
define i32 @u8islowerc(i8* %0) {
%2 = tail call i32 @u8tointc(i8* %0)
%3 = tail call i32 @u8isloweri(i32 %2)
ret i32 %3
}
/* Type definitions */
struct param_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ param_add_string(char *, char *, struct param_list **,
                                    int *);
int /*<<< orphan*/ sprintf(char *, char *, unsigned long);
void param_add_dec(char *name, unsigned long value, struct param_list **param,
                   int *count) {
  char buffer[1024];
  sprintf(buffer, "%ld", value);
  param_add_string(name, buffer, param, count);
}


x86 assembly (clang, -O0):
<param_add_dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeb3(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x420(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <param_add_string@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<param_add_dec>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rdx
mov    %rdi,%rbx
lea    0xebf(%rip),%rsi
mov    %rsp,%r12
mov    %r12,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <param_add_string@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.param_list = type { i32 }
@.str = [4 x i8] c"%ld\00"
define void @param_add_dec(i8* %0, i64 %1, %struct.param_list** %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca %struct.param_list**
%8 = alloca i32*
%9 = alloca [1024 x i8]
store i8* %0, i8** %5
store i64 %1, i64* %6
store %struct.param_list** %2, %struct.param_list*** %7
store i32* %3, i32** %8
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%11 = load i64, i64* %6
%12 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %11)
%13 = load i8*, i8** %5
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%15 = load %struct.param_list**, %struct.param_list*** %7
%16 = load i32*, i32** %8
%17 = call i32 @param_add_string(i8* %13, i8* %14, %struct.param_list** %15, i32* %16)
ret void
}

LLVM IR (-O2):
%struct.param_list = type { i32 }
@.str = [4 x i8] c"%ld\00"
define void @param_add_dec(i8* %0, i64 %1, %struct.param_list** %2, i32* %3) {
%5 = alloca [1024 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %1)
%8 = call i32 @param_add_string(i8* %0, i8* %6, %struct.param_list** %2, i32* %3)
ret void
}
/* Type definitions */
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
void timer_start(double *timestamp) {
  struct timeval time;
  double million = 1e6;
  gettimeofday(&time, 0);
  *timestamp = time.tv_sec + time.tv_usec / million;
}


x86 assembly (clang, -O0):
<timer_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  0xedc(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
divsd  -0x20(%rbp),%xmm1
addsd  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_start>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  0x8(%rsp),%xmm0
divsd  0xed0(%rip),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
define void @timer_start(double* %0) {
%2 = alloca double*
%3 = alloca %struct.timeval
%4 = alloca double
store double* %0, double** %2
store double 1.000000e+06, double* %4
%5 = call i32 @gettimeofday(%struct.timeval* %3, i32 0)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%7 = load double, double* %6
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%9 = load double, double* %8
%10 = load double, double* %4
%11 = fdiv double %9, %10
%12 = fadd double %7, %11
%13 = load double*, double** %2
store double %12, double* %13
ret void
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
define void @timer_start(double* nocapture writeonly %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i32 @gettimeofday(%struct.timeval* %2, i32 0)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%6 = load double, double* %5
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
%8 = load double, double* %7
%9 = fdiv double %8, 1.000000e+06
%10 = fadd double %6, %9
store double %10, double* %0
ret void
}
/* Variables and functions */
int calculate_checksum(char *, int);
int get_checksum(char *);
int validate_checksum(char *s, int len, char *chksum) {
  int calculated = calculate_checksum(s, len);
  int stored = get_checksum(chksum);
  return calculated - stored;
}


x86 assembly (clang, -O0):
<validate_checksum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <calculate_checksum@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <get_checksum@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
sub    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_checksum>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
call   1030 <calculate_checksum@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <get_checksum@plt>
sub    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @validate_checksum(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%9 = load i8*, i8** %4
%10 = load i32, i32* %5
%11 = call i32 @calculate_checksum(i8* %9, i32 %10)
store i32 %11, i32* %7
%12 = load i8*, i8** %6
%13 = call i32 @get_checksum(i8* %12)
store i32 %13, i32* %8
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = sub nsw i32 %14, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @validate_checksum(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @calculate_checksum(i8* %0, i32 %1)
%5 = tail call i32 @get_checksum(i8* %2)
%6 = sub nsw i32 %4, %5
ret i32 %6
}
int main() { return 6; }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    $0x6,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 6
}
/* Type definitions */
struct dstr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dstr_copy(struct dstr *, char const *);
int /*<<< orphan*/ dstr_init(struct dstr *);
void dstr_init_copy(struct dstr *dst, const char *str) {
  dstr_init(dst);
  dstr_copy(dst, str);
}


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

x86 assembly (clang, -O2):
<dstr_init_copy>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <dstr_init@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <dstr_copy@plt>

LLVM IR (-O0):
%struct.dstr = type { i32 }
define void @dstr_init_copy(%struct.dstr* %0, i8* %1) {
%3 = alloca %struct.dstr*
%4 = alloca i8*
store %struct.dstr* %0, %struct.dstr** %3
store i8* %1, i8** %4
%5 = load %struct.dstr*, %struct.dstr** %3
%6 = call i32 @dstr_init(%struct.dstr* %5)
%7 = load %struct.dstr*, %struct.dstr** %3
%8 = load i8*, i8** %4
%9 = call i32 @dstr_copy(%struct.dstr* %7, i8* %8)
ret void
}

LLVM IR (-O2):
%struct.dstr = type { i32 }
define void @dstr_init_copy(%struct.dstr* %0, i8* %1) {
%3 = tail call i32 @dstr_init(%struct.dstr* %0)
%4 = tail call i32 @dstr_copy(%struct.dstr* %0, i8* %1)
ret void
}
unsigned long get_user_dlong(const long long *addr) { return *addr; }


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

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

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

LLVM IR (-O2):
define i64 @get_user_dlong(i64* nocapture %0) {
%2 = load i64, i64* %0
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_warnIfReached();
void f11_0(void) {
  int x;
  x++;
  clang_analyzer_warnIfReached();
}


x86 assembly (clang, -O0):
<f11_0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <clang_analyzer_warnIfReached@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f11_0() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = add nsw i32 %2, 1
store i32 %3, i32* %1
%4 = call i32 (...) @clang_analyzer_warnIfReached()
ret void
}

LLVM IR (-O2):
define void @f11_0() {
%1 = tail call i32 (...) @clang_analyzer_warnIfReached()
ret void
}
/* Variables and functions */
size_t strlen(const char *str) {
  const char *end = str;
  for (;;) {
    if (*end == 0) {
      return (end - str);
    }
    end++;
  }
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    112d <strlen+0x2d>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
ret i64 %10
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void __c_free(void *p) { free(p); }


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

x86 assembly (clang, -O2):
<__c_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @__c_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int dice() {
  srand(time(NULL));
  int b = rand() % 6 + 1;
  return b;
}


x86 assembly (clang, -O0):
<dice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x6,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dice>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,2),%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @dice() {
%1 = alloca i32
%2 = call i32 @time(i32* null)
%3 = call i32 @srand(i32 %2)
%4 = call i32 (...) @rand()
%5 = srem i32 %4, 6
%6 = add nsw i32 %5, 1
store i32 %6, i32* %1
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
define i32 @dice() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 6
%5 = add nsw i32 %4, 1
ret i32 %5
}
short __ocl_convert_short_float(float src) { return (short)src; }


x86 assembly (clang, -O0):
<__ocl_convert_short_float>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvttss2si %xmm0,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ocl_convert_short_float>:
cvttss2si %xmm0,%eax
ret

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

LLVM IR (-O2):
define signext i16 @__ocl_convert_short_float(float %0) {
%2 = fptosi float %0 to i16
ret i16 %2
}
float absf(float a) { return (a >= 0 ? a : -a); }


x86 assembly (clang, -O0):
<absf>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1129 <absf+0x29>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1140 <absf+0x40>
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<absf>:
movaps 0xef9(%rip),%xmm1
xorps  %xmm0,%xmm1
xorps  %xmm2,%xmm2
cmpless %xmm0,%xmm2
andps  %xmm2,%xmm0
andnps %xmm1,%xmm2
orps   %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @absf(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp oge float %3, 0.000000e+00
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load float, float* %2
br label %10
7: ; preds = %1
%8 = load float, float* %2
%9 = fneg float %8
br label %10
10: ; preds = %7, %5
%11 = phi float [ %6, %5 ], [ %9, %7 ]
ret float %11
}

LLVM IR (-O2):
define float @absf(float %0) {
%2 = fcmp oge float %0, 0.000000e+00
%3 = fneg float %0
%4 = select i1 %2, float %0, float %3
ret float %4
}
/* Type definitions */
struct btp_thread {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ btp_thread_quality_counts(struct btp_thread *, int *, int *);
float btp_thread_quality(struct btp_thread *thread) {
  int ok_count = 0, all_count = 0;
  btp_thread_quality_counts(thread, &ok_count, &all_count);
  if (0 == all_count)
    return 1;
  return ok_count / (float)all_count;
}


x86 assembly (clang, -O0):
<btp_thread_quality>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <btp_thread_quality_counts@plt>
xor    %eax,%eax
cmp    -0x18(%rbp),%eax
jne    1158 <btp_thread_quality+0x48>
movss  0xeb2(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    116b <btp_thread_quality+0x5b>
cvtsi2ssl -0x14(%rbp),%xmm0
cvtsi2ssl -0x18(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btp_thread_quality>:
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1030 <btp_thread_quality_counts@plt>
mov    (%rsp),%eax
test   %eax,%eax
je     1144 <btp_thread_quality+0x34>
cvtsi2ssl 0x4(%rsp),%xmm0
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
pop    %rax
ret
movss  0xeb4(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
%struct.btp_thread = type { i32 }
define float @btp_thread_quality(%struct.btp_thread* %0) {
%2 = alloca float
%3 = alloca %struct.btp_thread*
%4 = alloca i32
%5 = alloca i32
store %struct.btp_thread* %0, %struct.btp_thread** %3
store i32 0, i32* %4
store i32 0, i32* %5
%6 = load %struct.btp_thread*, %struct.btp_thread** %3
%7 = call i32 @btp_thread_quality_counts(%struct.btp_thread* %6, i32* %4, i32* %5)
%8 = load i32, i32* %5
%9 = icmp eq i32 0, %8
br i1 %9, label %10, label %11
10: ; preds = %1
store float 1.000000e+00, float* %2
br label %17
11: ; preds = %1
%12 = load i32, i32* %4
%13 = sitofp i32 %12 to float
%14 = load i32, i32* %5
%15 = sitofp i32 %14 to float
%16 = fdiv float %13, %15
store float %16, float* %2
br label %17
17: ; preds = %11, %10
%18 = load float, float* %2
ret float %18
}

LLVM IR (-O2):
%struct.btp_thread = type { i32 }
define float @btp_thread_quality(%struct.btp_thread* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%6 = call i32 @btp_thread_quality_counts(%struct.btp_thread* %0, i32* %2, i32* %3)
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %14, label %9
9: ; preds = %1
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to float
%12 = sitofp i32 %7 to float
%13 = fdiv float %11, %12
br label %14
14: ; preds = %1, %9
%15 = phi float [ %13, %9 ], [ 1.000000e+00, %1 ]
ret float %15
}
/* Variables and functions */
void *Bar4(int, int);
int /*<<< orphan*/ printf(char *, long);
int main() {
  void *res;
  res = Bar4(6, 8);
  printf("main: res = %lx\n", (long)res);
  res = Bar4(10, 12);
  printf("main: res = %lx\n", (long)res);
  res = Bar4(14, 16);
  printf("main: res = %lx\n", (long)res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x6,%edi
mov    $0x8,%esi
call   1040 <Bar4@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%edi
mov    $0xc,%esi
call   1040 <Bar4@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
mov    $0xe,%edi
mov    $0x10,%esi
call   1040 <Bar4@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x6,%edi
mov    $0x8,%esi
call   1040 <Bar4@plt>
lea    0xec9(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    $0xa,%edi
mov    $0xc,%esi
call   1040 <Bar4@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    $0xe,%edi
mov    $0x10,%esi
call   1040 <Bar4@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"main: res = %lx\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @Bar4(i32 6, i32 8)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = ptrtoint i8* %4 to i64
%6 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %5)
%7 = call i8* @Bar4(i32 10, i32 12)
store i8* %7, i8** %2
%8 = load i8*, i8** %2
%9 = ptrtoint i8* %8 to i64
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %9)
%11 = call i8* @Bar4(i32 14, i32 16)
store i8* %11, i8** %2
%12 = load i8*, i8** %2
%13 = ptrtoint i8* %12 to i64
%14 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"main: res = %lx\0A\00"
define i32 @main() {
%1 = tail call i8* @Bar4(i32 6, i32 8)
%2 = ptrtoint i8* %1 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i8* @Bar4(i32 10, i32 12)
%5 = ptrtoint i8* %4 to i64
%6 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %5)
%7 = tail call i8* @Bar4(i32 14, i32 16)
%8 = ptrtoint i8* %7 to i64
%9 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i64 %8)
ret i32 0
}
/* Variables and functions */
float sqrt(int);
float etr_side_high(float high) {
  float square_root_3 = sqrt(3);
  float side = 2 * high / square_root_3;
  return side;
}


x86 assembly (clang, -O0):
<etr_side_high>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
mov    $0x3,%edi
call   1030 <sqrt@plt>
movss  %xmm0,-0x8(%rbp)
movss  0xecc(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<etr_side_high>:
push   %rax
movss  %xmm0,0x4(%rsp)
mov    $0x3,%edi
call   1030 <sqrt@plt>
movss  0x4(%rsp),%xmm1
addss  %xmm1,%xmm1
divss  %xmm0,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @etr_side_high(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %2
%5 = call float @sqrt(i32 3)
store float %5, float* %3
%6 = load float, float* %2
%7 = fmul float 2.000000e+00, %6
%8 = load float, float* %3
%9 = fdiv float %7, %8
store float %9, float* %4
%10 = load float, float* %4
ret float %10
}

LLVM IR (-O2):
define float @etr_side_high(float %0) {
%2 = tail call float @sqrt(i32 3)
%3 = fmul float %0, 2.000000e+00
%4 = fdiv float %3, %2
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int main() {
  unsigned int y = 1023;
  unsigned int k = 1;
  while (k * k <= 2 * y) {
    k++;
  }
  printf("%d \n", k - 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3ff,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    $0x1,%ecx
cmp    %ecx,%eax
ja     1150 <main+0x40>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112d <main+0x1d>
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [5 x i8] c"%d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 1023, i32* %2
store i32 1, i32* %3
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %3
%6 = load i32, i32* %3
%7 = mul i32 %5, %6
%8 = load i32, i32* %2
%9 = mul i32 2, %8
%10 = icmp ule i32 %7, %9
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = load i32, i32* %3
%13 = add i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
%15 = load i32, i32* %3
%16 = sub i32 %15, 1
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d \0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 45)
ret i32 0
}
long lmax(long x, long y) { return (x >= y) ? x : y; }


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

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

LLVM IR (-O0):
define i64 @lmax(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 sge 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 @lmax(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, %1
%4 = select i1 %3, i64 %1, i64 %0
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ set_pwm(int, int);
void set_pwm_left(int pwm) { set_pwm(1, pwm); }


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

x86 assembly (clang, -O2):
<set_pwm_left>:
mov    %edi,%esi
mov    $0x1,%edi
jmp    1030 <set_pwm@plt>

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

LLVM IR (-O2):
define void @set_pwm_left(i32 %0) {
%2 = tail call i32 @set_pwm(i32 1, i32 %0)
ret void
}
int test_imm_EFint64_midword_mem(long long *val) {
  return ((*val >> 16) & (0xEF << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_EFint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 239
%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_EFint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 15663104
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
struct format_option {
  int dummy;
};

/* Variables and functions */
int format_valid_sub(char const *, struct format_option const *,
                     int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
int format_valid(const char *format, const struct format_option *fopts) {
  return format_valid_sub(format, fopts, strlen(format));
}


x86 assembly (clang, -O0):
<format_valid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1040 <format_valid_sub@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<format_valid>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <format_valid_sub@plt>

LLVM IR (-O0):
%struct.format_option = type { i32 }
define i32 @format_valid(i8* %0, %struct.format_option* %1) {
%3 = alloca i8*
%4 = alloca %struct.format_option*
store i8* %0, i8** %3
store %struct.format_option* %1, %struct.format_option** %4
%5 = load i8*, i8** %3
%6 = load %struct.format_option*, %struct.format_option** %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @format_valid_sub(i8* %5, %struct.format_option* %6, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
%struct.format_option = type { i32 }
define i32 @format_valid(i8* %0, %struct.format_option* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @format_valid_sub(i8* %0, %struct.format_option* %1, i32 %3)
ret i32 %4
}