xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ e_imm();
int /*<<< orphan*/ e_ora();
void e_ora_imm() {
  e_imm();
  e_ora();
}


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

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

LLVM IR (-O0):
define void @e_ora_imm() {
%1 = call i32 (...) @e_imm()
%2 = call i32 (...) @e_ora()
ret void
}

LLVM IR (-O2):
define void @e_ora_imm() {
%1 = tail call i32 (...) @e_imm()
%2 = tail call i32 (...) @e_ora()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ panic_blink(int);
void undefined(void) { panic_blink(1); }


x86 assembly (clang, -O0):
<undefined>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <panic_blink@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @undefined() {
%1 = call i32 @panic_blink(i32 1)
ret void
}

LLVM IR (-O2):
define void @undefined() {
%1 = tail call i32 @panic_blink(i32 1)
ret void
}
void main(void) {
  int x;
  int y;
  int m;
  if (x == 5) {
    y = 7;
    y = x / m;
    if (x < 2) {
      int w;
      w = x;
    }
  } else {
    m = 8 + m;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
cmpl   $0x5,-0x4(%rbp)
jne    1134 <main+0x34>
movl   $0x7,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x8(%rbp)
cmpl   $0x2,-0x4(%rbp)
jge    112f <main+0x2f>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    113d <main+0x3d>
mov    -0xc(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0xc(%rbp)
pop    %rbp
ret

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

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

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

/* Variables and functions */
int /*<<< orphan*/ write(int, int *, int);
ssize_t i2c_write_addr_data24(int fd, uint8_t addr, uint32_t data) {
  uint8_t buffer[4];
  buffer[0] = addr;
  buffer[1] = data;
  buffer[2] = data >> 8;
  buffer[3] = data >> 16;
  return write(fd, buffer, 4);
}


x86 assembly (clang, -O0):
<i2c_write_addr_data24>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
sar    $0x10,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_write_addr_data24>:
sub    $0x18,%rsp
mov    %esi,(%rsp)
mov    %edx,0x4(%rsp)
mov    %edx,%eax
sar    $0x8,%eax
mov    %eax,0x8(%rsp)
sar    $0x10,%edx
mov    %edx,0xc(%rsp)
mov    %rsp,%rsi
mov    $0x4,%edx
call   1030 <write@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @i2c_write_addr_data24(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [4 x i32]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
store i32 %8, i32* %9
%10 = load i32, i32* %6
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 1
store i32 %10, i32* %11
%12 = load i32, i32* %6
%13 = ashr i32 %12, 8
%14 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 2
store i32 %13, i32* %14
%15 = load i32, i32* %6
%16 = ashr i32 %15, 16
%17 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 3
store i32 %16, i32* %17
%18 = load i32, i32* %4
%19 = getelementptr inbounds [4 x i32], [4 x i32]* %7, i64 0, i64 0
%20 = call i32 @write(i32 %18, i32* %19, i32 4)
ret i32 %20
}

LLVM IR (-O2):
define i32 @i2c_write_addr_data24(i32 %0, i32 %1, i32 %2) {
%4 = alloca [4 x i32]
%5 = bitcast [4 x i32]* %4 to i8*
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 0
store i32 %1, i32* %6
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 1
store i32 %2, i32* %7
%8 = ashr i32 %2, 8
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 2
store i32 %8, i32* %9
%10 = ashr i32 %2, 16
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %4, i64 0, i64 3
store i32 %10, i32* %11
%12 = call i32 @write(i32 %0, i32* %6, i32 4)
ret i32 %12
}
int main(void) {
#pragma omp target
  {}
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
int get_int16_be(const uint8_t *buffer) {
  uint32_t n;
  n = (buffer[0] << 8) | buffer[1];
  return n;
}


x86 assembly (clang, -O0):
<get_int16_be>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
or     0x4(%rcx),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_int16_be>:
mov    (%rdi),%eax
shl    $0x8,%eax
or     0x4(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @get_int16_be(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 0
%6 = load i32, i32* %5
%7 = shl i32 %6, 8
%8 = load i32*, i32** %2
%9 = getelementptr inbounds i32, i32* %8, i64 1
%10 = load i32, i32* %9
%11 = or i32 %7, %10
store i32 %11, i32* %3
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @get_int16_be(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = shl i32 %2, 8
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = or i32 %3, %5
ret i32 %6
}
/* Variables and functions */
int f();
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int zz = f();
  printf("%d\n", zz);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <f@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xeb6(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @f()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
char *str_trim_left(char *s) {
  while ((*s > 0 && *s < 33) ? 1 : 0)
    s++;
  return s;
}


x86 assembly (clang, -O0):
<str_trim_left>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
jle    112d <str_trim_left+0x2d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x21,%eax
setl   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
cmp    $0x0,%eax
je     1157 <str_trim_left+0x57>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <str_trim_left+0x8>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_trim_left>:
mov    %rdi,%rax
add    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
add    $0xff,%cl
cmp    $0x20,%cl
jb     1110 <str_trim_left+0x10>
ret

LLVM IR (-O0):
define i8* @str_trim_left(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %18, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp slt i32 %11, 33
br label %13
13: ; preds = %8, %3
%14 = phi i1 [ false, %3 ], [ %12, %8 ]
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 1, i32 0
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %13
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %2
br label %3
21: ; preds = %13
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
define i8* @str_trim_left(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = add i8 %4, -1
%6 = icmp ult i8 %5, 32
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %2, label %8
8: ; preds = %2
ret i8* %3
}
int main(int argc, const char **argv) {}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
void not() { asm volatile("notq 0x8(%%rsp)\n\t" :::); }


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

x86 assembly (clang, -O2):
<not>:
notq   0x8(%rsp)
ret

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

LLVM IR (-O2):
define void @not() {
tail call void asm sideeffect "notq 0x8(%rsp)\0A\09", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
void crashlog_init_bootmem(struct bootmem_data *bdata) {}


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

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

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

LLVM IR (-O2):
%struct.bootmem_data = type opaque
define void @crashlog_init_bootmem(%struct.bootmem_data* nocapture %0) {
ret void
}
char *hash_plugin_summary(void) {
  return ("desunix \tDES(Unix) plugin (.htpasswd)");
}


x86 assembly (clang, -O0):
<hash_plugin_summary>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_plugin_summary>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [38 x i8] c"desunix \09DES(Unix) plugin (.htpasswd)\00"
define i8* @hash_plugin_summary() {
ret i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [38 x i8] c"desunix \09DES(Unix) plugin (.htpasswd)\00"
define i8* @hash_plugin_summary() {
ret i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  char *usagestring;
  usagestring =
      "Usage: rhnsd [OPTION...] \nRed Hat Network Services Daemon \n \n  -f, "
      "--foreground           Run in foreground \n  -i, --interval=MINS        "
      "Connect to Red Hat Network every MINS minutes \n  -v, --verbose         "
      "     Log all actions to syslog \n  -h, --help                 Give this "
      "help list \n  -u, --usage                Give this help list \n  -V, "
      "--version              Print program version \n \nMandatory or optional "
      "arguments to long options are also mandatory or optional \nfor any "
      "corresponding short options.\n";
  fprintf(stderr, usagestring);
}


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

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [513 x i8] c"Usage: rhnsd [OPTION...] \0ARed Hat Network Services Daemon \0A \0A -f, --foreground Run in foreground \0A -i, --interval=MINS Connect to Red Hat Network every MINS minutes \0A -v, --verbose Log all actions to syslog \0A -h, --help Give this help list \0A -u, --usage Give this help list \0A -V, --version Print program version \0A \0AMandatory or optional arguments to long options are also mandatory or optional \0Afor any corresponding short options.\0A\00"
@stderr = global i32 0
define void @usage() {
%1 = alloca i8*
store i8* getelementptr inbounds ([513 x i8], [513 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i32, i32* @stderr
%3 = load i8*, i8** %1
%4 = call i32 @fprintf(i32 %2, i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [513 x i8] c"Usage: rhnsd [OPTION...] \0ARed Hat Network Services Daemon \0A \0A -f, --foreground Run in foreground \0A -i, --interval=MINS Connect to Red Hat Network every MINS minutes \0A -v, --verbose Log all actions to syslog \0A -h, --help Give this help list \0A -u, --usage Give this help list \0A -V, --version Print program version \0A \0AMandatory or optional arguments to long options are also mandatory or optional \0Afor any corresponding short options.\0A\00"
@stderr = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([513 x i8], [513 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PRINT_ERR(char *, char *, int);
int base_main(int argc, char **argv) {
  PRINT_ERR("aubio was not compiled with aubio_sink_"
            "undefined"
            ", failed running %s with %d args\n",
            argv[0], argc);
  return 0;
}


x86 assembly (clang, -O0):
<base_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x4(%rbp),%edx
lea    0xed0(%rip),%rdi
call   1030 <PRINT_ERR@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<base_main>:
push   %rax
mov    %edi,%edx
mov    (%rsi),%rsi
lea    0xee3(%rip),%rdi
call   1030 <PRINT_ERR@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [82 x i8] c"aubio was not compiled with aubio_sink_undefined, failed running %s with %d args\0A\00"
define i32 @base_main(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 = getelementptr inbounds i8*, i8** %5, i64 0
%7 = load i8*, i8** %6
%8 = load i32, i32* %3
%9 = call i32 @PRINT_ERR(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [82 x i8] c"aubio was not compiled with aubio_sink_undefined, failed running %s with %d args\0A\00"
define i32 @base_main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @PRINT_ERR(i8* getelementptr inbounds ([82 x i8], [82 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %0)
ret i32 0
}
/* Variables and functions */
int O_APPEND;
int O_RDWR;
int open(char const *, int);
int openfile(const char *filename) { return open(filename, O_RDWR | O_APPEND); }


x86 assembly (clang, -O0):
<openfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ec1(%rip),%rax
mov    (%rax),%esi
mov    0x2ea0(%rip),%rax
or     (%rax),%esi
call   1030 <open@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openfile>:
mov    0x2ed1(%rip),%rax
mov    0x2eb2(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
jmp    1030 <open@plt>

LLVM IR (-O0):
@O_RDWR = global i32 0
@O_APPEND = global i32 0
define i32 @openfile(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @O_RDWR
%5 = load i32, i32* @O_APPEND
%6 = or i32 %4, %5
%7 = call i32 @open(i8* %3, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
@O_RDWR = global i32 0
@O_APPEND = global i32 0
define i32 @openfile(i8* nocapture %0) {
%2 = load i32, i32* @O_RDWR
%3 = load i32, i32* @O_APPEND
%4 = or i32 %3, %2
%5 = tail call i32 @open(i8* %0, i32 %4)
ret i32 %5
}
/* Variables and functions */
unsigned int string_length(char const *str) {
  unsigned int num = 0;
  if (str == NULL)
    return num;
  while (str[num] != '\0') {
    num++;
  }
  return num;
}


x86 assembly (clang, -O0):
<string_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1125 <string_length+0x25>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1152 <string_length+0x52>
jmp    112a <string_length+0x2a>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     114c <string_length+0x4c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112a <string_length+0x2a>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_length>:
test   %rdi,%rdi
je     111a <string_length+0x1a>
mov    $0xffffffff,%eax
nopw   0x0(%rax,%rax,1)
add    $0x1,%eax
cmpb   $0x0,(%rdi,%rax,1)
jne    1110 <string_length+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @string_length(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i32, i32* %4
store i32 %8, i32* %2
br label %23
9: ; preds = %1
br label %10
10: ; preds = %18, %9
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = zext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %21
18: ; preds = %10
%19 = load i32, i32* %4
%20 = add i32 %19, 1
store i32 %20, i32* %4
br label %10
21: ; preds = %10
%22 = load i32, i32* %4
store i32 %22, i32* %2
br label %23
23: ; preds = %21, %7
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
define i32 @string_length(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ 0, %1 ]
%5 = zext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
%9 = add i32 %4, 1
br i1 %8, label %10, label %3
10: ; preds = %3, %1
%11 = phi i32 [ 0, %1 ], [ %4, %3 ]
ret i32 %11
}
char stu_atomic_read_char(const char *v) { return (*(volatile char *)v); }


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

x86 assembly (clang, -O2):
<stu_atomic_read_char>:
mov    (%rdi),%al
ret

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

LLVM IR (-O2):
define signext i8 @stu_atomic_read_char(i8* %0) {
%2 = load volatile i8, i8* %0
ret i8 %2
}
linemod(s) char *s;
{ printf("linemod(%s)\n", s); }


x86 assembly (clang, -O0):
<linemod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linemod>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"linemod(%s)\0A\00"
define i32 @linemod(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ fb_hMemCpy(unsigned char *, unsigned char const *, int);
void fb_image_convert_32bgrto32(const unsigned char *src, unsigned char *dest,
                                int w) {
  fb_hMemCpy(dest, src, w << 2);
}


x86 assembly (clang, -O0):
<fb_image_convert_32bgrto32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x14(%rbp),%edx
shl    $0x2,%edx
call   1030 <fb_hMemCpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fb_image_convert_32bgrto32>:
mov    %rdi,%rax
shl    $0x2,%edx
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <fb_hMemCpy@plt>

LLVM IR (-O0):
define void @fb_image_convert_32bgrto32(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
%7 = load i8*, i8** %5
%8 = load i8*, i8** %4
%9 = load i32, i32* %6
%10 = shl i32 %9, 2
%11 = call i32 @fb_hMemCpy(i8* %7, i8* %8, i32 %10)
ret void
}

LLVM IR (-O2):
define void @fb_image_convert_32bgrto32(i8* %0, i8* %1, i32 %2) {
%4 = shl i32 %2, 2
%5 = tail call i32 @fb_hMemCpy(i8* %1, i8* %0, i32 %4)
ret void
}
void funct_remove_packet(char *str, char c) {
  char *pr = str, *pw = str;
  while (*pr) {
    *pw = *pr++;
    pw += (*pw != c);
  }
  *pw = '\0';
  return;
}


x86 assembly (clang, -O0):
<funct_remove_packet>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     116a <funct_remove_packet+0x6a>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
jmp    111e <funct_remove_packet+0x1e>
mov    -0x20(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<funct_remove_packet>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <funct_remove_packet+0x28>
lea    0x1(%rdi),%rax
nopw   0x0(%rax,%rax,1)
mov    %cl,(%rdi)
xor    %edx,%edx
cmp    %sil,%cl
setne  %dl
add    %rdx,%rdi
movzbl (%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <funct_remove_packet+0x10>
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @funct_remove_packet(i8* nocapture %0, i8 signext %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %13, %5 ], [ %3, %2 ]
%7 = phi i8* [ %12, %5 ], [ %0, %2 ]
%8 = phi i8* [ %9, %5 ], [ %0, %2 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
store i8 %6, i8* %7
%10 = icmp ne i8 %6, %1
%11 = zext i1 %10 to i64
%12 = getelementptr inbounds i8, i8* %7, i64 %11
%13 = load i8, i8* %9
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i8* [ %0, %2 ], [ %12, %5 ]
store i8 0, i8* %16
ret void
}
double tan_func(x)
double x;
{ return -1.0 - (1.0 / 15.0) * x * x - (2.0 / 315.0) * x * x * x * x; }


x86 assembly (clang, -O0):
<tan_func>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeff(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xeca(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xeb6(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<tan_func>:
movsd  0xef8(%rip),%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0xef0(%rip),%xmm1
movsd  0xef0(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @tan_func(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double 0x3FB1111111111111, %3
%5 = load double, double* %2
%6 = fneg double %4
%7 = call double @llvm.fmuladd.f64(double %6, double %5, double -1.000000e+00)
%8 = load double, double* %2
%9 = fmul double 0x3F7A01A01A01A01A, %8
%10 = load double, double* %2
%11 = fmul double %9, %10
%12 = load double, double* %2
%13 = fmul double %11, %12
%14 = load double, double* %2
%15 = fneg double %13
%16 = call double @llvm.fmuladd.f64(double %15, double %14, double %7)
ret double %16
}

LLVM IR (-O2):
define double @tan_func(double %0) {
%2 = fmul double %0, 0xBFB1111111111111
%3 = tail call double @llvm.fmuladd.f64(double %2, double %0, double -1.000000e+00)
%4 = fmul double %0, 0xBF7A01A01A01A01A
%5 = fmul double %4, %0
%6 = fmul double %5, %0
%7 = tail call double @llvm.fmuladd.f64(double %6, double %0, double %3)
ret double %7
}
/* Variables and functions */
int tolower(int);
int isalpha(int c) {
  c = tolower(c);
  return c >= 'a' && c <= 'z';
}


x86 assembly (clang, -O0):
<isalpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <tolower@plt>
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x61,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     113f <isalpha+0x2f>
cmpl   $0x7a,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isalpha>:
push   %rax
call   1030 <tolower@plt>
add    $0xffffff9f,%eax
xor    %ecx,%ecx
cmp    $0x1a,%eax
setb   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @isalpha(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @tolower(i32 %3)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp sge i32 %5, 97
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 122
br label %10
10: ; preds = %7, %1
%11 = phi i1 [ false, %1 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @isalpha(i32 %0) {
%2 = tail call i32 @tolower(i32 %0)
%3 = add i32 %2, -97
%4 = icmp ult i32 %3, 26
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("$(messageriscv)"
         "\n");
  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 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [16 x i8] c"$(messageriscv)\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int gcd(int, int);
int lcm(int, int);
int /*<<< orphan*/ printf(char *, int, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(int argc, const char *argv[]) {
  int a, b;
  scanf("%d %d", &a, &b);
  printf("%d %d", gcd(a, b), lcm(a, b));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea3(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1060 <gcd@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <lcm@plt>
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1060 <gcd@plt>
mov    %eax,%ebp
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1040 <lcm@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @gcd(i32 %8, i32 %9)
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = call i32 @lcm(i32 %11, i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %13)
ret i32 0
}
int seq() { return 1; }


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

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

LLVM IR (-O0):
define i32 @seq() {
ret i32 1
}

LLVM IR (-O2):
define i32 @seq() {
ret i32 1
}
/* Variables and functions */
int _link_error(char *, int);
int link(char *, char *);
int __link(char *file1, char *file2) {
  if (link(file1, file2) == -1)
    return _link_error(file2, 1);
  return 0;
}


x86 assembly (clang, -O0):
<__link>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <link@plt>
cmp    $0xffffffff,%eax
jne    115c <__link+0x3c>
mov    -0x18(%rbp),%rdi
mov    $0x1,%esi
call   1030 <_link_error@plt>
mov    %eax,-0x4(%rbp)
jmp    1163 <__link+0x43>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__link>:
push   %rbx
mov    %rsi,%rbx
call   1040 <link@plt>
cmp    $0xffffffff,%eax
je     1132 <__link+0x12>
xor    %eax,%eax
pop    %rbx
ret
mov    %rbx,%rdi
mov    $0x1,%esi
pop    %rbx
jmp    1030 <_link_error@plt>

LLVM IR (-O0):
define i32 @__link(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = load i8*, i8** %5
%8 = call i32 @link(i8* %6, i8* %7)
%9 = icmp eq i32 %8, -1
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8*, i8** %5
%12 = call i32 @_link_error(i8* %11, i32 1)
store i32 %12, i32* %3
br label %14
13: ; preds = %2
store i32 0, i32* %3
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
define i32 @__link(i8* %0, i8* %1) {
%3 = tail call i32 @link(i8* %0, i8* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @_link_error(i8* %1, i32 1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ 0, %2 ]
ret i32 %8
}
/* Variables and functions */
int open(char const *, int);
int ugene_custom_open(const char *filename, int oflag) {
  return open(filename, oflag);
}


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

x86 assembly (clang, -O2):
<ugene_custom_open>:
jmp    1030 <open@plt>

LLVM IR (-O0):
define i32 @ugene_custom_open(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 @open(i8* %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @ugene_custom_open(i8* nocapture %0, i32 %1) {
%3 = tail call i32 @open(i8* %0, i32 %1)
ret i32 %3
}
int test_imm_D0uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0xD0 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_D0uint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 208
%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_D0uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 208
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ OpenSSL_add_all_algorithms();
void pem_openssl_start() { OpenSSL_add_all_algorithms(); }


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

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

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

LLVM IR (-O2):
define void @pem_openssl_start() {
%1 = tail call i32 (...) @OpenSSL_add_all_algorithms()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar(int /*<<< orphan*/);
void foo3(void) {
#pragma omp critical(foo)
#pragma omp critical(foo)
  bar(0);
}


x86 assembly (clang, -O0):
<foo3>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <bar@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo3>:
xor    %edi,%edi
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @foo3() {
%1 = call i32 @bar(i32 0)
ret void
}

LLVM IR (-O2):
define void @foo3() {
%1 = tail call i32 @bar(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void lib_create_drive_direct(int v0, int v1) {
  printf("create_drive_direct  %d  %d \n", v0, v1);
}


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

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

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

LLVM IR (-O2):
@.str = [30 x i8] c"create_drive_direct %d %d \0A\00"
define void @lib_create_drive_direct(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret void
}
int main(void) {
  int n = sizeof(int);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
bool isascending(int x, int y, int z) {
  if ((x < y) && (y < z)) {
    return true;
  } else {
    return false;
  }
}


x86 assembly (clang, -O0):
<isascending>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1131 <isascending+0x31>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1131 <isascending+0x31>
movl   $0x1,-0x4(%rbp)
jmp    1138 <isascending+0x38>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isascending>:
cmp    %esi,%edi
setl   %al
cmp    %edx,%esi
setl   %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @isascending(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = icmp slt i32 %1, %2
%6 = and i1 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ codemode(int, int, int);
int findmode(char *, int *);
int standard(int code, char *label, char *mnemo, char *oper) {
  register int add;
  int value;
  add = findmode(oper, &value);
  codemode(code, add, value);
  return 0;
}


x86 assembly (clang, -O0):
<standard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1040 <findmode@plt>
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
call   1030 <codemode@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<standard>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
lea    0xc(%rsp),%rsi
mov    %rcx,%rdi
call   1040 <findmode@plt>
mov    0xc(%rsp),%edx
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <codemode@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @standard(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%11 = load i8*, i8** %8
%12 = call i32 @findmode(i8* %11, i32* %10)
store i32 %12, i32* %9
%13 = load i32, i32* %5
%14 = load i32, i32* %9
%15 = load i32, i32* %10
%16 = call i32 @codemode(i32 %13, i32 %14, i32 %15)
ret i32 0
}

LLVM IR (-O2):
define i32 @standard(i32 %0, i8* nocapture readnone %1, i8* nocapture readnone %2, i8* %3) {
%5 = alloca i32
%6 = bitcast i32* %5 to i8*
%7 = call i32 @findmode(i8* %3, i32* %5)
%8 = load i32, i32* %5
%9 = call i32 @codemode(i32 %0, i32 %7, i32 %8)
ret i32 0
}
long int foo(long int x) { return x * x + (8 * x) << (4 - x); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    $0x4,%ecx
sub    -0x8(%rbp),%rcx
shl    %cl,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
lea    0x8(%rdi),%rax
imul   %rdi,%rax
mov    $0x4,%cl
sub    %dil,%cl
shl    %cl,%rax
ret

LLVM IR (-O0):
define i64 @foo(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = load i64, i64* %2
%5 = mul nsw i64 %3, %4
%6 = load i64, i64* %2
%7 = mul nsw i64 8, %6
%8 = add nsw i64 %5, %7
%9 = load i64, i64* %2
%10 = sub nsw i64 4, %9
%11 = shl i64 %8, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @foo(i64 %0) {
%2 = add i64 %0, 8
%3 = mul i64 %2, %0
%4 = sub nsw i64 4, %0
%5 = shl i64 %3, %4
ret i64 %5
}
/* Variables and functions */
scalar_t__ rb_islower(int);
scalar_t__ rb_isupper(int);
int rb_isalpha(int c) { return rb_isupper(c) || rb_islower(c); }


x86 assembly (clang, -O0):
<rb_isalpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <rb_isupper@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    1157 <rb_isalpha+0x37>
mov    -0x4(%rbp),%edi
call   1040 <rb_islower@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rb_isalpha>:
push   %rbx
mov    %edi,%ebx
call   1030 <rb_isupper@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1137 <rb_isalpha+0x17>
pop    %rbx
ret
mov    %ebx,%edi
call   1040 <rb_islower@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rb_isalpha(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @rb_isupper(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i64 @rb_islower(i32 %7)
%9 = icmp ne i64 %8, 0
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @rb_isalpha(i32 %0) {
%2 = tail call i64 @rb_isupper(i32 %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = tail call i64 @rb_islower(i32 %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
char *strrchr(char const *, char);
const char *last_path_component(char const *name) {
  char const *slash = strrchr(name, '/');
  return (slash) ? slash + 1 : name;
}


x86 assembly (clang, -O0):
<last_path_component>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114a <last_path_component+0x3a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1152 <last_path_component+0x42>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<last_path_component>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @last_path_component(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strrchr(i8* %4, i8 signext 47)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
br label %13
11: ; preds = %1
%12 = load i8*, i8** %2
br label %13
13: ; preds = %11, %8
%14 = phi i8* [ %10, %8 ], [ %12, %11 ]
ret i8* %14
}

LLVM IR (-O2):
define i8* @last_path_component(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
int main() { int a = 4 / 0; }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
scalar_t__ DBL_EPSILON;
scalar_t__ fabs(double);
double roundd(double d) { return (fabs(d) < DBL_EPSILON ? 0 : d); }


x86 assembly (clang, -O0):
<roundd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <fabs@plt>
mov    0x2eba(%rip),%rcx
cmp    (%rcx),%rax
jge    1144 <roundd+0x34>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    114e <roundd+0x3e>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roundd>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <fabs@plt>
mov    0x2ec6(%rip),%rcx
xorps  %xmm0,%xmm0
cmp    (%rcx),%rax
jl     112f <roundd+0x1f>
movsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
@DBL_EPSILON = global i64 0
define double @roundd(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @fabs(double %3)
%5 = load i64, i64* @DBL_EPSILON
%6 = icmp slt i64 %4, %5
br i1 %6, label %7, label %8
7: ; preds = %1
br label %10
8: ; preds = %1
%9 = load double, double* %2
br label %10
10: ; preds = %8, %7
%11 = phi double [ 0.000000e+00, %7 ], [ %9, %8 ]
ret double %11
}

LLVM IR (-O2):
@DBL_EPSILON = global i64 0
define double @roundd(double %0) {
%2 = tail call i64 @fabs(double %0)
%3 = load i64, i64* @DBL_EPSILON
%4 = icmp slt i64 %2, %3
%5 = select i1 %4, double 0.000000e+00, double %0
ret double %5
}
void glutVisibilityFunc(void (*func)(int state)) {}


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

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

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

LLVM IR (-O2):
define void @glutVisibilityFunc(void (i32)* nocapture %0) {
ret void
}