xunge/DecIR huggingface dataset:
/* Variables and functions */
int get_unsigned_bit_size(long);
int get_signed_bit_size(long v) {
  if (v < 0)
    return get_unsigned_bit_size(-v - 1) + 1;
  return get_unsigned_bit_size(v) + 1;
}


x86 assembly (clang, -O0):
<get_signed_bit_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    1143 <get_signed_bit_size+0x33>
xor    %eax,%eax
mov    %eax,%edi
sub    -0x10(%rbp),%rdi
sub    $0x1,%rdi
call   1030 <get_unsigned_bit_size@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1152 <get_signed_bit_size+0x42>
mov    -0x10(%rbp),%rdi
call   1030 <get_unsigned_bit_size@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_signed_bit_size>:
push   %rax
mov    %rdi,%rax
sar    $0x3f,%rax
xor    %rax,%rdi
call   1030 <get_unsigned_bit_size@plt>
add    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @get_signed_bit_size(i64 %0) {
%2 = ashr i64 %0, 63
%3 = xor i64 %2, %0
%4 = tail call i32 @get_unsigned_bit_size(i64 %3)
%5 = add nsw i32 %4, 1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ wm_1_setter(int);
int init_wasm(int n) {
  const int max = 1000000;
  if (n > max) {
    n = max;
    fprintf(stderr, "Asking for too much, vector.wast only allows 1M elements, "
                    "setting to 1M\n");
  }
  wm_1_setter(n);
  return 1;
}


x86 assembly (clang, -O0):
<init_wasm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0xf4240,-0x8(%rbp)
cmpl   $0xf4240,-0x4(%rbp)
jle    115b <init_wasm+0x3b>
movl   $0xf4240,-0x4(%rbp)
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
lea    0xeaa(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%edi
call   1040 <wm_1_setter@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_wasm>:
push   %rax
cmp    $0xf4241,%edi
jl     1143 <init_wasm+0x23>
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    0xec7(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xf4240,%edi
call   1040 <wm_1_setter@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [73 x i8] c"Asking for too much, vector.wast only allows 1M elements, setting to 1M\0A\00"
define i32 @init_wasm(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 1000000, i32* %3
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 1000000
br i1 %5, label %6, label %9
6: ; preds = %1
store i32 1000000, i32* %2
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %6, %1
%10 = load i32, i32* %2
%11 = call i32 @wm_1_setter(i32 %10)
ret i32 1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [73 x i8] c"Asking for too much, vector.wast only allows 1M elements, setting to 1M\0A\00"
define i32 @init_wasm(i32 %0) {
%2 = icmp sgt i32 %0, 1000000
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %3, %1
%7 = phi i32 [ 1000000, %3 ], [ %0, %1 ]
%8 = tail call i32 @wm_1_setter(i32 %7)
ret i32 1
}
void fn_SYSCALL1(void) {}


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

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

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

LLVM IR (-O2):
define void @fn_SYSCALL1() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
void s500_writel(uint32_t val, volatile uint32_t *addr) { *addr = val; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @s500_writel(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
store volatile i32 %5, i32* %6
ret void
}

LLVM IR (-O2):
define void @s500_writel(i32 %0, i32* %1) {
store volatile i32 %0, i32* %1
ret void
}
/* Variables and functions */
int strcmp(char *const, char *const);
int string_cmp(const void *_p1, const void *_p2) {
  char *const *p1 = _p1;
  char *const *p2 = _p2;
  return strcmp(*p1, *p2);
}


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

x86 assembly (clang, -O2):
<string_cmp>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @string_cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
store i8** %8, i8*** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i8**
store i8** %10, i8*** %6
%11 = load i8**, i8*** %5
%12 = load i8*, i8** %11
%13 = load i8**, i8*** %6
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* %12, i8* %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @string_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = bitcast i8* %1 to i8**
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(1) %6)
ret i32 %7
}
int func(int i) { return i; }


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

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

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

LLVM IR (-O2):
define i32 @func(i32 returned %0) {
ret i32 %0
}
void delay(unsigned int ms) { return; }


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

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

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

LLVM IR (-O2):
define void @delay(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ bar();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ foo();
int main(int argc, char *argv[]) {
  foo();
  bar();
  exit(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)
mov    $0x0,%al
call   1040 <foo@plt>
mov    $0x0,%al
call   1030 <bar@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <foo@plt>
xor    %eax,%eax
call   1030 <bar@plt>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@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 (...) @foo()
%7 = call i32 (...) @bar()
%8 = load i32, i32* @EXIT_SUCCESS
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @foo()
%4 = tail call i32 (...) @bar()
%5 = load i32, i32* @EXIT_SUCCESS
%6 = tail call i32 @exit(i32 %5)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ uvl_clean_unity();
void uvl_pre_clean() { uvl_clean_unity(); }


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

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

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

LLVM IR (-O2):
define void @uvl_pre_clean() {
%1 = tail call i32 (...) @uvl_clean_unity()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
char *strdup(char *);
char *pn_strdup(char *s) {
  char *ret = strdup(s);
  if (!ret) {
    do {
      fprintf(stderr, "Out of memory.\n");
      exit(1);
    } while (0);
  }
  return ret;
}


x86 assembly (clang, -O0):
<pn_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1178 <pn_strdup+0x48>
jmp    1159 <pn_strdup+0x29>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
lea    0xe97(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pn_strdup>:
push   %rax
call   1050 <strdup@plt>
test   %rax,%rax
je     113d <pn_strdup+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [16 x i8] c"Out of memory.\0A\00"
define i8* @pn_strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strdup(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %14, label %8
8: ; preds = %1
br label %9
9: ; preds = %8
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; No predecessors!
br label %14
14: ; preds = %13, %1
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [16 x i8] c"Out of memory.\0A\00"
define noalias i8* @pn_strdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i8* %2
}
int main(void) {
  unsigned char uc;
  uc;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int sign_extend(int x, int len) {
  int signbit = (1 << (len - 1));
  int mask = (signbit << 1) - 1;
  return ((x & mask) ^ signbit) - signbit;
}


x86 assembly (clang, -O0):
<sign_extend>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    -0x10(%rbp),%eax
xor    -0xc(%rbp),%eax
sub    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign_extend>:
mov    %esi,%ecx
add    $0xff,%cl
mov    $0x1,%edx
shl    %cl,%edx
lea    (%rdx,%rdx,1),%eax
add    $0xffffffff,%eax
and    %edi,%eax
btc    %ecx,%eax
sub    %edx,%eax
ret

LLVM IR (-O0):
define i32 @sign_extend(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = sub nsw i32 %7, 1
%9 = shl i32 1, %8
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = shl i32 %10, 1
%12 = sub nsw i32 %11, 1
store i32 %12, i32* %6
%13 = load i32, i32* %3
%14 = load i32, i32* %6
%15 = and i32 %13, %14
%16 = load i32, i32* %5
%17 = xor i32 %15, %16
%18 = load i32, i32* %5
%19 = sub nsw i32 %17, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @sign_extend(i32 %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = shl nuw i32 1, %3
%5 = shl i32 %4, 1
%6 = add nsw i32 %5, -1
%7 = and i32 %6, %0
%8 = xor i32 %7, %4
%9 = sub nsw i32 %8, %4
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ led_off();
int /*<<< orphan*/ led_on();
void loop() {
  led_on();
  delay(500);
  led_off();
  delay(500);
  led_on();
  delay(250);
  led_off();
  delay(250);
  led_on();
  delay(125);
  led_off();
  delay(125);
}


x86 assembly (clang, -O0):
<loop>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <led_on@plt>
mov    $0x1f4,%edi
call   1040 <delay@plt>
mov    $0x0,%al
call   1030 <led_off@plt>
mov    $0x1f4,%edi
call   1040 <delay@plt>
mov    $0x0,%al
call   1050 <led_on@plt>
mov    $0xfa,%edi
call   1040 <delay@plt>
mov    $0x0,%al
call   1030 <led_off@plt>
mov    $0xfa,%edi
call   1040 <delay@plt>
mov    $0x0,%al
call   1050 <led_on@plt>
mov    $0x7d,%edi
call   1040 <delay@plt>
mov    $0x0,%al
call   1030 <led_off@plt>
mov    $0x7d,%edi
call   1040 <delay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop>:
push   %rax
xor    %eax,%eax
call   1050 <led_on@plt>
mov    $0x1f4,%edi
call   1040 <delay@plt>
xor    %eax,%eax
call   1030 <led_off@plt>
mov    $0x1f4,%edi
call   1040 <delay@plt>
xor    %eax,%eax
call   1050 <led_on@plt>
mov    $0xfa,%edi
call   1040 <delay@plt>
xor    %eax,%eax
call   1030 <led_off@plt>
mov    $0xfa,%edi
call   1040 <delay@plt>
xor    %eax,%eax
call   1050 <led_on@plt>
mov    $0x7d,%edi
call   1040 <delay@plt>
xor    %eax,%eax
call   1030 <led_off@plt>
mov    $0x7d,%edi
pop    %rax
jmp    1040 <delay@plt>

LLVM IR (-O0):
define void @loop() {
%1 = call i32 (...) @led_on()
%2 = call i32 @delay(i32 500)
%3 = call i32 (...) @led_off()
%4 = call i32 @delay(i32 500)
%5 = call i32 (...) @led_on()
%6 = call i32 @delay(i32 250)
%7 = call i32 (...) @led_off()
%8 = call i32 @delay(i32 250)
%9 = call i32 (...) @led_on()
%10 = call i32 @delay(i32 125)
%11 = call i32 (...) @led_off()
%12 = call i32 @delay(i32 125)
ret void
}

LLVM IR (-O2):
define void @loop() {
%1 = tail call i32 (...) @led_on()
%2 = tail call i32 @delay(i32 500)
%3 = tail call i32 (...) @led_off()
%4 = tail call i32 @delay(i32 500)
%5 = tail call i32 (...) @led_on()
%6 = tail call i32 @delay(i32 250)
%7 = tail call i32 (...) @led_off()
%8 = tail call i32 @delay(i32 250)
%9 = tail call i32 (...) @led_on()
%10 = tail call i32 @delay(i32 125)
%11 = tail call i32 (...) @led_off()
%12 = tail call i32 @delay(i32 125)
ret void
}
int FixedAngMod(int fAngle) {
  if (fAngle > 1.0) {
    fAngle %= 65536;
  } else if (fAngle < 0) {
    fAngle %= (-65536);
    fAngle = fAngle + 65536;
  }
  return fAngle;
}


x86 assembly (clang, -O0):
<FixedAngMod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xeec(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1131 <FixedAngMod+0x31>
mov    -0x4(%rbp),%eax
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
jmp    1159 <FixedAngMod+0x59>
cmpl   $0x0,-0x4(%rbp)
jge    1154 <FixedAngMod+0x54>
mov    -0x4(%rbp),%eax
mov    $0xffff0000,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10000,%eax
mov    %eax,-0x4(%rbp)
jmp    1159 <FixedAngMod+0x59>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<FixedAngMod>:
mov    %edi,%eax
cmp    $0x2,%edi
jl     110b <FixedAngMod+0xb>
movzwl %ax,%eax
ret
test   %eax,%eax
js     1110 <FixedAngMod+0x10>
ret
neg    %eax
movzwl %ax,%ecx
mov    $0x10000,%eax
sub    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @FixedAngMod(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = fcmp ogt double %4, 1.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = srem i32 %7, 65536
store i32 %8, i32* %2
br label %18
9: ; preds = %1
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = load i32, i32* %2
%14 = srem i32 %13, -65536
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 65536
store i32 %16, i32* %2
br label %17
17: ; preds = %12, %9
br label %18
18: ; preds = %17, %6
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @FixedAngMod(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = and i32 %0, 65535
br label %11
5: ; preds = %1
%6 = icmp slt i32 %0, 0
br i1 %6, label %7, label %11
7: ; preds = %5
%8 = sub i32 0, %0
%9 = and i32 %8, 65535
%10 = sub nuw nsw i32 65536, %9
br label %11
11: ; preds = %5, %7, %3
%12 = phi i32 [ %4, %3 ], [ %10, %7 ], [ %0, %5 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) { printf("Hello!\n"); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeda(%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
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [7 x i8] c"Hello!\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void AKSC_HFlucCheck(void) {}


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

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

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

LLVM IR (-O2):
define void @AKSC_HFlucCheck() {
ret void
}
void gestionnaire_sigusr1(int inutile) {}


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

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

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

LLVM IR (-O2):
define void @gestionnaire_sigusr1(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __hosted_from_gdb_errno(int);
int do_syscall(int, int, int /*<<< orphan*/, int /*<<< orphan*/,
               int /*<<< orphan*/, int *);
int /*<<< orphan*/ errno;
int isatty(int fildes) {
  int status;
  int error;
  status = do_syscall(13, fildes, 0, 0, 0, &error);
  if (status == 0)
    errno = __hosted_from_gdb_errno(error);
  return status;
}


x86 assembly (clang, -O0):
<isatty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
mov    $0xd,%edi
xor    %r8d,%r8d
lea    -0xc(%rbp),%r9
mov    %r8d,%edx
mov    %r8d,%ecx
call   1030 <do_syscall@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1165 <isatty+0x45>
mov    -0xc(%rbp),%edi
call   1040 <__hosted_from_gdb_errno@plt>
mov    %eax,%ecx
mov    0x2e7d(%rip),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isatty>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%esi
lea    0xc(%rsp),%r9
mov    $0xd,%edi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <do_syscall@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    1155 <isatty+0x35>
mov    0xc(%rsp),%edi
call   1040 <__hosted_from_gdb_errno@plt>
mov    0x2e8d(%rip),%rcx
mov    %eax,(%rcx)
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @isatty(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @do_syscall(i32 13, i32 %5, i32 0, i32 0, i32 0, i32* %4)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %4
%11 = call i32 @__hosted_from_gdb_errno(i32 %10)
store i32 %11, i32* @errno
br label %12
12: ; preds = %9, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @isatty(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @do_syscall(i32 13, i32 %0, i32 0, i32 0, i32 0, i32* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @__hosted_from_gdb_errno(i32 %7)
store i32 %8, i32* @errno
br label %9
9: ; preds = %6, %1
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ va_list;

/* Variables and functions */
void vsyslog(int priority, const char *format, va_list ap) {
  ((void)(priority));
  ((void)(format));
  ((void)(ap));
}


x86 assembly (clang, -O0):
<vsyslog>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @vsyslog(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
ret void
}

LLVM IR (-O2):
define void @vsyslog(i32 %0, i8* nocapture %1, i64 %2) {
ret void
}
int fun1033() { return 1033; }


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

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

LLVM IR (-O0):
define i32 @fun1033() {
ret i32 1033
}

LLVM IR (-O2):
define i32 @fun1033() {
ret i32 1033
}
/* Variables and functions */
double sqrtf(double);
double sqrt(double value) { return sqrtf(value); }


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

x86 assembly (clang, -O2):
<sqrt>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     111f <sqrt+0xf>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrtf@plt>

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

LLVM IR (-O2):
define double @sqrt(double %0) {
%2 = tail call double @sqrtf(double %0)
ret double %2
}
/* Variables and functions */
unsigned int align_formula(unsigned int, int);
unsigned int align_heap(unsigned int size) {
  return align_formula(size, (1 << 3));
}


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

x86 assembly (clang, -O2):
<align_heap>:
mov    $0x8,%esi
jmp    1030 <align_formula@plt>

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

LLVM IR (-O2):
define i32 @align_heap(i32 %0) {
%2 = tail call i32 @align_formula(i32 %0, i32 8)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ scanf(char *, char *);
main() {
  char c;
  puts("This is used to find the ASCII value for each character.");
  printf("Enter a character: ");
  scanf("%c", &c);
  printf("The ASCII value of %c = %d", c, c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
lea    0xeee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef4(%rip),%rdi
lea    -0x1(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x1(%rbp),%esi
movsbl -0x1(%rbp),%edx
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xefb(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1050 <scanf@plt>
movsbl 0x7(%rsp),%edx
lea    0xee8(%rip),%rdi
mov    %edx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [57 x i8] c"This is used to find the ASCII value for each character.\00"
@.str.1 = [20 x i8] c"Enter a character: \00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [27 x i8] c"The ASCII value of %c = %d\00"
define i32 @main() {
%1 = alloca i8
%2 = call i32 @puts(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = load i8, i8* %1
%8 = sext i8 %7 to i32
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %6, i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [57 x i8] c"This is used to find the ASCII value for each character.\00"
@.str.1 = [20 x i8] c"Enter a character: \00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [27 x i8] c"The ASCII value of %c = %d\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %6, i32 %6)
ret i32 0
}
/* Variables and functions */
int is_Prime(char *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char s[10];
  scanf("%s", s);
  printf("%d", is_Prime(s));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1040 <scanf@plt>
lea    -0xe(%rbp),%rdi
call   1050 <is_Prime@plt>
mov    %eax,%esi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0x6(%rsp),%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1050 <is_Prime@plt>
lea    0xeab(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @is_Prime(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
int ENOSYS;
int proc_cpu_exists(unsigned int);
int sysfs_cpu_exists(unsigned int);
int cpufreq_cpu_exists(unsigned int cpu) {
  int ret = sysfs_cpu_exists(cpu);
  if (ret == -ENOSYS)
    ret = proc_cpu_exists(cpu);
  return (ret);
}


x86 assembly (clang, -O0):
<cpufreq_cpu_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <sysfs_cpu_exists@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
xor    %ecx,%ecx
mov    0x2ea6(%rip),%rdx
sub    (%rdx),%ecx
cmp    %ecx,%eax
jne    1157 <cpufreq_cpu_exists+0x37>
mov    -0x4(%rbp),%edi
call   1040 <proc_cpu_exists@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpufreq_cpu_exists>:
push   %rbx
mov    %edi,%ebx
call   1030 <sysfs_cpu_exists@plt>
mov    0x2eb9(%rip),%rcx
mov    (%rcx),%ecx
add    %eax,%ecx
jne    113d <cpufreq_cpu_exists+0x1d>
mov    %ebx,%edi
pop    %rbx
jmp    1040 <proc_cpu_exists@plt>
pop    %rbx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @cpufreq_cpu_exists(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @sysfs_cpu_exists(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = load i32, i32* @ENOSYS
%8 = sub nsw i32 0, %7
%9 = icmp eq i32 %6, %8
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i32, i32* %2
%12 = call i32 @proc_cpu_exists(i32 %11)
store i32 %12, i32* %3
br label %13
13: ; preds = %10, %1
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @cpufreq_cpu_exists(i32 %0) {
%2 = tail call i32 @sysfs_cpu_exists(i32 %0)
%3 = load i32, i32* @ENOSYS
%4 = sub nsw i32 0, %3
%5 = icmp eq i32 %2, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @proc_cpu_exists(i32 %0)
br label %8
8: ; preds = %6, %1
%9 = phi i32 [ %7, %6 ], [ %2, %1 ]
ret i32 %9
}
/* Variables and functions */
char *strrchr(char *, char);
extern char *rindex(char *a, char b) { return strrchr(a, b); }


x86 assembly (clang, -O0):
<rindex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <strrchr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rindex>:
jmp    1030 <strrchr@plt>

LLVM IR (-O0):
define i8* @rindex(i8* %0, i8 signext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8*, i8** %3
%6 = load i8, i8* %4
%7 = call i8* @strrchr(i8* %5, i8 signext %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @rindex(i8* %0, i8 signext %1) {
%3 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext %1)
ret i8* %3
}
/* Variables and functions */
int __VERIFIER_nondet_int();
int main() {
  int i, j, k, ell;
  i = __VERIFIER_nondet_int();
  j = __VERIFIER_nondet_int();
  k = __VERIFIER_nondet_int();
  while (i <= 100 && j <= k) {
    ell = i;
    i = j;
    j = ell + 1;
    k = k - 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x64,-0x8(%rbp)
mov    %al,-0x15(%rbp)
jg     1158 <main+0x48>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
setle  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1168 <main+0x58>
jmp    118b <main+0x7b>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113d <main+0x2d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
%3 = tail call i32 (...) @__VERIFIER_nondet_int()
ret i32 0
}
/* Variables and functions */
int hardwareAPI(int);
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  printf("calling hardwareAPI(%d) = %d\n", 1, hardwareAPI(1));
  printf("calling hardwareAPI(%d) = %d\n", 10, hardwareAPI(10));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1040 <hardwareAPI@plt>
mov    %eax,%edx
lea    0xebe(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
mov    $0xa,%edi
call   1040 <hardwareAPI@plt>
mov    %eax,%edx
lea    0xea1(%rip),%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
call   1040 <hardwareAPI@plt>
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1030 <printf@plt>
mov    $0xa,%edi
call   1040 <hardwareAPI@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [30 x i8] c"calling hardwareAPI(%d) = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @hardwareAPI(i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 1, i32 %1)
%3 = tail call i32 @hardwareAPI(i32 10)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 10, i32 %3)
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void wi16(uint8_t a[2], uint16_t x) {
  a[0] = x >> 0;
  a[1] = x >> 8;
}


x86 assembly (clang, -O0):
<wi16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x0,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<wi16>:
mov    %esi,(%rdi)
sar    $0x8,%esi
mov    %esi,0x4(%rdi)
ret

LLVM IR (-O0):
define void @wi16(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 = ashr i32 %5, 0
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 0
store i32 %6, i32* %8
%9 = load i32, i32* %4
%10 = ashr i32 %9, 8
%11 = load i32*, i32** %3
%12 = getelementptr inbounds i32, i32* %11, i64 1
store i32 %10, i32* %12
ret void
}

LLVM IR (-O2):
define void @wi16(i32* nocapture writeonly %0, i32 %1) {
store i32 %1, i32* %0
%3 = ashr i32 %1, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %3, i32* %4
ret void
}
int test_imm_24int64_lowword_reg(long long val) {
  return ((val) & (0x24 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_24int64_lowword_reg>:
test   $0x24,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_24int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 36
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fun1();
int /*<<< orphan*/ puts(char *);
int fun2() {
  puts("This is fun2");
  fun1();
  return 0;
}


x86 assembly (clang, -O0):
<fun2>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x0,%al
call   1040 <fun1@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [13 x i8] c"This is fun2\00"
define i32 @fun2() {
%1 = call i32 @puts(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @fun1()
ret i32 0
}

LLVM IR (-O2):
@.str = [13 x i8] c"This is fun2\00"
define i32 @fun2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @fun1()
ret i32 0
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(char *);
int lstat(char *, struct stat *);
char *vfs_translate_path(char const *);
int vfs_lstat(char const *path, struct stat *buf) {
  char *rpath = vfs_translate_path(path);
  if (!rpath) {
    return -1;
  }
  int ret = lstat(rpath, buf);
  free(rpath);
  return ret;
}


x86 assembly (clang, -O0):
<vfs_lstat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <vfs_translate_path@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1164 <vfs_lstat+0x34>
movl   $0xffffffff,-0x4(%rbp)
jmp    1183 <vfs_lstat+0x53>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <lstat@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vfs_lstat>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
call   1050 <vfs_translate_path@plt>
test   %rax,%rax
je     115d <vfs_lstat+0x2d>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <lstat@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
jmp    1162 <vfs_lstat+0x32>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @vfs_lstat(i8* %0, %struct.stat* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.stat*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %4
store %struct.stat* %1, %struct.stat** %5
%8 = load i8*, i8** %4
%9 = call i8* @vfs_translate_path(i8* %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %13, label %12
12: ; preds = %2
store i32 -1, i32* %3
br label %20
13: ; preds = %2
%14 = load i8*, i8** %6
%15 = load %struct.stat*, %struct.stat** %5
%16 = call i32 @lstat(i8* %14, %struct.stat* %15)
store i32 %16, i32* %7
%17 = load i8*, i8** %6
%18 = call i32 @free(i8* %17)
%19 = load i32, i32* %7
store i32 %19, i32* %3
br label %20
20: ; preds = %13, %12
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @vfs_lstat(i8* %0, %struct.stat* nocapture %1) {
%3 = tail call i8* @vfs_translate_path(i8* %0)
%4 = icmp eq i8* %3, null
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @lstat(i8* %3, %struct.stat* %1)
%7 = tail call i32 @free(i8* %3)
br label %8
8: ; preds = %2, %5
%9 = phi i32 [ %6, %5 ], [ -1, %2 ]
ret i32 %9
}
/* Type definitions */
typedef long long uint64_t;
struct timespec {
  long long tv_sec;
  long long tv_nsec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
uint64_t curr_time_ms(void) {
  struct timespec tm;
  clock_gettime(CLOCK_MONOTONIC, &tm);
  return tm.tv_sec * (1000LL) + (tm.tv_nsec / (1000000LL));
}


x86 assembly (clang, -O0):
<curr_time_ms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
imul   $0x3e8,-0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xf4240,%ecx
cqto
idiv   %rcx
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
add    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<curr_time_ms>:
sub    $0x18,%rsp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
imul   $0x3e8,0x8(%rsp),%rcx
movabs $0x431bde82d7b634db,%rax
de 1b 43
imulq  0x10(%rsp)
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x12,%rdx
add    %rdx,%rax
add    %rcx,%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
@CLOCK_MONOTONIC = global i32 0
define i64 @curr_time_ms() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%5 = load i64, i64* %4
%6 = mul nsw i64 %5, 1000
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%8 = load i64, i64* %7
%9 = sdiv i64 %8, 1000000
%10 = add nsw i64 %6, %9
ret i64 %10
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
@CLOCK_MONOTONIC = global i32 0
define i64 @curr_time_ms() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%6 = load i64, i64* %5
%7 = mul nsw i64 %6, 1000
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = sdiv i64 %9, 1000000
%11 = add nsw i64 %10, %7
ret i64 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int get_lines_total_from_file(int /*<<< orphan*/ *);
int has_enough_lines(size_t input_bytes, FILE *cover_fp) {
  int cover_lines_total = get_lines_total_from_file(cover_fp);
  return ((input_bytes * 8 + (sizeof(long) * 8)) <= cover_lines_total);
}


x86 assembly (clang, -O0):
<has_enough_lines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <get_lines_total_from_file@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x3,%rax
add    $0x40,%rax
movslq -0x14(%rbp),%rcx
cmp    %rcx,%rax
setbe  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<has_enough_lines>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <get_lines_total_from_file@plt>
lea    0x40(,%rbx,8),%rcx
movslq %eax,%rdx
xor    %eax,%eax
cmp    %rdx,%rcx
setbe  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @has_enough_lines(i64 %0, i32* %1) {
%3 = alloca i64
%4 = alloca i32*
%5 = alloca i32
store i64 %0, i64* %3
store i32* %1, i32** %4
%6 = load i32*, i32** %4
%7 = call i32 @get_lines_total_from_file(i32* %6)
store i32 %7, i32* %5
%8 = load i64, i64* %3
%9 = mul i64 %8, 8
%10 = add i64 %9, 64
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = icmp ule i64 %10, %12
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @has_enough_lines(i64 %0, i32* %1) {
%3 = tail call i32 @get_lines_total_from_file(i32* %1)
%4 = shl i64 %0, 3
%5 = add i64 %4, 64
%6 = sext i32 %3 to i64
%7 = icmp ule i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
double cos(double);
double sin(double);
double sinecosinefunc(double x, int term, int ioff) {
  x *= (term + 1) / 2 + ioff;
  if (term % 2)
    return sin(x);
  return cos(x);
}


x86 assembly (clang, -O0):
<sinecosinefunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    %esi,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    -0x18(%rbp),%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     117a <sinecosinefunc+0x5a>
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1189 <sinecosinefunc+0x69>
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinecosinefunc>:
movapd %xmm0,%xmm1
lea    0x1(%rdi),%eax
shr    $0x1f,%eax
add    %edi,%eax
add    $0x1,%eax
sar    %eax
add    %esi,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  %xmm1,%xmm0
test   $0x1,%dil
jne    1149 <sinecosinefunc+0x29>
jmp    1040 <cos@plt>
jmp    1030 <sin@plt>

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

LLVM IR (-O2):
define double @sinecosinefunc(double %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, 1
%5 = sdiv i32 %4, 2
%6 = add nsw i32 %5, %2
%7 = sitofp i32 %6 to double
%8 = fmul double %7, %0
%9 = and i32 %1, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %3
%12 = tail call double @sin(double %8)
br label %15
13: ; preds = %3
%14 = tail call double @cos(double %8)
br label %15
15: ; preds = %13, %11
%16 = phi double [ %12, %11 ], [ %14, %13 ]
ret double %16
}
/* Variables and functions */
char const *foo();
const char *foo_library() { return foo(); }


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

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

LLVM IR (-O0):
define i8* @foo_library() {
%1 = call i8* (...) @foo()
ret i8* %1
}

LLVM IR (-O2):
define i8* @foo_library() {
%1 = tail call i8* (...) @foo()
ret i8* %1
}