xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ pointer();
main() { pointer(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @pointer()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @pointer()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ MYSQL;

/* Variables and functions */
int mysql_query(int /*<<< orphan*/ *, char *);
void *mysql_store_result(int /*<<< orphan*/ *);
int sql_query(void *sql, char *query, void **res) {
  int err;
  err = mysql_query((MYSQL *)sql, query);
  if (err)
    return err;
  if (res) {
    *res = mysql_store_result((MYSQL *)sql);
  }
  return 0;
}


x86 assembly (clang, -O0):
<sql_query>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <mysql_query@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
je     1159 <sql_query+0x39>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    117e <sql_query+0x5e>
cmpq   $0x0,-0x20(%rbp)
je     1177 <sql_query+0x57>
mov    -0x10(%rbp),%rdi
call   1040 <mysql_store_result@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sql_query>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rdi,%rbx
call   1030 <mysql_query@plt>
mov    %eax,%ebp
test   %r14,%r14
je     1145 <sql_query+0x25>
test   %ebp,%ebp
jne    1145 <sql_query+0x25>
mov    %rbx,%rdi
call   1040 <mysql_store_result@plt>
mov    %rax,(%r14)
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @sql_query(i8* %0, i8* %1, i8** writeonly %2) {
%4 = bitcast i8* %0 to i32*
%5 = tail call i32 @mysql_query(i32* %4, i8* %1)
%6 = icmp ne i32 %5, 0
%7 = icmp eq i8** %2, null
%8 = or i1 %7, %6
br i1 %8, label %11, label %9
9: ; preds = %3
%10 = tail call i8* @mysql_store_result(i32* %4)
store i8* %10, i8** %2
br label %11
11: ; preds = %9, %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ dump_memory_range(int /*<<< orphan*/, int);
void dump_memory() { dump_memory_range(0, 1024); }


x86 assembly (clang, -O0):
<dump_memory>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x400,%esi
call   1030 <dump_memory_range@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<dump_memory>:
xor    %edi,%edi
mov    $0x400,%esi
jmp    1030 <dump_memory_range@plt>

LLVM IR (-O0):
define void @dump_memory() {
%1 = call i32 @dump_memory_range(i32 0, i32 1024)
ret void
}

LLVM IR (-O2):
define void @dump_memory() {
%1 = tail call i32 @dump_memory_range(i32 0, i32 1024)
ret void
}
void ImageDemo(void) {}


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

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

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

LLVM IR (-O2):
define void @ImageDemo() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void zraiseOpenFileError(const char *name) {
  printf("Error: Cannot open file \"%s\".\n", name);
}


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"Error: Cannot open file \22%s\22.\0A\00"
define void @zraiseOpenFileError(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Error: Cannot open file \22%s\22.\0A\00"
define void @zraiseOpenFileError(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint8_t;

/* Variables and functions */
uint8_t pgm_read_byte(const uint8_t *p) { return *p; }


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

x86 assembly (clang, -O2):
<pgm_read_byte>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @pgm_read_byte(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hello() { printf("Hello World.\n"); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"Hello World.\0A\00"
define void @hello() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [13 x i8] c"Hello World.\00"
define void @hello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ family;
};
typedef TYPE_1__ XHostAddress;

/* Variables and functions */
int get_XHostAddress_family(void *_p) {
  return (int)((XHostAddress *)_p)->family;
}


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

x86 assembly (clang, -O2):
<get_XHostAddress_family>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define i32 @get_XHostAddress_family(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @get_XHostAddress_family(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ XDestroyWindowEvent;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_XDestroyWindowEvent(void) {
  XDestroyWindowEvent *_p =
      (XDestroyWindowEvent *)malloc(sizeof(XDestroyWindowEvent));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_XDestroyWindowEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_XDestroyWindowEvent+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_XDestroyWindowEvent>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_XDestroyWindowEvent+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @alloc_XDestroyWindowEvent() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @alloc_XDestroyWindowEvent() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ gen_call(char *);
int /*<<< orphan*/ gen_pop();
void gen_xor(void) {
  gen_pop();
  gen_call("ccxor");
}


x86 assembly (clang, -O0):
<gen_xor>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <gen_pop@plt>
lea    0xece(%rip),%rdi
call   1040 <gen_call@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_xor>:
push   %rax
xor    %eax,%eax
call   1030 <gen_pop@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <gen_call@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"ccxor\00"
define void @gen_xor() {
%1 = call i32 (...) @gen_pop()
%2 = call i32 @gen_call(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"ccxor\00"
define void @gen_xor() {
%1 = tail call i32 (...) @gen_pop()
%2 = tail call i32 @gen_call(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
char *map_file(p_name, pp_mem, p_length)
char *p_name;
char **pp_mem;
unsigned long *p_length;
{ return stan_map(p_name, pp_mem, p_length); }


x86 assembly (clang, -O0):
<map_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1030 <stan_map@plt>
cltq
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @map_file(i8* %0, i8** %1, i64* %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i64*
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i64* %2, i64** %6
%7 = load i8*, i8** %4
%8 = load i8**, i8*** %5
%9 = load i64*, i64** %6
%10 = call i32 (i8*, i8**, i64*, ...) bitcast (i32 (...)* @stan_map to i32 (i8*, i8**, i64*, ...)*)(i8* %7, i8** %8, i64* %9)
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i8*
ret i8* %12
}

LLVM IR (-O2):
define i8* @map_file(i8* %0, i8** %1, i64* %2) {
%4 = tail call i32 (i8*, i8**, i64*, ...) bitcast (i32 (...)* @stan_map to i32 (i8*, i8**, i64*, ...)*)(i8* %0, i8** %1, i64* %2)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}
int fun1185() { return 1185; }


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

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

LLVM IR (-O0):
define i32 @fun1185() {
ret i32 1185
}

LLVM IR (-O2):
define i32 @fun1185() {
ret i32 1185
}
int joystick_arch_init_resources(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @joystick_arch_init_resources() {
ret i32 0
}
int blank_char(int ch) { return (ch == 32 || ch == 10 || ch == 12); }


x86 assembly (clang, -O0):
<blank_char>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     112f <blank_char+0x2f>
mov    $0x1,%al
cmpl   $0xa,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     112f <blank_char+0x2f>
cmpl   $0xc,-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):
<blank_char>:
mov    $0x1,%eax
cmp    $0xa,%edi
je     110f <blank_char+0xf>
cmp    $0x20,%edi
jne    1110 <blank_char+0x10>
ret
xor    %eax,%eax
cmp    $0xc,%edi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @blank_char(i32 %0) {
switch i32 %0, label %2 [
i32 32, label %5
i32 10, label %5
]
2: ; preds = %1
%3 = icmp eq i32 %0, 12
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ]
ret i32 %6
}
void str_copy(char *restrict sd, const char *restrict sc) {
  while ((*sd++ = *sc++) != '\0')
    ;
}


x86 assembly (clang, -O0):
<str_copy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0x0,%eax
je     113f <str_copy+0x3f>
jmp    110c <str_copy+0xc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_copy>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rsi,%rax,1),%ecx
mov    %cl,(%rdi,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <str_copy+0x10>
ret

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

LLVM IR (-O2):
define void @str_copy(i8* noalias nocapture writeonly %0, i8* noalias nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = phi i8* [ %1, %2 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %7, i8* %4
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret void
}
/* Variables and functions */
int modify(int);
int /*<<< orphan*/ printf(char *, int);
int call(int number) {
  printf("%c", modify(number / 16));
  printf("%c", modify(number % 16));
  return 0;
}


x86 assembly (clang, -O0):
<call>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <modify@plt>
mov    %eax,%esi
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
mov    $0x10,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
call   1030 <modify@plt>
mov    %eax,%esi
lea    0xe9a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<call>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
lea    0xf(%rbx),%ebp
test   %edi,%edi
cmovns %edi,%ebp
mov    %ebp,%edi
sar    $0x4,%edi
call   1030 <modify@plt>
lea    0xec1(%rip),%r14
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
and    $0xfffffff0,%ebp
sub    %ebp,%ebx
mov    %ebx,%edi
call   1030 <modify@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define i32 @call(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sdiv i32 %3, 16
%5 = call i32 @modify(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %2
%8 = srem i32 %7, 16
%9 = call i32 @modify(i32 %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @call(i32 %0) {
%2 = sdiv i32 %0, 16
%3 = tail call i32 @modify(i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = srem i32 %0, 16
%6 = tail call i32 @modify(i32 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ __m64;

/* Variables and functions */
int /*<<< orphan*/ _mm_sra_pi16(int /*<<< orphan*/, int /*<<< orphan*/);
__m64 test65(__m64 a, __m64 b) { return _mm_sra_pi16(a, b); }


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

x86 assembly (clang, -O2):
<test65>:
jmp    1030 <_mm_sra_pi16@plt>

LLVM IR (-O0):
define i32 @test65(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 @_mm_sra_pi16(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @test65(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_sra_pi16(i32 %0, i32 %1)
ret i32 %3
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ printf(char *, int);
int waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
void sig_child(int signo) {
  pid_t pid;
  while ((pid = waitpid(-1, NULL, WNOHANG)) > 0)
    printf("[Server Log]: child pid[%d] terminated.\n", pid);
}


x86 assembly (clang, -O0):
<sig_child>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edx
mov    $0xffffffff,%edi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <waitpid@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1162 <sig_child+0x42>
mov    -0x8(%rbp),%esi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
jmp    112b <sig_child+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_child>:
push   %r14
push   %rbx
push   %rax
mov    0x2ebd(%rip),%r14
mov    (%r14),%edx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1040 <waitpid@plt>
test   %eax,%eax
jle    116d <sig_child+0x4d>
lea    0xebb(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    (%r14),%edx
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1040 <waitpid@plt>
test   %eax,%eax
jg     1150 <sig_child+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@WNOHANG = global i32 0
@.str = [41 x i8] c"[Server Log]: child pid[%d] terminated.\0A\00"
define void @sig_child(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %8, %1
%5 = load i32, i32* @WNOHANG
%6 = call i32 @waitpid(i32 -1, i32* null, i32 %5)
store i32 %6, i32* %3
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %4
11: ; preds = %4
ret void
}

LLVM IR (-O2):
@WNOHANG = global i32 0
@.str = [41 x i8] c"[Server Log]: child pid[%d] terminated.\0A\00"
define void @sig_child(i32 %0) {
%2 = load i32, i32* @WNOHANG
%3 = tail call i32 @waitpid(i32 -1, i32* null, i32 %2)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %11
5: ; preds = %1, %5
%6 = phi i32 [ %9, %5 ], [ %3, %1 ]
%7 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @WNOHANG
%9 = tail call i32 @waitpid(i32 -1, i32* null, i32 %8)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %5, label %11
11: ; preds = %5, %1
ret void
}
/* Variables and functions */
char tolower(char c) {
  return (c < 91 && c >= 65 ? c + 32 : c > 97 ? c - 32 : c);
}


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x5b,%eax
jge    1133 <tolower+0x33>
movsbl -0x1(%rbp),%eax
cmp    $0x41,%eax
jl     1133 <tolower+0x33>
movsbl -0x1(%rbp),%eax
add    $0x20,%eax
mov    %eax,-0x8(%rbp)
jmp    115c <tolower+0x5c>
movsbl -0x1(%rbp),%eax
cmp    $0x61,%eax
jle    114f <tolower+0x4f>
movsbl -0x1(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0xc(%rbp)
jmp    1156 <tolower+0x56>
movsbl -0x1(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolower>:
lea    -0x41(%rdi),%eax
lea    0x20(%rdi),%ecx
lea    -0x20(%rdi),%edx
cmp    $0x62,%dil
movzbl %dl,%edx
cmovl  %edi,%edx
cmp    $0x1a,%al
movzbl %cl,%eax
cmovae %edx,%eax
ret

LLVM IR (-O0):
define signext i8 @tolower(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp slt i32 %4, 91
br i1 %5, label %6, label %14
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sge i32 %8, 65
br i1 %9, label %10, label %14
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = add nsw i32 %12, 32
br label %27
14: ; preds = %6, %1
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sgt i32 %16, 97
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = sub nsw i32 %20, 32
br label %25
22: ; preds = %14
%23 = load i8, i8* %2
%24 = sext i8 %23 to i32
br label %25
25: ; preds = %22, %18
%26 = phi i32 [ %21, %18 ], [ %24, %22 ]
br label %27
27: ; preds = %25, %10
%28 = phi i32 [ %13, %10 ], [ %26, %25 ]
%29 = trunc i32 %28 to i8
ret i8 %29
}

LLVM IR (-O2):
define signext i8 @tolower(i8 signext %0) {
%2 = add i8 %0, -65
%3 = icmp ult i8 %2, 26
%4 = add i8 %0, 32
%5 = icmp sgt i8 %0, 97
%6 = add i8 %0, -32
%7 = select i1 %5, i8 %6, i8 %0
%8 = select i1 %3, i8 %4, i8 %7
ret i8 %8
}
int is_comment(char *arr) {
  if (arr[0] == ';')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_comment>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3b,%eax
jne    1124 <is_comment+0x24>
movl   $0x1,-0x4(%rbp)
jmp    112b <is_comment+0x2b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_comment>:
xor    %eax,%eax
cmpb   $0x3b,(%rdi)
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_comment(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 59
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ zinfo(char *, int);
int /*<<< orphan*/ zsleep(int);
void *do_log_test(void *arg) {
  for (int i = 0; i < 1000; i++) {
    zsleep(1);
    zinfo("coroutine-server do_log_test %d", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<do_log_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x3e8,-0xc(%rbp)
jge    1167 <do_log_test+0x47>
mov    $0x1,%edi
call   1030 <zsleep@plt>
mov    -0xc(%rbp),%esi
lea    0xeac(%rip),%rdi
call   1040 <zinfo@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <do_log_test+0x13>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_log_test>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0xed3(%rip),%r14
nopl   (%rax)
mov    $0x1,%edi
call   1030 <zsleep@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1040 <zinfo@plt>
add    $0x1,%ebx
cmp    $0x3e8,%ebx
jne    1130 <do_log_test+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [32 x i8] c"coroutine-server do_log_test %d\00"
define i8* @do_log_test(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %11, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 1000
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = call i32 @zsleep(i32 1)
%9 = load i32, i32* %3
%10 = call i32 @zinfo(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %9)
br label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
br label %4
14: ; preds = %4
ret i8* null
}

LLVM IR (-O2):
@.str = [32 x i8] c"coroutine-server do_log_test %d\00"
define noalias i8* @do_log_test(i8* nocapture readnone %0) {
br label %3
2: ; preds = %3
ret i8* null
3: ; preds = %1, %3
%4 = phi i32 [ 0, %1 ], [ %7, %3 ]
%5 = tail call i32 @zsleep(i32 1)
%6 = tail call i32 @zinfo(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %4)
%7 = add nuw nsw i32 %4, 1
%8 = icmp eq i32 %7, 1000
br i1 %8, label %2, label %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void sayHello() { printf("hello world\n"); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"hello world\0A\00"
define void @sayHello() {
%1 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [12 x i8] c"hello world\00"
define void @sayHello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ my_malloc(size_t, char *);
double *my_mallocd(size_t n, char *what) {
  return (double *)my_malloc((n ? n : 1) * sizeof(double), what);
}


x86 assembly (clang, -O0):
<my_mallocd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1138 <my_mallocd+0x28>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1146 <my_mallocd+0x36>
mov    $0x1,%eax
mov    %rax,-0x18(%rbp)
jmp    1146 <my_mallocd+0x36>
mov    -0x18(%rbp),%rdi
shl    $0x3,%rdi
mov    -0x10(%rbp),%rsi
call   1030 <my_malloc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_mallocd>:
lea    0x0(,%rdi,8),%rax
test   %rdi,%rdi
mov    $0x8,%edi
cmovne %rax,%rdi
jmp    1030 <my_malloc@plt>

LLVM IR (-O0):
define double* @my_mallocd(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
store i8* %1, i8** %4
%5 = load i64, i64* %3
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = load i64, i64* %3
br label %10
9: ; preds = %2
br label %10
10: ; preds = %9, %7
%11 = phi i64 [ %8, %7 ], [ 1, %9 ]
%12 = mul i64 %11, 8
%13 = load i8*, i8** %4
%14 = call i64 @my_malloc(i64 %12, i8* %13)
%15 = inttoptr i64 %14 to double*
ret double* %15
}

LLVM IR (-O2):
define double* @my_mallocd(i64 %0, i8* %1) {
%3 = icmp eq i64 %0, 0
%4 = shl i64 %0, 3
%5 = select i1 %3, i64 8, i64 %4
%6 = tail call i64 @my_malloc(i64 %5, i8* %1)
%7 = inttoptr i64 %6 to double*
ret double* %7
}
int mod(int n) {
  if (n < 0)
    n = -n;
  return n;
}


x86 assembly (clang, -O0):
<mod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1119 <mod+0x19>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @mod(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int get_min(int a, int b) { return a < b ? a : b; }


x86 assembly (clang, -O0):
<get_min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <get_min+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <get_min+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_min>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

LLVM IR (-O0):
define i32 @get_min(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 = icmp slt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @get_min(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printValue(int, int);
int /*<<< orphan*/ printf(char *);
int identifyTrailingZeros(int value) {
  value = ~value & (value - 1);
  printValue(value, 8);
  printf(" ITZS\n");
  return value;
}


x86 assembly (clang, -O0):
<identifyTrailingZeros>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
and    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x8,%esi
call   1040 <printValue@plt>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<identifyTrailingZeros>:
push   %rbx
lea    -0x1(%rdi),%ebx
mov    %edi,%eax
not    %eax
and    %eax,%ebx
mov    %ebx,%edi
mov    $0x8,%esi
call   1040 <printValue@plt>
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@str = [6 x i8] c" ITZS\00"
define i32 @identifyTrailingZeros(i32 %0) {
%2 = xor i32 %0, -1
%3 = add nsw i32 %0, -1
%4 = and i32 %3, %2
%5 = tail call i32 @printValue(i32 %4, i32 8)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ quicksort3(int *, int);
void qsort_web3(int *values, int n) { quicksort3(values, n); }


x86 assembly (clang, -O0):
<qsort_web3>:
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 <quicksort3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qsort_web3>:
jmp    1030 <quicksort3@plt>

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

LLVM IR (-O2):
define void @qsort_web3(i32* %0, i32 %1) {
%3 = tail call i32 @quicksort3(i32* %0, i32 %1)
ret void
}
unsigned leftmost_one(unsigned x) {
  x |= (x >> 1);
  x |= (x >> 2);
  x |= (x >> 4);
  x |= (x >> 8);
  x |= (x >> 16);
  x ^= (x >> 1);
  return x;
}


x86 assembly (clang, -O0):
<leftmost_one>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<leftmost_one>:
mov    %edi,%eax
shr    %eax
or     %edi,%eax
mov    %eax,%ecx
shr    $0x2,%ecx
or     %eax,%ecx
mov    %ecx,%eax
shr    $0x4,%eax
or     %ecx,%eax
mov    %eax,%ecx
shr    $0x8,%ecx
or     %eax,%ecx
mov    %ecx,%edx
shr    $0x10,%edx
or     %ecx,%edx
mov    %edx,%eax
shr    %eax
xor    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @leftmost_one(i32 %0) {
%2 = lshr i32 %0, 1
%3 = or i32 %2, %0
%4 = lshr i32 %3, 2
%5 = or i32 %4, %3
%6 = lshr i32 %5, 4
%7 = or i32 %6, %5
%8 = lshr i32 %7, 8
%9 = or i32 %8, %7
%10 = lshr i32 %9, 16
%11 = or i32 %10, %9
%12 = lshr i32 %11, 1
%13 = xor i32 %12, %11
ret i32 %13
}
double fun(double x) { return (x + 4) * (x + 4); }


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
addsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
addsd  0xef8(%rip),%xmm0
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @fun(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double %3, 4.000000e+00
%5 = load double, double* %2
%6 = fadd double %5, 4.000000e+00
%7 = fmul double %4, %6
ret double %7
}

LLVM IR (-O2):
define double @fun(double %0) {
%2 = fadd double %0, 4.000000e+00
%3 = fmul double %2, %2
ret double %3
}
/* Variables and functions */
scalar_t__ checkConflict(int *, int, int);
int checkBoard(int *board, int n) {
  int i = 0;
  for (i = 0; i < n; i++)
    if (checkConflict(board, n, i))
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<checkBoard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1171 <checkBoard+0x61>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <checkConflict@plt>
cmp    $0x0,%rax
je     115e <checkBoard+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1178 <checkBoard+0x68>
jmp    1163 <checkBoard+0x53>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112d <checkBoard+0x1d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkBoard>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
jle    1138 <checkBoard+0x28>
mov    %esi,%ebx
mov    %rdi,%r14
xor    %ebp,%ebp
nop
mov    %r14,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <checkConflict@plt>
test   %rax,%rax
jne    113c <checkBoard+0x2c>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1120 <checkBoard+0x10>
xor    %eax,%eax
jmp    1141 <checkBoard+0x31>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @checkBoard(i32* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 0, i32* %6
store i32 0, i32* %6
br label %7
7: ; preds = %19, %2
%8 = load i32, i32* %6
%9 = load i32, i32* %5
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %22
11: ; preds = %7
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call i64 @checkConflict(i32* %12, i32 %13, i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %11
store i32 1, i32* %3
br label %23
18: ; preds = %11
br label %19
19: ; preds = %18
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
store i32 %21, i32* %6
br label %7
22: ; preds = %7
store i32 0, i32* %3
br label %23
23: ; preds = %22, %17
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @checkBoard(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %6, label %11
4: ; preds = %6
%5 = icmp eq i32 %10, %1
br i1 %5, label %11, label %6
6: ; preds = %2, %4
%7 = phi i32 [ %10, %4 ], [ 0, %2 ]
%8 = tail call i64 @checkConflict(i32* %0, i32 %1, i32 %7)
%9 = icmp eq i64 %8, 0
%10 = add nuw nsw i32 %7, 1
br i1 %9, label %4, label %11
11: ; preds = %6, %4, %2
%12 = phi i32 [ 0, %2 ], [ 0, %4 ], [ 1, %6 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ vp8_variance(unsigned char *, int, unsigned char *, int, int,
                                int, unsigned int *, int *);
unsigned int vp8_variance16x8_c(unsigned char *src_ptr, int source_stride,
                                unsigned char *ref_ptr, int recon_stride,
                                unsigned int *sse) {
  unsigned int var;
  int avg;
  vp8_variance(src_ptr, source_stride, ref_ptr, recon_stride, 16, 8, &var,
               &avg);
  *sse = var;
  return (var - ((avg * avg) >> 7));
}


x86 assembly (clang, -O0):
<vp8_variance16x8_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    $0x10,%r8d
mov    $0x8,%r9d
lea    -0x2c(%rbp),%r10
lea    -0x30(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <vp8_variance@plt>
mov    -0x2c(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%eax
mov    -0x30(%rbp),%ecx
imul   -0x30(%rbp),%ecx
sar    $0x7,%ecx
sub    %ecx,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vp8_variance16x8_c>:
push   %rbx
sub    $0x10,%rsp
mov    %r8,%rbx
lea    0x8(%rsp),%rax
lea    0xc(%rsp),%r10
mov    $0x10,%r8d
mov    $0x8,%r9d
push   %rax
push   %r10
call   1030 <vp8_variance@plt>
add    $0x10,%rsp
mov    0xc(%rsp),%eax
mov    %eax,(%rbx)
mov    0x8(%rsp),%ecx
imul   %ecx,%ecx
shr    $0x7,%ecx
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @vp8_variance16x8_c(i8* %0, i32 %1, i8* %2, i32 %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i32 %3, i32* %9
store i32* %4, i32** %10
%13 = load i8*, i8** %6
%14 = load i32, i32* %7
%15 = load i8*, i8** %8
%16 = load i32, i32* %9
%17 = call i32 @vp8_variance(i8* %13, i32 %14, i8* %15, i32 %16, i32 16, i32 8, i32* %11, i32* %12)
%18 = load i32, i32* %11
%19 = load i32*, i32** %10
store i32 %18, i32* %19
%20 = load i32, i32* %11
%21 = load i32, i32* %12
%22 = load i32, i32* %12
%23 = mul nsw i32 %21, %22
%24 = ashr i32 %23, 7
%25 = sub i32 %20, %24
ret i32 %25
}

LLVM IR (-O2):
define i32 @vp8_variance16x8_c(i8* %0, i32 %1, i8* %2, i32 %3, i32* nocapture writeonly %4) {
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %6 to i8*
%9 = bitcast i32* %7 to i8*
%10 = call i32 @vp8_variance(i8* %0, i32 %1, i8* %2, i32 %3, i32 16, i32 8, i32* %6, i32* %7)
%11 = load i32, i32* %6
store i32 %11, i32* %4
%12 = load i32, i32* %7
%13 = mul nsw i32 %12, %12
%14 = lshr i32 %13, 7
%15 = sub i32 %11, %14
ret i32 %15
}
int my_lbrace(struct jslex *lexer) { return 1; }


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

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

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

LLVM IR (-O2):
%struct.jslex = type opaque
define i32 @my_lbrace(%struct.jslex* nocapture readnone %0) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_intrinsic() { printf("#<closure>"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"#<closure>\00"
define void @print_intrinsic() {
%1 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"#<closure>\00"
define void @print_intrinsic() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hello_world(void) { printf("Hello, World!\n"); }


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, World!\0A\00"
define void @hello_world() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [14 x i8] c"Hello, World!\00"
define void @hello_world() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gen(char *);
void cgexit(void) {
  gen("popq\t%rbp");
  gen("ret");
}


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

x86 assembly (clang, -O2):
<cgexit>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <gen@plt>
lea    0xee6(%rip),%rdi
pop    %rax
jmp    1030 <gen@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"popq\09%rbp\00"
@.str.1 = [4 x i8] c"ret\00"
define void @cgexit() {
%1 = call i32 @gen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @gen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"popq\09%rbp\00"
@.str.1 = [4 x i8] c"ret\00"
define void @cgexit() {
%1 = tail call i32 @gen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @gen(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ __m64;

/* Variables and functions */
int /*<<< orphan*/ _mm_unpacklo_pi8(int /*<<< orphan*/, int /*<<< orphan*/);
__m64 test81(__m64 a, __m64 b) { return _mm_unpacklo_pi8(a, b); }


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

x86 assembly (clang, -O2):
<test81>:
jmp    1030 <_mm_unpacklo_pi8@plt>

LLVM IR (-O0):
define i32 @test81(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 @_mm_unpacklo_pi8(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @test81(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_unpacklo_pi8(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fb_move_cursor(int /*<<< orphan*/);
int /*<<< orphan*/ fb_write_cell(unsigned int, char, unsigned char,
                                 unsigned char);
void fb_clear(unsigned char bg) {
  unsigned int i, fb_size = 80 * 50;
  for (i = 0; i < fb_size; i++) {
    fb_write_cell(i, ' ', bg, bg);
  }
  fb_move_cursor(0);
}


x86 assembly (clang, -O0):
<fb_clear>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0xfa0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    116d <fb_clear+0x4d>
mov    -0x8(%rbp),%edi
mov    -0x1(%rbp),%al
mov    $0x20,%esi
movzbl %al,%edx
movzbl -0x1(%rbp),%ecx
call   1040 <fb_write_cell@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113c <fb_clear+0x1c>
xor    %edi,%edi
call   1030 <fb_move_cursor@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @fb_clear(i8 zeroext %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 0, %1 ], [ %5, %2 ]
%4 = tail call i32 @fb_write_cell(i32 %3, i8 signext 32, i8 zeroext %0, i8 zeroext %0)
%5 = add nuw nsw i32 %3, 1
%6 = icmp eq i32 %5, 4000
br i1 %6, label %7, label %2
7: ; preds = %2
%8 = tail call i32 @fb_move_cursor(i32 0)
ret void
}