xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int /*<<< orphan*/ *stdout;
void output_begin(FILE *outp) {
  if (outp != stdout)
    fseek(outp, 0, SEEK_SET);
  else
    fprintf(outp, "---\n");
}


x86 assembly (clang, -O0):
<output_begin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%rax
je     1159 <output_begin+0x39>
mov    -0x8(%rbp),%rdi
mov    0x2e95(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1040 <fseek@plt>
jmp    1169 <output_begin+0x49>
mov    -0x8(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_begin>:
mov    %rdi,%rcx
mov    0x2eae(%rip),%rax
cmp    %rdi,(%rax)
je     1142 <output_begin+0x22>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edx
mov    %rcx,%rdi
xor    %esi,%esi
jmp    1030 <fseek@plt>
lea    0xeb7(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
jmp    1040 <fwrite@plt>

LLVM IR (-O0):
@stdout = global i32* null
@SEEK_SET = global i32 0
@.str = [5 x i8] c"---\0A\00"
define void @output_begin(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32*, i32** @stdout
%5 = icmp ne i32* %3, %4
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32*, i32** %2
%8 = load i32, i32* @SEEK_SET
%9 = call i32 @fseek(i32* %7, i32 0, i32 %8)
br label %13
10: ; preds = %1
%11 = load i32*, i32** %2
%12 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %10, %6
ret void
}

LLVM IR (-O2):
@stdout = global i32* null
@SEEK_SET = global i32 0
@.str = [5 x i8] c"---\0A\00"
define void @output_begin(i32* nocapture %0) {
%2 = load i32*, i32** @stdout
%3 = icmp eq i32* %2, %0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = load i32, i32* @SEEK_SET
%6 = tail call i32 @fseek(i32* %0, i32 0, i32 %5)
br label %9
7: ; preds = %1
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 4, i64 1, i32* %0)
br label %9
9: ; preds = %7, %4
ret void
}
int fun104() { return 104; }


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

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

LLVM IR (-O0):
define i32 @fun104() {
ret i32 104
}

LLVM IR (-O2):
define i32 @fun104() {
ret i32 104
}
/* Variables and functions */
void removeCardsFromHand(unsigned *hand) {
  for (size_t i = 0; i < 26; i++) {
    hand[i] = 0;
  }
}


x86 assembly (clang, -O0):
<removeCardsFromHand>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x1a,-0x10(%rbp)
jae    113b <removeCardsFromHand+0x3b>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <removeCardsFromHand+0x10>
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeCardsFromHand>:
xorps  %xmm0,%xmm0
movups %xmm0,0x50(%rdi)
movups %xmm0,0x40(%rdi)
movups %xmm0,0x30(%rdi)
movups %xmm0,0x20(%rdi)
movups %xmm0,0x10(%rdi)
movups %xmm0,(%rdi)
movq   $0x0,0x60(%rdi)
ret

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

LLVM IR (-O2):
define void @removeCardsFromHand(i32* nocapture writeonly %0) {
%2 = bitcast i32* %0 to i8*
ret void
}
void X509_ATTRIBUTE_create_by_OBJ(void) {}


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

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

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

LLVM IR (-O2):
define void @X509_ATTRIBUTE_create_by_OBJ() {
ret void
}
char *canonpath(char *path) { return path; }


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

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

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

LLVM IR (-O2):
define i8* @canonpath(i8* readnone returned %0) {
ret i8* %0
}
void multiplication_int(struct multiplication_options_int *options, int *in0,
                        int *in1, int *out0) {
  *out0 = *in0 * *in1;
}


x86 assembly (clang, -O0):
<multiplication_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
imul   (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<multiplication_int>:
mov    (%rdx),%eax
imul   (%rsi),%eax
mov    %eax,(%rcx)
ret

LLVM IR (-O0):
%struct.multiplication_options_int = type opaque
define void @multiplication_int(%struct.multiplication_options_int* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca %struct.multiplication_options_int*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store %struct.multiplication_options_int* %0, %struct.multiplication_options_int** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32*, i32** %6
%10 = load i32, i32* %9
%11 = load i32*, i32** %7
%12 = load i32, i32* %11
%13 = mul nsw i32 %10, %12
%14 = load i32*, i32** %8
store i32 %13, i32* %14
ret void
}

LLVM IR (-O2):
%struct.multiplication_options_int = type opaque
define void @multiplication_int(%struct.multiplication_options_int* nocapture readnone %0, i32* nocapture %1, i32* nocapture %2, i32* nocapture writeonly %3) {
%5 = load i32, i32* %1
%6 = load i32, i32* %2
%7 = mul nsw i32 %6, %5
store i32 %7, i32* %3
ret void
}
/* Type definitions */
struct Cyc_Lexing_lexbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Cyc_token_rec(struct Cyc_Lexing_lexbuf *, int);
int Cyc_token(struct Cyc_Lexing_lexbuf *lexbuf) {
  return ({ Cyc_token_rec(lexbuf, 3); });
}


x86 assembly (clang, -O0):
<Cyc_token>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3,%esi
call   1030 <Cyc_token_rec@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_token>:
mov    $0x3,%esi
jmp    1030 <Cyc_token_rec@plt>

LLVM IR (-O0):
%struct.Cyc_Lexing_lexbuf = type { i32 }
define i32 @Cyc_token(%struct.Cyc_Lexing_lexbuf* %0) {
%2 = alloca %struct.Cyc_Lexing_lexbuf*
%3 = alloca i32
store %struct.Cyc_Lexing_lexbuf* %0, %struct.Cyc_Lexing_lexbuf** %2
%4 = load %struct.Cyc_Lexing_lexbuf*, %struct.Cyc_Lexing_lexbuf** %2
%5 = call i32 @Cyc_token_rec(%struct.Cyc_Lexing_lexbuf* %4, i32 3)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
%struct.Cyc_Lexing_lexbuf = type { i32 }
define i32 @Cyc_token(%struct.Cyc_Lexing_lexbuf* %0) {
%2 = tail call i32 @Cyc_token_rec(%struct.Cyc_Lexing_lexbuf* %0, i32 3)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void error(char *s) {
  perror(s);
  exit(1);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
call   1030 <perror@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @error(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
void g_DUMMY_popup_append_item(int cont_id, int item_id, char *label) {
  cont_id = cont_id;
  item_id = item_id;
  label = label;
}


x86 assembly (clang, -O0):
<g_DUMMY_popup_append_item>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @g_DUMMY_popup_append_item(i32 %0, i32 %1, i8* nocapture %2) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
void createTypedefForIntFast32_t(void) {
  if (sizeof(signed int) == 4)
    printf("typedef signed int int_fast32_t;\n");
  else if (sizeof(signed long) == 4)
    printf("typedef signed long int_fast32_t;\n");
  else {
    fprintf(stderr, "Cannot find a 32 bit signed integer type!\n");
    exit(1);
  }
}


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

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

LLVM IR (-O0):
@.str = [34 x i8] c"typedef signed int int_fast32_t;\0A\00"
@stderr = global i32 0
define void @createTypedefForIntFast32_t() {
%1 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@str = [33 x i8] c"typedef signed int int_fast32_t;\00"
define void @createTypedefForIntFast32_t() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
ret void
}
void DebugBreak() { *(int *)0 = 0; }


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

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @DebugBreak() {
store i32 0, i32* null
ret void
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ setmode(int);
int /*<<< orphan*/ unshowmouse();
hgc_exit() {
  unshowmouse();
  (void)setmode(3);
  return (1);
}


x86 assembly (clang, -O0):
<hgc_exit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <unshowmouse@plt>
mov    $0x3,%edi
call   1030 <setmode@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hgc_exit>:
push   %rax
xor    %eax,%eax
call   1040 <unshowmouse@plt>
mov    $0x3,%edi
call   1030 <setmode@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @hgc_exit() {
%1 = call i32 (...) @unshowmouse()
%2 = call i32 @setmode(i32 3)
ret i32 1
}

LLVM IR (-O2):
define i32 @hgc_exit() {
%1 = tail call i32 (...) @unshowmouse()
%2 = tail call i32 @setmode(i32 3)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ putchar(unsigned int);
int _printf_putc(unsigned ch, char *buf) {
  if ((unsigned long)buf & (unsigned long)((char *)0x3000000))
    putchar(ch);
  else
    *buf++ = ch;
  return 1;
}


x86 assembly (clang, -O0):
<_printf_putc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0x3000000,%rax
cmp    $0x0,%rax
je     1140 <_printf_putc+0x30>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
jmp    1156 <_printf_putc+0x46>
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,(%rax)
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_printf_putc>:
push   %rax
test   $0x3000000,%esi
je     1120 <_printf_putc+0x10>
call   1030 <putchar@plt>
jmp    1123 <_printf_putc+0x13>
mov    %dil,(%rsi)
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @_printf_putc(i32 %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = and i64 %3, 50331648
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @putchar(i32 %0)
br label %10
8: ; preds = %2
%9 = trunc i32 %0 to i8
store i8 %9, i8* %1
br label %10
10: ; preds = %8, %6
ret i32 1
}
int test_imm_EDuint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xED << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_EDuint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 237
%6 = icmp ne i64 %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_EDuint64_midword_reg(i64 %0) {
%2 = and i64 %0, 15532032
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int getCellIdBelow(int cellId) {
  if ((cellId + 8) >= 8 * 8)
    return -1;
  return cellId + 8;
}


x86 assembly (clang, -O0):
<getCellIdBelow>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x8,%eax
cmp    $0x40,%eax
jl     1122 <getCellIdBelow+0x22>
movl   $0xffffffff,-0x4(%rbp)
jmp    112b <getCellIdBelow+0x2b>
mov    -0x8(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCellIdBelow>:
lea    0x8(%rdi),%ecx
cmp    $0x38,%edi
mov    $0xffffffff,%eax
cmovl  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @getCellIdBelow(i32 %0) {
%2 = icmp sgt i32 %0, 55
%3 = add nsw i32 %0, 8
%4 = select i1 %2, i32 -1, i32 %3
ret i32 %4
}
int k(int z, int *array) {
  switch (array[z]) {
  case 0:
    return 3;
  case 1:
    return 4;
  default:
    return 5;
  }
}


x86 assembly (clang, -O0):
<k>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     1137 <k+0x37>
jmp    1126 <k+0x26>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     1143 <k+0x43>
jmp    114f <k+0x4f>
movl   $0x3,-0x4(%rbp)
jmp    1156 <k+0x56>
movl   $0x4,-0x4(%rbp)
jmp    1156 <k+0x56>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<k>:
movslq %edi,%rax
mov    (%rsi,%rax,4),%eax
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
xor    $0x5,%ecx
test   %eax,%eax
mov    $0x3,%eax
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @k(i32 %0, i32* nocapture %1) {
%3 = sext i32 %0 to i64
%4 = getelementptr inbounds i32, i32* %1, i64 %3
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 1
%7 = select i1 %6, i32 4, i32 5
%8 = icmp eq i32 %5, 0
%9 = select i1 %8, i32 3, i32 %7
ret i32 %9
}
int MemIntArrIO(int *pMemBlk, unsigned short Wr_Addr, int data) {
  int *pWork;
  if (Wr_Addr >> 15) {
    pWork = pMemBlk + (Wr_Addr - 0x8000);
    *pWork = data;
  } else {
    pWork = pMemBlk + Wr_Addr;
    return *pWork;
  }
}


x86 assembly (clang, -O0):
<MemIntArrIO>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
mov    %edx,-0x18(%rbp)
movzwl -0x12(%rbp),%eax
sar    $0xf,%eax
cmp    $0x0,%eax
je     114c <MemIntArrIO+0x4c>
mov    -0x10(%rbp),%rax
movzwl -0x12(%rbp),%ecx
sub    $0x8000,%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    116b <MemIntArrIO+0x6b>
mov    -0x10(%rbp),%rax
movzwl -0x12(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<MemIntArrIO>:
mov    %esi,%eax
test   %si,%si
js     110b <MemIntArrIO+0xb>
mov    (%rdi,%rax,4),%eax
ret
mov    %edx,-0x20000(%rdi,%rax,4)
ret

LLVM IR (-O0):
define i32 @MemIntArrIO(i32* %0, i16 zeroext %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i16
%7 = alloca i32
%8 = alloca i32*
store i32* %0, i32** %5
store i16 %1, i16* %6
store i32 %2, i32* %7
%9 = load i16, i16* %6
%10 = zext i16 %9 to i32
%11 = ashr i32 %10, 15
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %22
13: ; preds = %3
%14 = load i32*, i32** %5
%15 = load i16, i16* %6
%16 = zext i16 %15 to i32
%17 = sub nsw i32 %16, 32768
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %14, i64 %18
store i32* %19, i32** %8
%20 = load i32, i32* %7
%21 = load i32*, i32** %8
store i32 %20, i32* %21
br label %30
22: ; preds = %3
%23 = load i32*, i32** %5
%24 = load i16, i16* %6
%25 = zext i16 %24 to i32
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %23, i64 %26
store i32* %27, i32** %8
%28 = load i32*, i32** %8
%29 = load i32, i32* %28
store i32 %29, i32* %4
br label %30
30: ; preds = %22, %13
%31 = load i32, i32* %4
ret i32 %31
}

LLVM IR (-O2):
define i32 @MemIntArrIO(i32* nocapture %0, i16 zeroext %1, i32 %2) {
%4 = icmp sgt i16 %1, -1
%5 = zext i16 %1 to i64
br i1 %4, label %9, label %6
6: ; preds = %3
%7 = add nsw i64 %5, -32768
%8 = getelementptr inbounds i32, i32* %0, i64 %7
store i32 %2, i32* %8
br label %12
9: ; preds = %3
%10 = getelementptr inbounds i32, i32* %0, i64 %5
%11 = load i32, i32* %10
br label %12
12: ; preds = %6, %9
%13 = phi i32 [ undef, %6 ], [ %11, %9 ]
ret i32 %13
}
/* Variables and functions */
long double sin(double);
long double sinl(long double x) { return sin((double)x); }


x86 assembly (clang, -O0):
<sinl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fstpl  -0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinl>:
fldt   0x8(%rsp)
fstpl  -0x8(%rsp)
movsd  -0x8(%rsp),%xmm0
jmp    1030 <sin@plt>

LLVM IR (-O0):
define x86_fp80 @sinl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = fptrunc x86_fp80 %3 to double
%5 = call x86_fp80 @sin(double %4)
ret x86_fp80 %5
}

LLVM IR (-O2):
define x86_fp80 @sinl(x86_fp80 %0) {
%2 = fptrunc x86_fp80 %0 to double
%3 = tail call x86_fp80 @sin(double %2)
ret x86_fp80 %3
}
double sub(double a, double b) { return b - a; }


x86 assembly (clang, -O0):
<sub>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub>:
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @sub(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* %3
%7 = fsub double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @sub(double %0, double %1) {
%3 = fsub double %1, %0
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int x = 0xdeadbeef;
  printf("0x%x\n", x);
  return 0;
}


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

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

LLVM IR (-O2):
@.str = [6 x i8] c"0x%x\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 -559038737)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage() {
  printf(
      "Usage: ipcmsg-tool OPERATIONS [OPTIONS] path\n"
      "* Operations\n"
      " -h                     : show this help\n"
      " -c                     : create a message queue\n"
      " -d                     : delete the message queue\n"
      " -r                     : receive a message\n"
      " -s message             : send a message\n"
      "* Options (only for send and receive operations)\n"
      " -b                     : make send or receive operation\n"
      "                          blocking\n"
      " -t type                : specify message type\n"
      "* Various options\n"
      " -i                     : use message queue identifier instead of path\n"
      " -q                     : be quiet\n");
}


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

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

LLVM IR (-O0):
@.str = [597 x i8] c"Usage: ipcmsg-tool OPERATIONS [OPTIONS] path\0A* Operations\0A -h : show this help\0A -c : create a message queue\0A -d : delete the message queue\0A -r : receive a message\0A -s message : send a message\0A* Options (only for send and receive operations)\0A -b : make send or receive operation\0A blocking\0A -t type : specify message type\0A* Various options\0A -i : use message queue identifier instead of path\0A -q : be quiet\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([597 x i8], [597 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [596 x i8] c"Usage: ipcmsg-tool OPERATIONS [OPTIONS] path\0A* Operations\0A -h : show this help\0A -c : create a message queue\0A -d : delete the message queue\0A -r : receive a message\0A -s message : send a message\0A* Options (only for send and receive operations)\0A -b : make send or receive operation\0A blocking\0A -t type : specify message type\0A* Various options\0A -i : use message queue identifier instead of path\0A -q : be quiet\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([596 x i8], [596 x i8]* @str, i64 0, i64 0))
ret void
}
void sscal(int n, double sa, double *sx, int incx) {
  int i, nincx;
  if (n <= 0)
    return;
  nincx = n * incx;
  for (i = 0; i < nincx; i += incx)
    sx[i] *= sa;
}


x86 assembly (clang, -O0):
<sscal>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x0,-0x4(%rbp)
jg     1122 <sscal+0x22>
jmp    1164 <sscal+0x64>
mov    -0x4(%rbp),%eax
imul   -0x1c(%rbp),%eax
mov    %eax,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    1164 <sscal+0x64>
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    1133 <sscal+0x33>
pop    %rbp
ret

x86 assembly (clang, -O2):
<sscal>:
test   %edi,%edi
jle    1136 <sscal+0x36>
imul   %edx,%edi
test   %edi,%edi
jle    1136 <sscal+0x36>
movslq %edx,%rax
mov    %edi,%ecx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rsi,%rdx,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsi,%rdx,8)
add    %rax,%rdx
cmp    %rcx,%rdx
jl     1120 <sscal+0x20>
ret

LLVM IR (-O0):
define void @sscal(i32 %0, double %1, double* %2, i32 %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store double %1, double* %6
store double* %2, double** %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
%12 = icmp sle i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %4
br label %34
14: ; preds = %4
%15 = load i32, i32* %5
%16 = load i32, i32* %8
%17 = mul nsw i32 %15, %16
store i32 %17, i32* %10
store i32 0, i32* %9
br label %18
18: ; preds = %30, %14
%19 = load i32, i32* %9
%20 = load i32, i32* %10
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %34
22: ; preds = %18
%23 = load double, double* %6
%24 = load double*, double** %7
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %24, i64 %26
%28 = load double, double* %27
%29 = fmul double %28, %23
store double %29, double* %27
br label %30
30: ; preds = %22
%31 = load i32, i32* %8
%32 = load i32, i32* %9
%33 = add nsw i32 %32, %31
store i32 %33, i32* %9
br label %18
34: ; preds = %13, %18
ret void
}

LLVM IR (-O2):
define void @sscal(i32 %0, double %1, double* nocapture %2, i32 %3) {
%5 = icmp slt i32 %0, 1
br i1 %5, label %19, label %6
6: ; preds = %4
%7 = mul nsw i32 %3, %0
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = sext i32 %3 to i64
%11 = zext i32 %7 to i64
br label %12
12: ; preds = %9, %12
%13 = phi i64 [ 0, %9 ], [ %17, %12 ]
%14 = getelementptr inbounds double, double* %2, i64 %13
%15 = load double, double* %14
%16 = fmul double %15, %1
store double %16, double* %14
%17 = add i64 %13, %10
%18 = icmp slt i64 %17, %11
br i1 %18, label %12, label %19
19: ; preds = %12, %6, %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void cnative_err_input_too_big() {
  printf("Error: The entered value is too big and cannot be handled.\n");
}


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

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

LLVM IR (-O0):
@.str = [60 x i8] c"Error: The entered value is too big and cannot be handled.\0A\00"
define void @cnative_err_input_too_big() {
%1 = call i32 @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [59 x i8] c"Error: The entered value is too big and cannot be handled.\00"
define void @cnative_err_input_too_big() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
ret void
}
void analysis_init() {}


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

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

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

LLVM IR (-O2):
define void @analysis_init() {
ret void
}
int func(void) {
  int n = 3;
  int m = 5;
  n %= m;
  return 0;
}


x86 assembly (clang, -O0):
<func>:
push   %rbp
mov    %rsp,%rbp
movl   $0x3,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @func() {
ret i32 0
}
int type_quota(int objtype) {
  int qtype;
  switch (objtype) {
  case 0x0:
    qtype = 1;
    break;
  case 0x2:
    qtype = 2;
    break;
  case 0x3:
    qtype = 4;
    break;
  default:
    qtype = 3;
  }
  return (qtype);
}


x86 assembly (clang, -O0):
<type_quota>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
test   %eax,%eax
je     113c <type_quota+0x3c>
jmp    111a <type_quota+0x1a>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1148 <type_quota+0x48>
jmp    112b <type_quota+0x2b>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     1154 <type_quota+0x54>
jmp    1160 <type_quota+0x60>
movl   $0x1,-0x8(%rbp)
jmp    1167 <type_quota+0x67>
movl   $0x2,-0x8(%rbp)
jmp    1167 <type_quota+0x67>
movl   $0x4,-0x8(%rbp)
jmp    1167 <type_quota+0x67>
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @type_quota(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
switch i32 %4, label %8 [
i32 0, label %5
i32 2, label %6
i32 3, label %7
]
5: ; preds = %1
store i32 1, i32* %3
br label %9
6: ; preds = %1
store i32 2, i32* %3
br label %9
7: ; preds = %1
store i32 4, i32* %3
br label %9
8: ; preds = %1
store i32 3, i32* %3
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
@switch.table.type_quota = [4 x i32] [i32 1, i32 3, i32 2, i32 4]
define i32 @type_quota(i32 %0) {
%2 = icmp ult i32 %0, 4
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [4 x i32], [4 x i32]* @switch.table.type_quota, i64 0, i64 %4
%6 = load i32, i32* %5
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 3, %1 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void print_usage(const char *program) {
  fprintf(
      stderr,
      "Usage: %s [OPTIONS] SIZE FILE\n"
      "Create empty FILE with size SIZE\n"
      "SIZE is the number of bytes to allocate, which may have a size suffix "
      "(k, m, g)\n"
      "\n"
      "Options:\n"
      "  -h  show this help message\n"
      "  -b  use binary sizes (powers of 1024) for the suffixes     (default)\n"
      "  -s  use SI sizes (powers of 1000) for the suffixes\n"
      "  -n  do not perform the operation if FILE exists            (default)\n"
      "  -f  force the operation even if FILE already exists, which\n"
      "        may either extend or truncate the file\n",
      program);
}


x86 assembly (clang, -O0):
<print_usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [486 x i8] c"Usage: %s [OPTIONS] SIZE FILE\0ACreate empty FILE with size SIZE\0ASIZE is the number of bytes to allocate, which may have a size suffix (k, m, g)\0A\0AOptions:\0A -h show this help message\0A -b use binary sizes (powers of 1024) for the suffixes (default)\0A -s use SI sizes (powers of 1000) for the suffixes\0A -n do not perform the operation if FILE exists (default)\0A -f force the operation even if FILE already exists, which\0A may either extend or truncate the file\0A\00"
define void @print_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 ([486 x i8], [486 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [486 x i8] c"Usage: %s [OPTIONS] SIZE FILE\0ACreate empty FILE with size SIZE\0ASIZE is the number of bytes to allocate, which may have a size suffix (k, m, g)\0A\0AOptions:\0A -h show this help message\0A -b use binary sizes (powers of 1024) for the suffixes (default)\0A -s use SI sizes (powers of 1000) for the suffixes\0A -n do not perform the operation if FILE exists (default)\0A -f force the operation even if FILE already exists, which\0A may either extend or truncate the file\0A\00"
define void @print_usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([486 x i8], [486 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
char *clonestr(char *);
char *InstantDEX_openorders() {
  return (clonestr("{\"error\":\"API is not yet\"}"));
}


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

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

LLVM IR (-O0):
@.str = [27 x i8] c"{\22error\22:\22API is not yet\22}\00"
define i8* @InstantDEX_openorders() {
%1 = call i8* @clonestr(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [27 x i8] c"{\22error\22:\22API is not yet\22}\00"
define i8* @InstantDEX_openorders() {
%1 = tail call i8* @clonestr(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
int LiuShuiJianFa_cost(struct Ability *self) { return 60; }


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

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

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

LLVM IR (-O2):
%struct.Ability = type opaque
define i32 @LiuShuiJianFa_cost(%struct.Ability* nocapture readnone %0) {
ret i32 60
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int pib_is_permissive_lid(uint16_t lid) {
  return (lid == 0) || (lid == (0xFFFF));
}


x86 assembly (clang, -O0):
<pib_is_permissive_lid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1123 <pib_is_permissive_lid+0x23>
cmpl   $0xffff,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pib_is_permissive_lid>:
test   %edi,%edi
sete   %al
cmp    $0xffff,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @pib_is_permissive_lid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 65535
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ true, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @pib_is_permissive_lid(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = icmp eq i32 %0, 65535
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
typedef scalar_t__ uint8_t;

/* Variables and functions */
int vec_ui8_asc_compare(const void *p1, const void *p2) {
  const uint8_t *pp1 = (const uint8_t *)p1;
  const uint8_t *pp2 = (const uint8_t *)p2;
  if (*pp1 < *pp2)
    return -1;
  if (*pp1 > *pp2)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<vec_ui8_asc_compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%rax
jge    113c <vec_ui8_asc_compare+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1163 <vec_ui8_asc_compare+0x63>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%rax
jle    115c <vec_ui8_asc_compare+0x5c>
movl   $0x1,-0x4(%rbp)
jmp    1163 <vec_ui8_asc_compare+0x63>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec_ui8_asc_compare>:
mov    (%rdi),%rax
xor    %ecx,%ecx
cmp    (%rsi),%rax
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @vec_ui8_asc_compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = bitcast i8* %1 to i64*
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp slt i64 %5, %6
%8 = icmp sgt i64 %5, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
int gcd(int m, int n) { return (m == 0) ? n : (n == 0) ? m : gcd(n, m % n); }


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1133 <gcd+0x23>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1162 <gcd+0x52>
cmpl   $0x0,-0x8(%rbp)
jne    1148 <gcd+0x38>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    115c <gcd+0x4c>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%esi
call   1030 <gcd@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %esi,%edx
test   %edi,%edi
je     111e <gcd+0x1e>
mov    %edi,%eax
test   %edx,%edx
je     1120 <gcd+0x20>
nopl   0x0(%rax)
mov    %edx,%ecx
cltd
idiv   %ecx
mov    %ecx,%eax
test   %edx,%edx
jne    1110 <gcd+0x10>
mov    %ecx,%eax
ret
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = icmp eq i32 %1, 0
br i1 %5, label %11, label %6
6: ; preds = %4, %6
%7 = phi i32 [ %8, %6 ], [ %0, %4 ]
%8 = phi i32 [ %9, %6 ], [ %1, %4 ]
%9 = srem i32 %7, %8
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6, %4, %2
%12 = phi i32 [ %1, %2 ], [ %0, %4 ], [ %8, %6 ]
ret i32 %12
}
long zs() { return 0x0000ffffL; }


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

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

LLVM IR (-O0):
define i64 @zs() {
ret i64 65535
}

LLVM IR (-O2):
define i64 @zs() {
ret i64 65535
}
int main() { return 3 - -4; }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 7
}
/* Variables and functions */
int /*<<< orphan*/ debugPrint(char *);
int /*<<< orphan*/ next_glPauseTransformFeedback();
int /*<<< orphan*/ printGLError();
void glPauseTransformFeedback() {
  next_glPauseTransformFeedback();
  printGLError();
  debugPrint("glPauseTransformFeedback()\n");
}


x86 assembly (clang, -O0):
<glPauseTransformFeedback>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <next_glPauseTransformFeedback@plt>
mov    $0x0,%al
call   1030 <printGLError@plt>
lea    0xeb7(%rip),%rdi
call   1040 <debugPrint@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<glPauseTransformFeedback>:
push   %rax
xor    %eax,%eax
call   1050 <next_glPauseTransformFeedback@plt>
xor    %eax,%eax
call   1030 <printGLError@plt>
lea    0xeba(%rip),%rdi
pop    %rax
jmp    1040 <debugPrint@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"glPauseTransformFeedback()\0A\00"
define void @glPauseTransformFeedback() {
%1 = call i32 (...) @next_glPauseTransformFeedback()
%2 = call i32 (...) @printGLError()
%3 = call i32 @debugPrint(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"glPauseTransformFeedback()\0A\00"
define void @glPauseTransformFeedback() {
%1 = tail call i32 (...) @next_glPauseTransformFeedback()
%2 = tail call i32 (...) @printGLError()
%3 = tail call i32 @debugPrint(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
ret void
}
int cost_default(struct Ability *self) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.Ability = type opaque
define i32 @cost_default(%struct.Ability* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void usage() { puts("usage: fbsectsum (infile)"); }


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"usage: fbsectsum (infile)\00"
define void @usage() {
%1 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"usage: fbsectsum (infile)\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
ret void
}
void RandomFunc(unsigned char input[1], unsigned char output[1]) {
  unsigned char state[1];
  unsigned char local1;
  {
    state[0UL] = input[0UL] ^ (unsigned char)219;
    local1 = 0UL;
    while (local1 < (unsigned char)0) {
      state[local1] =
          state[0UL] << (((state[0UL] >> (unsigned char)1) & (unsigned char)7) |
                         1UL);
      local1 += 2UL;
    }
    output[0UL] = (state[0UL] | 214125455UL) | (unsigned char)221;
  }
}


x86 assembly (clang, -O0):
<RandomFunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
xor    $0xdb,%eax
mov    %al,-0x11(%rbp)
movb   $0x0,-0x12(%rbp)
movzbl -0x12(%rbp),%eax
cmp    $0x0,%eax
jge    115d <RandomFunc+0x5d>
movzbl -0x11(%rbp),%eax
movzbl -0x11(%rbp),%ecx
sar    $0x1,%ecx
and    $0x7,%ecx
movslq %ecx,%rcx
or     $0x1,%rcx
shl    %cl,%eax
mov    %al,%cl
movzbl -0x12(%rbp),%eax
mov    %cl,-0x11(%rbp,%rax,1)
movzbl -0x12(%rbp),%eax
add    $0x2,%rax
mov    %al,-0x12(%rbp)
jmp    111f <RandomFunc+0x1f>
movzbl -0x11(%rbp),%eax
or     $0xcc34b8f,%rax
or     $0xdd,%rax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomFunc>:
mov    (%rdi),%al
or     $0xdf,%al
mov    %al,(%rsi)
ret

LLVM IR (-O0):
define void @RandomFunc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1 x i8]
%6 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = xor i32 %10, 219
%12 = trunc i32 %11 to i8
%13 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
store i8 %12, i8* %13
store i8 0, i8* %6
br label %14
14: ; preds = %18, %2
%15 = load i8, i8* %6
%16 = zext i8 %15 to i32
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %39
18: ; preds = %14
%19 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
%22 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = ashr i32 %24, 1
%26 = and i32 %25, 7
%27 = sext i32 %26 to i64
%28 = or i64 %27, 1
%29 = trunc i64 %28 to i32
%30 = shl i32 %21, %29
%31 = trunc i32 %30 to i8
%32 = load i8, i8* %6
%33 = zext i8 %32 to i64
%34 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 %33
store i8 %31, i8* %34
%35 = load i8, i8* %6
%36 = zext i8 %35 to i64
%37 = add i64 %36, 2
%38 = trunc i64 %37 to i8
store i8 %38, i8* %6
br label %14
39: ; preds = %14
%40 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%41 = load i8, i8* %40
%42 = zext i8 %41 to i64
%43 = or i64 %42, 214125455
%44 = or i64 %43, 221
%45 = trunc i64 %44 to i8
%46 = load i8*, i8** %4
%47 = getelementptr inbounds i8, i8* %46, i64 0
store i8 %45, i8* %47
ret void
}

LLVM IR (-O2):
define void @RandomFunc(i8* nocapture %0, i8* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = or i8 %3, -33
store i8 %4, i8* %1
ret void
}
int test_imm_97uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x97 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_97uint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 151
%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_97uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 9895936
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}