xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ expand(char *, char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int main() {
  char s1[1024], s2[1024];
  fgets(s1, 1024, stdin);
  expand(s1, s2);
  printf("%s", s2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x410(%rbp),%rdi
mov    0x2e98(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1040 <fgets@plt>
lea    -0x410(%rbp),%rdi
lea    -0x810(%rbp),%rsi
call   1050 <expand@plt>
lea    -0x810(%rbp),%rsi
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x810,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x808,%rsp
mov    0x2ea7(%rip),%rax
mov    (%rax),%edx
lea    0x400(%rsp),%r14
mov    %r14,%rdi
mov    $0x400,%esi
call   1040 <fgets@plt>
mov    %rsp,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <expand@plt>
lea    0xe93(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x808,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %3, i32 1024, i32 %5)
%7 = call i32 @expand(i8* %3, i8* %4)
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void net_close_socket(int sd) { close(sd); }


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

x86 assembly (clang, -O2):
<net_close_socket>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @net_close_socket(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ LRDP(char *);
void uc2_rdphalf_2() { LRDP("uc2:rdphalf_2\n"); }


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

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

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

LLVM IR (-O2):
@.str = [15 x i8] c"uc2:rdphalf_2\0A\00"
define void @uc2_rdphalf_2() {
%1 = tail call i32 @LRDP(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct _stor_fopen_rsp {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct _stor_fopen_rsp *);
void stor_fopen_rsp_free(struct _stor_fopen_rsp *ptr) { free(ptr); }


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

x86 assembly (clang, -O2):
<stor_fopen_rsp_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct._stor_fopen_rsp = type { i32 }
define void @stor_fopen_rsp_free(%struct._stor_fopen_rsp* %0) {
%2 = alloca %struct._stor_fopen_rsp*
store %struct._stor_fopen_rsp* %0, %struct._stor_fopen_rsp** %2
%3 = load %struct._stor_fopen_rsp*, %struct._stor_fopen_rsp** %2
%4 = call i32 @free(%struct._stor_fopen_rsp* %3)
ret void
}

LLVM IR (-O2):
%struct._stor_fopen_rsp = type { i32 }
define void @stor_fopen_rsp_free(%struct._stor_fopen_rsp* nocapture %0) {
%2 = tail call i32 @free(%struct._stor_fopen_rsp* %0)
ret void
}
/* Type definitions */
struct gl_test {
  int dummy;
};
struct gl_api {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ gl_get_core30(struct gl_api *);
int /*<<< orphan*/ gl_test_swap_buffers(struct gl_test *);
int /*<<< orphan*/ gl_test_wait_for_key(struct gl_test *);
scalar_t__ is_test_interactive();
int /*<<< orphan*/ white(int /*<<< orphan*/);
int init_cache_(struct gl_api *gl, struct gl_test *test) {
  white(gl_get_core30(gl));
  gl_test_swap_buffers(test);
  if (is_test_interactive()) {
    gl_test_wait_for_key(test);
  }
  return 0;
}


x86 assembly (clang, -O0):
<init_cache_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <gl_get_core30@plt>
mov    %eax,%edi
call   1040 <white@plt>
mov    -0x10(%rbp),%rdi
call   1030 <gl_test_swap_buffers@plt>
mov    $0x0,%al
call   1050 <is_test_interactive@plt>
cmp    $0x0,%rax
je     1193 <init_cache_+0x43>
mov    -0x10(%rbp),%rdi
call   1060 <gl_test_wait_for_key@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_cache_>:
push   %rbx
mov    %rsi,%rbx
call   1070 <gl_get_core30@plt>
mov    %eax,%edi
call   1040 <white@plt>
mov    %rbx,%rdi
call   1030 <gl_test_swap_buffers@plt>
xor    %eax,%eax
call   1050 <is_test_interactive@plt>
test   %rax,%rax
je     117c <init_cache_+0x2c>
mov    %rbx,%rdi
call   1060 <gl_test_wait_for_key@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.gl_api = type { i32 }
%struct.gl_test = type { i32 }
define i32 @init_cache_(%struct.gl_api* %0, %struct.gl_test* %1) {
%3 = alloca %struct.gl_api*
%4 = alloca %struct.gl_test*
store %struct.gl_api* %0, %struct.gl_api** %3
store %struct.gl_test* %1, %struct.gl_test** %4
%5 = load %struct.gl_api*, %struct.gl_api** %3
%6 = call i32 @gl_get_core30(%struct.gl_api* %5)
%7 = call i32 @white(i32 %6)
%8 = load %struct.gl_test*, %struct.gl_test** %4
%9 = call i32 @gl_test_swap_buffers(%struct.gl_test* %8)
%10 = call i64 (...) @is_test_interactive()
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load %struct.gl_test*, %struct.gl_test** %4
%14 = call i32 @gl_test_wait_for_key(%struct.gl_test* %13)
br label %15
15: ; preds = %12, %2
ret i32 0
}

LLVM IR (-O2):
%struct.gl_api = type { i32 }
%struct.gl_test = type { i32 }
define i32 @init_cache_(%struct.gl_api* %0, %struct.gl_test* %1) {
%3 = tail call i32 @gl_get_core30(%struct.gl_api* %0)
%4 = tail call i32 @white(i32 %3)
%5 = tail call i32 @gl_test_swap_buffers(%struct.gl_test* %1)
%6 = tail call i64 (...) @is_test_interactive()
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = tail call i32 @gl_test_wait_for_key(%struct.gl_test* %1)
br label %10
10: ; preds = %8, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stdout;
void simple_printf(char *buf) {
  fprintf(stdout, "%s", buf);
  fflush(stdout);
}


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

x86 assembly (clang, -O2):
<simple_printf>:
push   %rbx
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rbx
mov    (%rbx),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [3 x i8] c"%s\00"
define void @simple_printf(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stdout
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stdout
%7 = call i32 @fflush(i32 %6)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [3 x i8] c"%s\00"
define void @simple_printf(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stdout
%5 = tail call i32 @fflush(i32 %4)
ret void
}
void EC_METHOD_get_field_type(void) {}


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

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

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

LLVM IR (-O2):
define void @EC_METHOD_get_field_type() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void hello(int x) { printf("Let's print this number: %d\n", x); }


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"Let's print this number: %d\0A\00"
define void @hello(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Let's print this number: %d\0A\00"
define void @hello(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
void *memalloc(int /*<<< orphan*/);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int /*<<< orphan*/);
void *memcalloc(uint16_t num, uint16_t size) {
  size *= num;
  void *mem = memalloc(size);
  if (mem)
    memset(mem, 0, size);
  return mem;
}


x86 assembly (clang, -O0):
<memcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <memalloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115d <memcalloc+0x3d>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memcalloc>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
imul   %esi,%ebx
mov    %ebx,%edi
call   1030 <memalloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     1144 <memcalloc+0x24>
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebx,%edx
call   1040 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @memcalloc(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = tail call i8* @memalloc(i32 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @memset(i8* %4, i32 0, i32 %3)
br label %8
8: ; preds = %6, %2
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint8_t;

/* Variables and functions */
uint8_t dvbsubs_get_type(const uint8_t *p_dvbsubs) { return p_dvbsubs[1]; }


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

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

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

LLVM IR (-O2):
define i32 @dvbsubs_get_type(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void do_one_thing(int *pnum_times) {
  for (;;) {
    printf("doing one thing\n");
  }
}


x86 assembly (clang, -O0):
<do_one_thing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
jmp    111c <do_one_thing+0xc>

x86 assembly (clang, -O2):
<do_one_thing>:
push   %rbx
lea    0xee8(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
jmp    1120 <do_one_thing+0x10>

LLVM IR (-O0):
@.str = [17 x i8] c"doing one thing\0A\00"
define void @do_one_thing(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
br label %3
3: ; preds = %3, %1
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %3
}

LLVM IR (-O2):
@str = [16 x i8] c"doing one thing\00"
define void @do_one_thing(i32* nocapture readnone %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int foo(char *x) { memset(x, 0, 6); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
mov    $0x6,%edx
call   1030 <memset@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
xor    %esi,%esi
mov    $0x6,%edx
jmp    1030 <memset@plt>

LLVM IR (-O0):
define i32 @foo(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i32 @memset(i8* %4, i32 0, i32 6)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
define i32 @foo(i8* %0) {
%2 = tail call i32 @memset(i8* %0, i32 0, i32 6)
ret i32 undef
}
void PDMR3CritSectYield(void) {}


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

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

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

LLVM IR (-O2):
define void @PDMR3CritSectYield() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *argv[]) {
  fprintf(stderr, "Usage: %s nsets assoc nrefs reps\n", argv[0]);
  exit(-1);
}


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

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"Usage: %s nsets assoc nrefs reps\0A\00"
define void @usage(i8** nocapture %0) {
%2 = load i32, i32* @stderr
%3 = load i8*, i8** %0
%4 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = tail call i32 @exit(i32 -1)
unreachable
}
/* Type definitions */
typedef int pid_t;

/* Variables and functions */
int /*<<< orphan*/ WNOHANG;
int /*<<< orphan*/ printf(char *, int);
int waitpid(int, int *, int /*<<< orphan*/);
void sigchld_handler(int signo) {
  int status;
  pid_t pid;
  while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
    printf("[process %d completed]\n", pid);
  }
}


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

x86 assembly (clang, -O2):
<sigchld_handler>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    0x2eb8(%rip),%r15
mov    (%r15),%edx
lea    0xc(%rsp),%rsi
mov    $0xffffffff,%edi
call   1040 <waitpid@plt>
test   %eax,%eax
jle    117e <sigchld_handler+0x5e>
lea    0xeb3(%rip),%r14
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    (%r15),%edx
mov    $0xffffffff,%edi
mov    %rbx,%rsi
call   1040 <waitpid@plt>
test   %eax,%eax
jg     1160 <sigchld_handler+0x40>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@WNOHANG = global i32 0
@.str = [24 x i8] c"[process %d completed]\0A\00"
define void @sigchld_handler(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @WNOHANG
%5 = call i32 @waitpid(i32 -1, i32* %2, i32 %4)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %1, %7
%8 = phi i32 [ %11, %7 ], [ %5, %1 ]
%9 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i32, i32* @WNOHANG
%11 = call i32 @waitpid(i32 -1, i32* %2, i32 %10)
%12 = icmp sgt i32 %11, 0
br i1 %12, label %7, label %13
13: ; preds = %7, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("\nHello World\n\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 = [15 x i8] c"\0AHello World\0A\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [14 x i8] c"\0AHello World\0A\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
struct SN_env {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ SN_close_env(struct SN_env *, int);
extern void danish_UTF_8_close_env(struct SN_env *z) { SN_close_env(z, 1); }


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

x86 assembly (clang, -O2):
<danish_UTF_8_close_env>:
mov    $0x1,%esi
jmp    1030 <SN_close_env@plt>

LLVM IR (-O0):
%struct.SN_env = type { i32 }
define void @danish_UTF_8_close_env(%struct.SN_env* %0) {
%2 = alloca %struct.SN_env*
store %struct.SN_env* %0, %struct.SN_env** %2
%3 = load %struct.SN_env*, %struct.SN_env** %2
%4 = call i32 @SN_close_env(%struct.SN_env* %3, i32 1)
ret void
}

LLVM IR (-O2):
%struct.SN_env = type { i32 }
define void @danish_UTF_8_close_env(%struct.SN_env* %0) {
%2 = tail call i32 @SN_close_env(%struct.SN_env* %0, i32 1)
ret void
}
/* Variables and functions */
int char_to_int(char);
int sub_chars(char c1, char c2) { return char_to_int(c1) - char_to_int(c2); }


x86 assembly (clang, -O0):
<sub_chars>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <char_to_int@plt>
mov    %eax,-0x8(%rbp)
movsbl -0x2(%rbp),%edi
call   1030 <char_to_int@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub_chars>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
call   1030 <char_to_int@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <char_to_int@plt>
sub    %eax,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @sub_chars(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %3
%6 = call i32 @char_to_int(i8 signext %5)
%7 = load i8, i8* %4
%8 = call i32 @char_to_int(i8 signext %7)
%9 = sub nsw i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @sub_chars(i8 signext %0, i8 signext %1) {
%3 = tail call i32 @char_to_int(i8 signext %0)
%4 = tail call i32 @char_to_int(i8 signext %1)
%5 = sub nsw i32 %3, %4
ret i32 %5
}
/* Variables and functions */
int cuadrado(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int numero, resultado;
  numero = 5;
  resultado = cuadrado(numero);
  printf("El cuadrado del numero es %d", resultado);
  printf(" y el de 3 es %d\n", cuadrado(3));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <cuadrado@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xeb5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <cuadrado@plt>
mov    %eax,%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
call   1040 <cuadrado@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <cuadrado@plt>
lea    0xed3(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"El cuadrado del numero es %d\00"
@.str.1 = [18 x i8] c" y el de 3 es %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @cuadrado(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @cuadrado(i32 3)
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"El cuadrado del numero es %d\00"
@.str.1 = [18 x i8] c" y el de 3 es %d\0A\00"
define i32 @main() {
%1 = tail call i32 @cuadrado(i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 @cuadrado(i32 3)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}
int int_cmp(const void *a, const void *b) { return (*(int *)a - *(int *)b); }


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

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

LLVM IR (-O0):
define i32 @int_cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
%11 = sub nsw i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @int_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int dal_reg_tbl_write(unsigned int, unsigned int, unsigned int *, unsigned int);
int emac2_reg_tbl_set(unsigned int dev_id, unsigned int reg_addr,
                      unsigned int *pvalue, unsigned int width) {
  return dal_reg_tbl_write(dev_id, reg_addr + 0x108000, pvalue, width);
}


x86 assembly (clang, -O0):
<emac2_reg_tbl_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    $0x108000,%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
call   1030 <dal_reg_tbl_write@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emac2_reg_tbl_set>:
add    $0x108000,%esi
jmp    1030 <dal_reg_tbl_write@plt>

LLVM IR (-O0):
define i32 @emac2_reg_tbl_set(i32 %0, i32 %1, i32* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = add i32 %10, 1081344
%12 = load i32*, i32** %7
%13 = load i32, i32* %8
%14 = call i32 @dal_reg_tbl_write(i32 %9, i32 %11, i32* %12, i32 %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @emac2_reg_tbl_set(i32 %0, i32 %1, i32* %2, i32 %3) {
%5 = add i32 %1, 1081344
%6 = tail call i32 @dal_reg_tbl_write(i32 %0, i32 %5, i32* %2, i32 %3)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  int isEven(int number);
  if (isEven(17) == 1)
    printf("yes ");
  else
    printf("no ");
  if (isEven(20) == 1)
    printf("yes\n");
  else
    printf("no\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x11,%edi
call   1040 <isEven@plt>
cmp    $0x1,%eax
jne    1153 <main+0x33>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
jmp    115f <main+0x3f>
lea    0xeab(%rip),%rdi
call   1030 <printf@plt>
mov    $0x14,%edi
call   1040 <isEven@plt>
cmp    $0x1,%eax
jne    1183 <main+0x63>
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
jmp    118f <main+0x6f>
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x11,%edi
call   1050 <isEven@plt>
cmp    $0x1,%eax
lea    0xebb(%rip),%rax
lea    0xeb9(%rip),%rdi
cmove  %rax,%rdi
call   1040 <printf@plt>
mov    $0x14,%edi
call   1050 <isEven@plt>
cmp    $0x1,%eax
lea    0xea3(%rip),%rax
lea    0xe99(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"yes \00"
@.str.1 = [4 x i8] c"no \00"
@.str.2 = [5 x i8] c"yes\0A\00"
@.str.3 = [4 x i8] c"no\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @isEven(i32 17)
%3 = icmp eq i32 %2, 1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %8
6: ; preds = %0
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %4
%9 = call i32 @isEven(i32 20)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %15
13: ; preds = %8
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %13, %11
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"yes \00"
@.str.1 = [4 x i8] c"no \00"
@str = [3 x i8] c"no\00"
@str.4 = [4 x i8] c"yes\00"
define i32 @main() {
%1 = tail call i32 @isEven(i32 17)
%2 = icmp eq i32 %1, 1
%3 = select i1 %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
%4 = tail call i32 @printf(i8* dereferenceable(1) %3)
%5 = tail call i32 @isEven(i32 20)
%6 = icmp eq i32 %5, 1
%7 = select i1 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
ret i32 0
}
unsigned int StrLen(const char *s, unsigned int maxLen) {
  const char *strStart = s;
  while (maxLen > 0 && *s) {
    ++s;
    --maxLen;
  }
  return s - strStart;
}


x86 assembly (clang, -O0):
<StrLen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0x19(%rbp)
jbe    1132 <StrLen+0x32>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1142 <StrLen+0x42>
jmp    115c <StrLen+0x5c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1113 <StrLen+0x13>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<StrLen>:
mov    %rdi,%rax
test   %esi,%esi
je     1131 <StrLen+0x31>
lea    -0x1(%rsi),%eax
lea    (%rax,%rdi,1),%rcx
add    $0x1,%rcx
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nop
cmpb   $0x0,(%rax)
je     1131 <StrLen+0x31>
add    $0x1,%rax
add    $0xffffffff,%esi
jne    1120 <StrLen+0x20>
mov    %rcx,%rax
sub    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @StrLen(i8* %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %18, label %4
4: ; preds = %2
%5 = add i32 %1, -1
%6 = zext i32 %5 to i64
%7 = add nuw nsw i64 %6, 1
%8 = getelementptr i8, i8* %0, i64 %7
br label %9
9: ; preds = %4, %14
%10 = phi i8* [ %15, %14 ], [ %0, %4 ]
%11 = phi i32 [ %16, %14 ], [ %1, %4 ]
%12 = load i8, i8* %10
%13 = icmp eq i8 %12, 0
br i1 %13, label %18, label %14
14: ; preds = %9
%15 = getelementptr inbounds i8, i8* %10, i64 1
%16 = add i32 %11, -1
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %9
18: ; preds = %9, %14, %2
%19 = phi i8* [ %0, %2 ], [ %8, %14 ], [ %10, %9 ]
%20 = ptrtoint i8* %19 to i64
%21 = ptrtoint i8* %0 to i64
%22 = sub i64 %20, %21
%23 = trunc i64 %22 to i32
ret i32 %23
}
void INT_Excep_PERIB_INTB172(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIB_INTB172() {
ret void
}
unsigned hash(const char *s, int num_buckets) {
  unsigned hash_val;
  char *p;
  p = (char *)s;
  hash_val = 0;
  while (*p) {
    hash_val = hash_val * 33 + *p++;
  }
  return hash_val % num_buckets;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     1147 <hash+0x47>
imul   $0x21,-0x10(%rbp),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
jmp    111a <hash+0x1a>
mov    -0x10(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1129 <hash+0x29>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
mov    %eax,%edx
shl    $0x5,%edx
add    %eax,%edx
movsbl %cl,%eax
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
jmp    112b <hash+0x2b>
xor    %eax,%eax
xor    %edx,%edx
div    %esi
mov    %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0, i32 %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* [ %10, %5 ], [ %0, %2 ]
%8 = phi i32 [ %12, %5 ], [ 0, %2 ]
%9 = mul i32 %8, 33
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = sext i8 %6 to i32
%12 = add i32 %9, %11
%13 = load i8, i8* %10
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %5
15: ; preds = %5, %2
%16 = phi i32 [ 0, %2 ], [ %12, %5 ]
%17 = urem i32 %16, %1
ret i32 %17
}
void ularith_div_2ul_ul_ul_r(unsigned long *r, unsigned long a1,
                             const unsigned long a2, const unsigned long b) {
  __asm__("# ularith_div_2ul_ul_ul_r: divq %0 %1 %2 %3\n\t"
          "divq %3"
          : "+a"(a1), "=d"(*r)
          : "1"(a2), "rm"(b)
          : "cc");
}


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

x86 assembly (clang, -O2):
<ularith_div_2ul_ul_ul_r>:
mov    %rsi,%rax
mov    %rcx,-0x8(%rsp)
divq   -0x8(%rsp)
mov    %rdx,(%rdi)
ret

LLVM IR (-O0):
define void @ularith_div_2ul_ul_ul_r(i64* %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64*
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i64* %0, i64** %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i64, i64* %6
%10 = load i64*, i64** %5
%11 = load i64, i64* %7
%12 = load i64, i64* %8
%13 = call { i64, i64 } asm "# ularith_div_2ul_ul_ul_r: divq $0 $1 $2 $3\0A\09divq $3", "={ax},={dx},1,rm,0,~{cc},~{dirflag},~{fpsr},~{flags}"(i64 %11, i64 %12, i64 %9)
%14 = extractvalue { i64, i64 } %13, 0
%15 = extractvalue { i64, i64 } %13, 1
store i64 %14, i64* %6
store i64 %15, i64* %10
ret void
}

LLVM IR (-O2):
define void @ularith_div_2ul_ul_ul_r(i64* nocapture writeonly %0, i64 %1, i64 %2, i64 %3) {
%5 = tail call { i64, i64 } asm "# ularith_div_2ul_ul_ul_r: divq $0 $1 $2 $3\0A\09divq $3", "={ax},={dx},1,rm,0,~{cc},~{dirflag},~{fpsr},~{flags}"(i64 %2, i64 %3, i64 %1)
%6 = extractvalue { i64, i64 } %5, 1
store i64 %6, i64* %0
ret void
}
void serial_purge_tx() { return; }


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

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

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

LLVM IR (-O2):
define void @serial_purge_tx() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int);
long ADCSequenceOverflow(unsigned long ulBase, unsigned long ulSequenceNum) {
  DEBUG_ASSERT((ulBase == 0x40038000) || (ulBase == 0x40039000));
  DEBUG_ASSERT(ulSequenceNum < 4);
  return ((*((volatile unsigned long *)(ulBase + 0x00000010))) &
          (1 << ulSequenceNum));
}


x86 assembly (clang, -O0):
<ADCSequenceOverflow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%al
cmpq   $0x40038000,-0x8(%rbp)
40
mov    %al,-0x11(%rbp)
je     1141 <ADCSequenceOverflow+0x31>
cmpq   $0x40039000,-0x8(%rbp)
40
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
cmpq   $0x4,-0x10(%rbp)
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADCSequenceOverflow>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rdi,%rax
and    $0xffffffffffffefff,%rax
xor    %edi,%edi
cmp    $0x40038000,%rax
sete   %dil
call   1030 <DEBUG_ASSERT@plt>
xor    %edi,%edi
cmp    $0x4,%rbx
setb   %dil
call   1030 <DEBUG_ASSERT@plt>
mov    $0x1,%eax
mov    %ebx,%ecx
shl    %cl,%eax
cltq
and    0x10(%r14),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i64 @ADCSequenceOverflow(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = icmp eq i64 %5, 1073971200
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i64, i64* %3
%9 = icmp eq i64 %8, 1073975296
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ true, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @DEBUG_ASSERT(i32 %12)
%14 = load i64, i64* %4
%15 = icmp ult i64 %14, 4
%16 = zext i1 %15 to i32
%17 = call i32 @DEBUG_ASSERT(i32 %16)
%18 = load i64, i64* %3
%19 = add i64 %18, 16
%20 = inttoptr i64 %19 to i64*
%21 = load volatile i64, i64* %20
%22 = load i64, i64* %4
%23 = trunc i64 %22 to i32
%24 = shl i32 1, %23
%25 = sext i32 %24 to i64
%26 = and i64 %21, %25
ret i64 %26
}

LLVM IR (-O2):
define i64 @ADCSequenceOverflow(i64 %0, i64 %1) {
%3 = and i64 %0, -4097
%4 = icmp eq i64 %3, 1073971200
%5 = zext i1 %4 to i32
%6 = tail call i32 @DEBUG_ASSERT(i32 %5)
%7 = icmp ult i64 %1, 4
%8 = zext i1 %7 to i32
%9 = tail call i32 @DEBUG_ASSERT(i32 %8)
%10 = add i64 %0, 16
%11 = inttoptr i64 %10 to i64*
%12 = load volatile i64, i64* %11
%13 = trunc i64 %1 to i32
%14 = shl nuw i32 1, %13
%15 = sext i32 %14 to i64
%16 = and i64 %12, %15
ret i64 %16
}
/* Variables and functions */
double Uglue(double, double, double);
double dPhi_Uglue(double Phi, double T, double mu) { return Uglue(Phi, T, mu); }


x86 assembly (clang, -O0):
<dPhi_Uglue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1030 <Uglue@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dPhi_Uglue>:
jmp    1030 <Uglue@plt>

LLVM IR (-O0):
define double @dPhi_Uglue(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = load double, double* %6
%10 = call double @Uglue(double %7, double %8, double %9)
ret double %10
}

LLVM IR (-O2):
define double @dPhi_Uglue(double %0, double %1, double %2) {
%4 = tail call double @Uglue(double %0, double %1, double %2)
ret double %4
}
void do_something() {
  int i = 0;
  for (; i < 10000000; i++) {
  }
}


x86 assembly (clang, -O0):
<do_something>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
cmpl   $0x989680,-0x4(%rbp)
jge    112b <do_something+0x2b>
jmp    111d <do_something+0x1d>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <do_something+0xb>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @do_something() {
ret void
}
/* Variables and functions */
scalar_t__ strncasecmp(char *, char *, int);
void strncasecmp_constant_and_var_1() {
  char *x = "abc";
  if (strncasecmp("Abc", x, 3) != 0)
    (void)*(char *)0;
}


x86 assembly (clang, -O0):
<strncasecmp_constant_and_var_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xed6(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncasecmp@plt>
cmp    $0x0,%rax
je     1142 <strncasecmp_constant_and_var_1+0x32>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [4 x i8] c"abc\00"
@.str.1 = [4 x i8] c"Abc\00"
define void @strncasecmp_constant_and_var_1() {
%1 = alloca i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
%3 = call i64 @strncasecmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 3)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = load i8, i8* null
br label %7
7: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
define void @strncasecmp_constant_and_var_1() {
ret void
}
/* Variables and functions */
int prv_test_arm_regs_used_after();
int prv_test_arm_regs_used_before();
int arm_reg_alloc_test(void) {
  int retval;
  retval = prv_test_arm_regs_used_before();
  retval |= prv_test_arm_regs_used_after();
  return retval;
}


x86 assembly (clang, -O0):
<arm_reg_alloc_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <prv_test_arm_regs_used_before@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <prv_test_arm_regs_used_after@plt>
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arm_reg_alloc_test>:
push   %rbx
xor    %eax,%eax
call   1040 <prv_test_arm_regs_used_before@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <prv_test_arm_regs_used_after@plt>
or     %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @arm_reg_alloc_test() {
%1 = alloca i32
%2 = call i32 (...) @prv_test_arm_regs_used_before()
store i32 %2, i32* %1
%3 = call i32 (...) @prv_test_arm_regs_used_after()
%4 = load i32, i32* %1
%5 = or i32 %4, %3
store i32 %5, i32* %1
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
define i32 @arm_reg_alloc_test() {
%1 = tail call i32 (...) @prv_test_arm_regs_used_before()
%2 = tail call i32 (...) @prv_test_arm_regs_used_after()
%3 = or i32 %2, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  float C, K;
  printf("Kelvin: ");
  scanf("%f", &K);
  C = K - 273.15;
  printf("Kelvin para Celsius: %f\n", C);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea2(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe99(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xeae(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Kelvin: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [25 x i8] c"Kelvin para Celsius: %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%6 = load float, float* %3
%7 = fpext float %6 to double
%8 = fsub double %7, 2.731500e+02
%9 = fptrunc double %8 to float
store float %9, float* %2
%10 = load float, float* %2
%11 = fpext float %10 to double
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), double %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"Kelvin: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [25 x i8] c"Kelvin para Celsius: %f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = load float, float* %1
%6 = fpext float %5 to double
%7 = fadd double %6, -2.731500e+02
%8 = fptrunc double %7 to float
%9 = fpext float %8 to double
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), double %9)
ret i32 0
}