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

/* Variables and functions */
uint8_t bin_to_bcd(uint8_t value) { return ((value / 10) << 4) | (value % 10); }


x86 assembly (clang, -O0):
<bin_to_bcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
shl    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%eax
or     %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin_to_bcd>:
movslq %edi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x4,%edx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @bin_to_bcd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 10
%5 = shl i32 %4, 4
%6 = load i32, i32* %2
%7 = srem i32 %6, 10
%8 = or i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @bin_to_bcd(i32 %0) {
%2 = sdiv i32 %0, 10
%3 = shl i32 %2, 4
%4 = srem i32 %0, 10
%5 = or i32 %3, %4
ret i32 %5
}
/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_bus_set_exec(void *bus, const char *path, char *const argv[]) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_bus_set_exec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
mov    0x2ec7(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_bus_set_exec>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

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

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_bus_set_exec(i8* nocapture readnone %0, i8* nocapture readnone %1, i8** nocapture readnone %2) {
%4 = load i32, i32* @EINVAL
%5 = sub nsw i32 0, %4
ret i32 %5
}
int test_imm_C1uint16_reg(unsigned short val) {
  return ((val) & (-0xC1 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_C1uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -193
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ cpl();
void opcode_2f() { cpl(); }


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

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

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

LLVM IR (-O2):
define void @opcode_2f() {
%1 = tail call i32 (...) @cpl()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int a, b, c;
  printf("I create a file!");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%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 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"I create a file!\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *e_make_postf(char *out, char *name, char *pf) {
  strcpy(out, name);
  strcat(out, pf);
  return (out);
}


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

x86 assembly (clang, -O2):
<e_make_postf>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @e_make_postf(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i8*, i8** %5
%9 = call i32 @strcpy(i8* %7, i8* %8)
%10 = load i8*, i8** %4
%11 = load i8*, i8** %6
%12 = call i32 @strcat(i8* %10, i8* %11)
%13 = load i8*, i8** %4
ret i8* %13
}

LLVM IR (-O2):
define i8* @e_make_postf(i8* returned %0, i8* %1, i8* %2) {
%4 = tail call i32 @strcpy(i8* %0, i8* %1)
%5 = tail call i32 @strcat(i8* %0, i8* %2)
ret i8* %0
}
int do_934() { return 934; }


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

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

LLVM IR (-O0):
define i32 @do_934() {
ret i32 934
}

LLVM IR (-O2):
define i32 @do_934() {
ret i32 934
}
unsigned xrop3_119_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned stk1;
  stk1 = D & S;
  stk1 = ~stk1;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_119_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_119_1_0>:
mov    %edi,%eax
shl    $0x8,%eax
not    %eax
ret

LLVM IR (-O0):
define i32 @xrop3_119_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%8 = load i8, i8* %3
%9 = zext i8 %8 to i32
%10 = shl i32 %9, 8
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = or i32 %10, %12
store i32 %13, i32* %6
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = and i32 %14, %15
store i32 %16, i32* %7
%17 = load i32, i32* %7
%18 = xor i32 %17, -1
store i32 %18, i32* %7
%19 = load i32, i32* %7
%20 = load i32, i32* %6
%21 = xor i32 %20, -1
%22 = and i32 %19, %21
%23 = load i32, i32* %5
%24 = load i32, i32* %6
%25 = and i32 %23, %24
%26 = or i32 %22, %25
ret i32 %26
}

LLVM IR (-O2):
define i32 @xrop3_119_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = xor i32 %4, -1
ret i32 %5
}
/* Type definitions */
struct memory_source {
  int dummy;
};

/* Variables and functions */
char *impl_xmalloc(size_t, struct memory_source *, char const *, unsigned int);
char *strcpy(char *, char const *);
size_t strlen(char const *);
char *impl_xstrdup(const char *str, struct memory_source *src, const char *file,
                   unsigned int line) {
  size_t len = strlen(str);
  char *ret = impl_xmalloc(len + 1, src, file, line);
  return strcpy(ret, str);
}


x86 assembly (clang, -O0):
<impl_xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
add    $0x1,%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1050 <impl_xmalloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<impl_xstrdup>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %r14d,%ecx
call   1050 <impl_xmalloc@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
%struct.memory_source = type { i32 }
define i8* @impl_xstrdup(i8* %0, %struct.memory_source* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca %struct.memory_source*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i64
%10 = alloca i8*
store i8* %0, i8** %5
store %struct.memory_source* %1, %struct.memory_source** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%11 = load i8*, i8** %5
%12 = call i64 @strlen(i8* %11)
store i64 %12, i64* %9
%13 = load i64, i64* %9
%14 = add i64 %13, 1
%15 = load %struct.memory_source*, %struct.memory_source** %6
%16 = load i8*, i8** %7
%17 = load i32, i32* %8
%18 = call i8* @impl_xmalloc(i64 %14, %struct.memory_source* %15, i8* %16, i32 %17)
store i8* %18, i8** %10
%19 = load i8*, i8** %10
%20 = load i8*, i8** %5
%21 = call i8* @strcpy(i8* %19, i8* %20)
ret i8* %21
}

LLVM IR (-O2):
%struct.memory_source = type { i32 }
define i8* @impl_xstrdup(i8* nocapture %0, %struct.memory_source* %1, i8* %2, i32 %3) {
%5 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%6 = add i64 %5, 1
%7 = tail call i8* @impl_xmalloc(i64 %6, %struct.memory_source* %1, i8* %2, i32 %3)
%8 = tail call i8* @strcpy(i8* dereferenceable(1) %7, i8* dereferenceable(1) %0)
ret i8* %7
}
int job_compare(const void *a, const void *b) { return (char *)a - (char *)b; }


x86 assembly (clang, -O0):
<job_compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<job_compare>:
mov    %rdi,%rax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @job_compare(i8* %0, i8* %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 = ptrtoint i8* %5 to i64
%8 = ptrtoint i8* %6 to i64
%9 = sub i64 %7, %8
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @job_compare(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = ptrtoint i8* %1 to i64
%5 = sub i64 %3, %4
%6 = trunc i64 %5 to i32
ret i32 %6
}
main() {
  int i;
  i = ({
    int i, r = 0;
    for (i = 1; i <= 5; i++)
      r += i;
    r;
  });
  assert(i == 15);
  ({ (void)printf("hello\n"); });
  ({
    int i;
    i = 2;
  });
  assert(i - 15 == 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jg     115e <main+0x3e>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <main+0x1d>
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0xf,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x2,-0x18(%rbp)
movl   $0x2,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
sub    $0xf,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x0,%al
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
xor    %eax,%eax
call   1040 <assert@plt>
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
xor    %eax,%eax
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"hello\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 1, i32* %3
br label %8
8: ; preds = %15, %0
%9 = load i32, i32* %3
%10 = icmp sle i32 %9, 5
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = add nsw i32 %13, %12
store i32 %14, i32* %4
br label %15
15: ; preds = %11
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %8
18: ; preds = %8
%19 = load i32, i32* %4
store i32 %19, i32* %5
%20 = load i32, i32* %5
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 15
%23 = zext i1 %22 to i32
%24 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 2, i32* %6
store i32 2, i32* %7
%26 = load i32, i32* %7
%27 = load i32, i32* %2
%28 = sub nsw i32 %27, 15
%29 = icmp eq i32 %28, 0
%30 = zext i1 %29 to i32
%31 = call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 %30)
%32 = load i32, i32* %1
ret i32 %32
}

LLVM IR (-O2):
@str = [6 x i8] c"hello\00"
define i32 @main() {
%1 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i32, ...) bitcast (i32 (...)* @assert to i32 (i32, ...)*)(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _IONBF;
int /*<<< orphan*/ alarm(int);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, int /*<<< orphan*/,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
void init_auto() {
  setvbuf(stdin, 0, _IONBF, 0);
  setvbuf(stdout, 0, _IONBF, 0);
  alarm(40);
}


x86 assembly (clang, -O0):
<init_auto>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    0x2eac(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
mov    %ecx,%esi
call   1040 <setvbuf@plt>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
mov    %ecx,%esi
call   1040 <setvbuf@plt>
mov    $0x28,%edi
call   1030 <alarm@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_auto>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
mov    0x2eaf(%rip),%rbx
mov    (%rbx),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1040 <setvbuf@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1040 <setvbuf@plt>
mov    $0x28,%edi
pop    %rbx
jmp    1030 <alarm@plt>

LLVM IR (-O0):
@stdin = global i32 0
@_IONBF = global i32 0
@stdout = global i32 0
define void @init_auto() {
%1 = load i32, i32* @stdin
%2 = load i32, i32* @_IONBF
%3 = call i32 @setvbuf(i32 %1, i32 0, i32 %2, i32 0)
%4 = load i32, i32* @stdout
%5 = load i32, i32* @_IONBF
%6 = call i32 @setvbuf(i32 %4, i32 0, i32 %5, i32 0)
%7 = call i32 @alarm(i32 40)
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@_IONBF = global i32 0
@stdout = global i32 0
define void @init_auto() {
%1 = load i32, i32* @stdin
%2 = load i32, i32* @_IONBF
%3 = tail call i32 @setvbuf(i32 %1, i32 0, i32 %2, i32 0)
%4 = load i32, i32* @stdout
%5 = load i32, i32* @_IONBF
%6 = tail call i32 @setvbuf(i32 %4, i32 0, i32 %5, i32 0)
%7 = tail call i32 @alarm(i32 40)
ret void
}
/* Type definitions */
typedef unsigned long long uint64_t;

/* Variables and functions */
int getmsb(unsigned long long);
int popmsb(uint64_t *bb) {
  int msb = getmsb(*bb);
  *bb ^= 1ull << msb;
  return msb;
}


x86 assembly (clang, -O0):
<popmsb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <getmsb@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%rax
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
xor    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<popmsb>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1030 <getmsb@plt>
mov    $0x1,%edx
mov    %eax,%ecx
shl    %cl,%rdx
xor    %rdx,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define i32 @popmsb(i64* %0) {
%2 = alloca i64*
%3 = alloca i32
store i64* %0, i64** %2
%4 = load i64*, i64** %2
%5 = load i64, i64* %4
%6 = call i32 @getmsb(i64 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = zext i32 %7 to i64
%9 = shl i64 1, %8
%10 = load i64*, i64** %2
%11 = load i64, i64* %10
%12 = xor i64 %11, %9
store i64 %12, i64* %10
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @popmsb(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = tail call i32 @getmsb(i64 %2)
%4 = zext i32 %3 to i64
%5 = shl nuw i64 1, %4
%6 = load i64, i64* %0
%7 = xor i64 %5, %6
store i64 %7, i64* %0
ret i32 %3
}
void POLY_flush_local_rot(void) {}


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

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

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

LLVM IR (-O2):
define void @POLY_flush_local_rot() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
int main(void) {
  unsigned int a;
  a = 1;
  printf("i = %u\n", a);
  printf("i-2 = %d\n", a - 2);
  a = 0xffffffff;
  printf("i = %x\n", a);
  a = 1;
  printf("i = %d\n", -a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
sub    $0x2,%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
xor    %esi,%esi
sub    -0x8(%rbp),%esi
lea    0xeaa(%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    $0x1,%esi
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"i = %u\0A\00"
@.str.1 = [10 x i8] c"i-2 = %d\0A\00"
@.str.2 = [8 x i8] c"i = %x\0A\00"
@.str.3 = [8 x i8] c"i = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = sub i32 %5, 2
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %6)
store i32 -1, i32* %2
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %8)
store i32 1, i32* %2
%10 = load i32, i32* %2
%11 = sub i32 0, %10
%12 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"i = %u\0A\00"
@.str.1 = [10 x i8] c"i-2 = %d\0A\00"
@.str.2 = [8 x i8] c"i = %x\0A\00"
@.str.3 = [8 x i8] c"i = %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 -1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 -1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 -1)
ret i32 0
}
void RTTimerCreateEx(void) {}


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

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

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

LLVM IR (-O2):
define void @RTTimerCreateEx() {
ret void
}
int test_imm_4Aint64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x4A << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_4Aint64_highword_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, 32
%6 = and i64 %5, 74
%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_4Aint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 317827579904
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int hdmi_init_platform_driver(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @hdmi_init_platform_driver() {
ret i32 0
}
void kobject_get(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<kobject_get>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kobject_get>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.kobject_get = [12 x i8] c"kobject_get\00"
define void @kobject_get() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.kobject_get, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.kobject_get = [12 x i8] c"kobject_get\00"
define void @kobject_get() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @__func__.kobject_get, i64 0, i64 0))
ret void
}
void goto_infinite_loop() {
  int i = 0;
L1:
  i++;
  if (i >= 0) {
    goto L2;
  } else {
    goto L2;
  }
L2:
  i++;
  if (i >= 0) {
    goto L1;
  } else {
    goto L1;
  }
}


x86 assembly (clang, -O0):
<goto_infinite_loop>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1123 <goto_infinite_loop+0x23>
jmp    1128 <goto_infinite_loop+0x28>
jmp    1128 <goto_infinite_loop+0x28>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1140 <goto_infinite_loop+0x40>
jmp    110b <goto_infinite_loop+0xb>
jmp    110b <goto_infinite_loop+0xb>

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

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

LLVM IR (-O2):
define void @goto_infinite_loop() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
float log10(float);
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ printid(float);
int main() {
  float a = 2, b = 3;
  a = log10(b);
  print("a 0.477121");
  printid(a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xebd(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  0xeac(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
call   1050 <log10@plt>
movss  %xmm0,-0x8(%rbp)
lea    0xe99(%rip),%rdi
call   1030 <print@plt>
movss  -0x8(%rbp),%xmm0
call   1040 <printid@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedc(%rip),%rdi
call   1030 <print@plt>
movss  0xecb(%rip),%xmm0
call   1040 <printid@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"a 0.477121\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
store float 2.000000e+00, float* %2
store float 3.000000e+00, float* %3
%4 = load float, float* %3
%5 = call float @log10(float %4)
store float %5, float* %2
%6 = call i32 @print(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%7 = load float, float* %2
%8 = call i32 @printid(float %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"a 0.477121\00"
define i32 @main() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printid(float 0x3FDE8927A0000000)
ret i32 0
}
/* Variables and functions */
int memcmp(const void *s1 __attribute__((unused)),
           const void *s2 __attribute__((unused)),
           unsigned int n __attribute__((unused))) {
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @memcmp(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ td_err_e;

/* Variables and functions */
int /*<<< orphan*/ TD_OK;
td_err_e td_init(void) { return TD_OK; }


x86 assembly (clang, -O0):
<td_init>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@TD_OK = global i32 0
define i32 @td_init() {
%1 = load i32, i32* @TD_OK
ret i32 %1
}

LLVM IR (-O2):
@TD_OK = global i32 0
define i32 @td_init() {
%1 = load i32, i32* @TD_OK
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void usage(const char *argv0) {
  fprintf(stderr, "Usage: %s FILENAME ?SEED N?\n", argv0);
  exit(1);
}


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

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [29 x i8] c"Usage: %s FILENAME ?SEED N?\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int string_to_uint_ex(char const *const, int /*<<< orphan*/ *,
                      unsigned int const, int /*<<< orphan*/ *);
int string_to_uint_upto(const char *const str, const unsigned int max_val) {
  return string_to_uint_ex(str, NULL, max_val, NULL);
}


x86 assembly (clang, -O0):
<string_to_uint_upto>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %eax,%eax
mov    %eax,%ecx
mov    %rcx,%rsi
call   1030 <string_to_uint_ex@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_to_uint_upto>:
mov    %esi,%edx
xor    %esi,%esi
xor    %ecx,%ecx
jmp    1030 <string_to_uint_ex@plt>

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

LLVM IR (-O2):
define i32 @string_to_uint_upto(i8* %0, i32 %1) {
%3 = tail call i32 @string_to_uint_ex(i8* %0, i32* null, i32 %1, i32* null)
ret i32 %3
}
void pac207_stop0(struct usb_spca50x *spca50x) {}


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

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

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

LLVM IR (-O2):
%struct.usb_spca50x = type opaque
define void @pac207_stop0(%struct.usb_spca50x* nocapture %0) {
ret void
}
/* Variables and functions */
void *CRYPTO_malloc(size_t, char const *, int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *CRYPTO_zalloc(size_t num, const char *file, int line) {
  void *ret = CRYPTO_malloc(num, file, line);
  if (ret != NULL)
    memset(ret, 0, num);
  return ret;
}


x86 assembly (clang, -O0):
<CRYPTO_zalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <CRYPTO_malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1161 <CRYPTO_zalloc+0x41>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CRYPTO_zalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <CRYPTO_malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1141 <CRYPTO_zalloc+0x21>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @CRYPTO_zalloc(i64 %0, i8* %1, i32 %2) {
%4 = tail call i8* @CRYPTO_malloc(i64 %0, i8* %1, i32 %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @memset(i8* %4, i32 0, i64 %0)
br label %8
8: ; preds = %6, %3
ret i8* %4
}
extern void foo() {}


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

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

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

LLVM IR (-O2):
define void @foo() {
ret void
}
double ar_vi(double redchan, double nirchan, double bluechan) {
  double result;
  if ((nirchan + redchan) == 0.0) {
    result = -1.0;
  } else {
    result = (nirchan - (2 * redchan - bluechan)) /
             (nirchan + (2 * redchan - bluechan));
  }
  return result;
}


x86 assembly (clang, -O0):
<ar_vi>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1142 <ar_vi+0x42>
jp     1142 <ar_vi+0x42>
movsd  0xec8(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11af <ar_vi+0xaf>
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
addsd  %xmm1,%xmm1
addsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movq   %xmm3,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm3
addsd  %xmm2,%xmm2
addsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ar_vi>:
movapd %xmm0,%xmm3
addsd  %xmm1,%xmm3
xorpd  %xmm4,%xmm4
ucomisd %xmm4,%xmm3
jne    111d <ar_vi+0x1d>
jp     111d <ar_vi+0x1d>
movsd  0xee4(%rip),%xmm0
ret
addsd  %xmm0,%xmm0
subsd  %xmm2,%xmm0
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
addsd  %xmm1,%xmm0
divsd  %xmm0,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @ar_vi(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %5
%9 = load double, double* %4
%10 = fadd double %8, %9
%11 = fcmp oeq double %10, 0.000000e+00
br i1 %11, label %12, label %13
12: ; preds = %3
store double -1.000000e+00, double* %7
br label %27
13: ; preds = %3
%14 = load double, double* %5
%15 = load double, double* %4
%16 = load double, double* %6
%17 = fneg double %16
%18 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %15, double %17)
%19 = fsub double %14, %18
%20 = load double, double* %5
%21 = load double, double* %4
%22 = load double, double* %6
%23 = fneg double %22
%24 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %21, double %23)
%25 = fadd double %20, %24
%26 = fdiv double %19, %25
store double %26, double* %7
br label %27
27: ; preds = %13, %12
%28 = load double, double* %7
ret double %28
}

LLVM IR (-O2):
define double @ar_vi(double %0, double %1, double %2) {
%4 = fadd double %0, %1
%5 = fcmp oeq double %4, 0.000000e+00
br i1 %5, label %12, label %6
6: ; preds = %3
%7 = fneg double %2
%8 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double %7)
%9 = fsub double %1, %8
%10 = fadd double %8, %1
%11 = fdiv double %9, %10
br label %12
12: ; preds = %3, %6
%13 = phi double [ %11, %6 ], [ -1.000000e+00, %3 ]
ret double %13
}
/* Variables and functions */
int EOF;
int getchar();
int /*<<< orphan*/ rcomment(int);
int main() {
  int c, i;
  int source[1000];
  while ((c = getchar()) != EOF) {
    rcomment(c);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea5(%rip),%rcx
cmp    (%rcx),%eax
je     1158 <main+0x38>
mov    -0x8(%rbp),%edi
call   1040 <rcomment@plt>
jmp    1132 <main+0x12>
mov    -0x4(%rbp),%eax
add    $0xfb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <getchar@plt>
mov    0x2eb9(%rip),%rbx
cmp    (%rbx),%eax
je     1152 <main+0x32>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%edi
call   1040 <rcomment@plt>
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    (%rbx),%eax
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1000 x i32]
store i32 0, i32* %1
br label %5
5: ; preds = %9, %0
%6 = call i32 (...) @getchar()
store i32 %6, i32* %2
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i32, i32* %2
%11 = call i32 @rcomment(i32 %10)
br label %5
12: ; preds = %5
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %10, label %4
4: ; preds = %0, %4
%5 = phi i32 [ %7, %4 ], [ %1, %0 ]
%6 = tail call i32 @rcomment(i32 %5)
%7 = tail call i32 (...) @getchar()
%8 = load i32, i32* @EOF
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %4
10: ; preds = %4, %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ console_printf(char *);
void not_supported(void) { console_printf("Not supported!\n"); }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"Not supported!\0A\00"
define void @not_supported() {
%1 = call i32 @console_printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"Not supported!\0A\00"
define void @not_supported() {
%1 = tail call i32 @console_printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}
int main() {
  int a = 1, b = 2, c = 3, d = 4, e = 5;
  int f = 0x03, g = 0x03, h = 0x07;
  a += b;
  c -= c += d;
  e *= 2;
  e /= 5;
  d %= a - 1;
  f &= 0x11;
  g |= 0x11;
  h ^= 0x11;
  return a + b + c + d + e + f + g + h;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
movl   $0x5,-0x18(%rbp)
movl   $0x3,-0x1c(%rbp)
movl   $0x3,-0x20(%rbp)
movl   $0x7,-0x24(%rbp)
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%ecx
add    -0x10(%rbp),%ecx
mov    %ecx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
mov    -0x14(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
and    $0x11,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
or     $0x11,%eax
mov    %eax,-0x20(%rbp)
mov    -0x24(%rbp),%eax
xor    $0x11,%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
store i32 3, i32* %4
store i32 4, i32* %5
store i32 5, i32* %6
store i32 3, i32* %7
store i32 3, i32* %8
store i32 7, i32* %9
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = add nsw i32 %11, %10
store i32 %12, i32* %2
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = add nsw i32 %14, %13
store i32 %15, i32* %4
%16 = load i32, i32* %4
%17 = sub nsw i32 %16, %15
store i32 %17, i32* %4
%18 = load i32, i32* %6
%19 = mul nsw i32 %18, 2
store i32 %19, i32* %6
%20 = load i32, i32* %6
%21 = sdiv i32 %20, 5
store i32 %21, i32* %6
%22 = load i32, i32* %2
%23 = sub nsw i32 %22, 1
%24 = load i32, i32* %5
%25 = srem i32 %24, %23
store i32 %25, i32* %5
%26 = load i32, i32* %7
%27 = and i32 %26, 17
store i32 %27, i32* %7
%28 = load i32, i32* %8
%29 = or i32 %28, 17
store i32 %29, i32* %8
%30 = load i32, i32* %9
%31 = xor i32 %30, 17
store i32 %31, i32* %9
%32 = load i32, i32* %2
%33 = load i32, i32* %3
%34 = add nsw i32 %32, %33
%35 = load i32, i32* %4
%36 = add nsw i32 %34, %35
%37 = load i32, i32* %5
%38 = add nsw i32 %36, %37
%39 = load i32, i32* %6
%40 = add nsw i32 %38, %39
%41 = load i32, i32* %7
%42 = add nsw i32 %40, %41
%43 = load i32, i32* %8
%44 = add nsw i32 %42, %43
%45 = load i32, i32* %9
%46 = add nsw i32 %44, %45
ret i32 %46
}

LLVM IR (-O2):
define i32 @main() {
ret i32 49
}
int sw_ishex(char ch) {
  if ('0' <= ch && ch <= '9') {
    return 1;
  } else if ('a' <= ch && ch <= 'f') {
    return 1;
  } else if ('A' <= ch && ch <= 'F') {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<sw_ishex>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%ecx
mov    $0x30,%eax
cmp    %ecx,%eax
jg     1134 <sw_ishex+0x34>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1134 <sw_ishex+0x34>
movl   $0x1,-0x4(%rbp)
jmp    118f <sw_ishex+0x8f>
movsbl -0x5(%rbp),%ecx
mov    $0x61,%eax
cmp    %ecx,%eax
jg     115e <sw_ishex+0x5e>
movsbl -0x5(%rbp),%eax
cmp    $0x66,%eax
jg     115e <sw_ishex+0x5e>
movl   $0x1,-0x4(%rbp)
jmp    118f <sw_ishex+0x8f>
movsbl -0x5(%rbp),%ecx
mov    $0x41,%eax
cmp    %ecx,%eax
jg     1188 <sw_ishex+0x88>
movsbl -0x5(%rbp),%eax
cmp    $0x46,%eax
jg     1188 <sw_ishex+0x88>
movl   $0x1,-0x4(%rbp)
jmp    118f <sw_ishex+0x8f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sw_ishex>:
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 @sw_ishex(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sle i32 48, %5
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %12
11: ; preds = %7
store i32 1, i32* %2
br label %31
12: ; preds = %7, %1
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp sle i32 97, %14
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = icmp sle i32 %18, 102
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 1, i32* %2
br label %31
21: ; preds = %16, %12
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = icmp sle i32 65, %23
br i1 %24, label %25, label %30
25: ; preds = %21
%26 = load i8, i8* %3
%27 = sext i8 %26 to i32
%28 = icmp sle i32 %27, 70
br i1 %28, label %29, label %30
29: ; preds = %25
store i32 1, i32* %2
br label %31
30: ; preds = %25, %21
store i32 0, i32* %2
br label %31
31: ; preds = %30, %29, %20, %11
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @sw_ishex(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 /*<<< orphan*/ fb_move_cursor(int /*<<< orphan*/);
int /*<<< orphan*/ fb_write_cell(int, char, int, int);
void fb_clear() {
  int i;
  for (i = 0; i < 80 * 25; i++) {
    fb_write_cell(i * 2, ' ', 2, 8);
  }
  fb_move_cursor(0);
}


x86 assembly (clang, -O0):
<fb_clear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x7d0,-0x4(%rbp)
jge    1164 <fb_clear+0x44>
mov    -0x4(%rbp),%edi
shl    $0x1,%edi
mov    $0x20,%esi
mov    $0x2,%edx
mov    $0x8,%ecx
call   1040 <fb_write_cell@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <fb_clear+0xf>
xor    %edi,%edi
call   1030 <fb_move_cursor@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fb_clear>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
mov    $0x20,%esi
mov    $0x2,%edx
mov    $0x8,%ecx
call   1040 <fb_write_cell@plt>
add    $0x2,%ebx
cmp    $0xfa0,%ebx
jne    1130 <fb_clear+0x10>
xor    %edi,%edi
pop    %rbx
jmp    1030 <fb_move_cursor@plt>

LLVM IR (-O0):
define void @fb_clear() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %9, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 2000
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = load i32, i32* %1
%7 = mul nsw i32 %6, 2
%8 = call i32 @fb_write_cell(i32 %7, i8 signext 32, i32 2, i32 8)
br label %9
9: ; preds = %5
%10 = load i32, i32* %1
%11 = add nsw i32 %10, 1
store i32 %11, i32* %1
br label %2
12: ; preds = %2
%13 = call i32 @fb_move_cursor(i32 0)
ret void
}

LLVM IR (-O2):
define void @fb_clear() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %5, %1 ]
%3 = shl nuw nsw i32 %2, 1
%4 = tail call i32 @fb_write_cell(i32 %3, i8 signext 32, i32 2, i32 8)
%5 = add nuw nsw i32 %2, 1
%6 = icmp eq i32 %5, 2000
br i1 %6, label %7, label %1
7: ; preds = %1
%8 = tail call i32 @fb_move_cursor(i32 0)
ret void
}
/* Variables and functions */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ crypt(char *, char *);
int /*<<< orphan*/ memcpy(char *, int /*<<< orphan*/, int);
char *ddns3_crypto_crypt(char *key, char *salt) {
  char *buf = (char *)calloc(14, sizeof(char));
  memcpy(buf, crypt(key, salt), 13);
  buf[13] = 0;
  return buf;
}


x86 assembly (clang, -O0):
<ddns3_crypto_crypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xe,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <crypt@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
mov    $0xd,%edx
call   1050 <memcpy@plt>
mov    -0x18(%rbp),%rax
movb   $0x0,0xd(%rax)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ddns3_crypto_crypt>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    $0xe,%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <crypt@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0xd,%edx
call   1050 <memcpy@plt>
movb   $0x0,0xd(%rbx)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @ddns3_crypto_crypt(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = call i64 @calloc(i32 14, i32 1)
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = call i32 @crypt(i8* %9, i8* %10)
%12 = call i32 @memcpy(i8* %8, i32 %11, i32 13)
%13 = load i8*, i8** %5
%14 = getelementptr inbounds i8, i8* %13, i64 13
store i8 0, i8* %14
%15 = load i8*, i8** %5
ret i8* %15
}

LLVM IR (-O2):
define i8* @ddns3_crypto_crypt(i8* %0, i8* %1) {
%3 = tail call i64 @calloc(i32 14, i32 1)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32 @crypt(i8* %0, i8* %1)
%6 = tail call i32 @memcpy(i8* %4, i32 %5, i32 13)
%7 = getelementptr inbounds i8, i8* %4, i64 13
store i8 0, i8* %7
ret i8* %4
}