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

/* Variables and functions */
int /*<<< orphan*/ mpz_add_ui(int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ mpz_init(int /*<<< orphan*/);
int /*<<< orphan*/ mpz_init_set_ui(int /*<<< orphan*/, unsigned long);
int /*<<< orphan*/ mpz_out_str(int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  mpz_t z1, z2;
  mpz_init_set_ui(z1, ~((unsigned long int)0));
  mpz_init(z2);
  mpz_add_ui(z2, z1, 1);
  mpz_out_str(stdout, 10, z2);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x14(%rbp),%edi
mov    $0xffffffffffffffff,%rsi
call   1070 <mpz_init_set_ui@plt>
mov    -0x18(%rbp),%edi
call   1050 <mpz_init@plt>
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    $0x1,%edx
call   1030 <mpz_add_ui@plt>
mov    0x2e4c(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    $0xa,%esi
call   1060 <mpz_out_str@plt>
lea    0xe56(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xffffffffffffffff,%rsi
call   1070 <mpz_init_set_ui@plt>
call   1050 <mpz_init@plt>
mov    $0x1,%edx
call   1040 <mpz_add_ui@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
mov    $0xa,%esi
call   1060 <mpz_out_str@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %6
%9 = call i32 @mpz_init_set_ui(i32 %8, i64 -1)
%10 = load i32, i32* %7
%11 = call i32 @mpz_init(i32 %10)
%12 = load i32, i32* %7
%13 = load i32, i32* %6
%14 = call i32 @mpz_add_ui(i32 %12, i32 %13, i32 1)
%15 = load i32, i32* @stdout
%16 = load i32, i32* %7
%17 = call i32 @mpz_out_str(i32 %15, i32 10, i32 %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @mpz_init_set_ui(i32 undef, i64 -1)
%4 = tail call i32 @mpz_init(i32 undef)
%5 = tail call i32 @mpz_add_ui(i32 undef, i32 undef, i32 1)
%6 = load i32, i32* @stdout
%7 = tail call i32 @mpz_out_str(i32 %6, i32 10, i32 undef)
%8 = tail call i32 @putchar(i32 10)
ret i32 0
}
/* Type definitions */
struct openpgp_publickey {
  int dummy;
};
struct onak_dbctx {
  int dummy;
};

/* Variables and functions */
int keyring_store_key(struct onak_dbctx *dbctx,
                      struct openpgp_publickey *publickey, bool intrans,
                      bool update) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.onak_dbctx = type { i32 }
%struct.openpgp_publickey = type { i32 }
define i32 @keyring_store_key(%struct.onak_dbctx* %0, %struct.openpgp_publickey* %1, i32 %2, i32 %3) {
%5 = alloca %struct.onak_dbctx*
%6 = alloca %struct.openpgp_publickey*
%7 = alloca i32
%8 = alloca i32
store %struct.onak_dbctx* %0, %struct.onak_dbctx** %5
store %struct.openpgp_publickey* %1, %struct.openpgp_publickey** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
ret i32 0
}

LLVM IR (-O2):
%struct.onak_dbctx = type { i32 }
%struct.openpgp_publickey = type { i32 }
define i32 @keyring_store_key(%struct.onak_dbctx* nocapture readnone %0, %struct.openpgp_publickey* nocapture readnone %1, i32 %2, i32 %3) {
ret i32 0
}
/* Variables and functions */
char *strchr(char *, char);
void delete_newline(char *string) {
  char *seek = strchr(string, '\n');
  if (seek)
    *seek = (char)0;
}


x86 assembly (clang, -O0):
<delete_newline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1140 <delete_newline+0x30>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete_newline>:
push   %rax
mov    $0xa,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1123 <delete_newline+0x13>
movb   $0x0,(%rax)
pop    %rax
ret

LLVM IR (-O0):
define void @delete_newline(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strchr(i8* %4, i8 signext 10)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8*, i8** %3
store i8 0, i8* %9
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
define void @delete_newline(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 10)
%3 = icmp eq i8* %2, null
br i1 %3, label %5, label %4
4: ; preds = %1
store i8 0, i8* %2
br label %5
5: ; preds = %4, %1
ret void
}
void gdk_window_set_debug_updates() {}


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

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

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

LLVM IR (-O2):
define void @gdk_window_set_debug_updates() {
ret void
}
void pthread_mutexattr_init() {}


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

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

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

LLVM IR (-O2):
define void @pthread_mutexattr_init() {
ret void
}
int op_nop(void) { return (4); }


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

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

LLVM IR (-O0):
define i32 @op_nop() {
ret i32 4
}

LLVM IR (-O2):
define i32 @op_nop() {
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
char *strdup(char *);
void function(char *something) {
  char *x = strdup(something);
  char *y = malloc(4);
  free(y);
  y[3] = 'a';
}


x86 assembly (clang, -O0):
<function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,-0x10(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
movb   $0x61,0x3(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<function>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @function(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @strdup(i8* %5)
store i8* %6, i8** %3
%7 = call i8* @malloc(i32 4)
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = call i32 @free(i8* %8)
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 3
store i8 97, i8* %11
ret void
}

LLVM IR (-O2):
define void @function(i8* nocapture readnone %0) {
%2 = tail call dereferenceable_or_null(4) i8* @malloc(i32 4)
%3 = tail call i32 @free(i8* %2)
ret void
}
/* Variables and functions */
bool nrf53_errata_114(void) { return false; }


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

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

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

LLVM IR (-O2):
define i32 @nrf53_errata_114() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ bonjour();
int main(int argc, const char *argv[]) {
  bonjour();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <bonjour@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @bonjour()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int shared_hello(void) {
  printf("hello from a dynamic shared world\n");
  return 0;
}


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

x86 assembly (clang, -O2):
<shared_hello>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [34 x i8] c"hello from a dynamic shared world\00"
define i32 @shared_hello() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void do_clear() { printf("\033[0;0H\033[2J"); }


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

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

LLVM IR (-O0):
@.str = [11 x i8] c"\1B[0;0H\1B[2J\00"
define void @do_clear() {
%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"\1B[0;0H\1B[2J\00"
define void @do_clear() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
float gf_sqr(const float x) { return x * x; }


x86 assembly (clang, -O0):
<gf_sqr>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<gf_sqr>:
mulss  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @gf_sqr(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* %2
%5 = fmul float %3, %4
ret float %5
}

LLVM IR (-O2):
define float @gf_sqr(float %0) {
%2 = fmul float %0, %0
ret float %2
}
/* Variables and functions */
int /*<<< orphan*/ lprcat(char *);
void cnsitm(void) { lprcat("\nSorry, we can't accept unidentified objects."); }


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

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

LLVM IR (-O0):
@.str = [46 x i8] c"\0ASorry, we can't accept unidentified objects.\00"
define void @cnsitm() {
%1 = call i32 @lprcat(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [46 x i8] c"\0ASorry, we can't accept unidentified objects.\00"
define void @cnsitm() {
%1 = tail call i32 @lprcat(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct soldier {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
struct soldier *form_platoon(int);
int /*<<< orphan*/ free(struct soldier *);
struct soldier *kill_platoon(struct soldier *, int);
int main(void) {
  struct soldier *last = form_platoon(41);
  last = kill_platoon(last, 3);
  free(last);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x29,%edi
call   1040 <form_platoon@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3,%esi
call   1050 <kill_platoon@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    0x2e61(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x29,%edi
call   1040 <form_platoon@plt>
mov    %rax,%rdi
mov    $0x3,%esi
call   1050 <kill_platoon@plt>
mov    %rax,%rdi
call   1030 <free@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
%struct.soldier = type { i32 }
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.soldier*
store i32 0, i32* %1
%3 = call %struct.soldier* @form_platoon(i32 41)
store %struct.soldier* %3, %struct.soldier** %2
%4 = load %struct.soldier*, %struct.soldier** %2
%5 = call %struct.soldier* @kill_platoon(%struct.soldier* %4, i32 3)
store %struct.soldier* %5, %struct.soldier** %2
%6 = load %struct.soldier*, %struct.soldier** %2
%7 = call i32 @free(%struct.soldier* %6)
%8 = load i32, i32* @EXIT_SUCCESS
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
%struct.soldier = type { i32 }
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call %struct.soldier* @form_platoon(i32 41)
%2 = tail call %struct.soldier* @kill_platoon(%struct.soldier* %1, i32 3)
%3 = tail call i32 @free(%struct.soldier* %2)
%4 = load i32, i32* @EXIT_SUCCESS
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void ip_set_frag_offset(uint8_t *p_ip, uint16_t offset) {
  p_ip[6] &= ~0x1f;
  p_ip[6] |= (offset & 0x1f00) >> 8;
  p_ip[7] = (offset & 0xff);
}


x86 assembly (clang, -O0):
<ip_set_frag_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%ecx
and    $0xffffffe0,%ecx
mov    %ecx,0x18(%rax)
mov    -0xc(%rbp),%ecx
and    $0x1f00,%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
or     0x18(%rax),%ecx
mov    %ecx,0x18(%rax)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x1c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ip_set_frag_offset>:
mov    0x18(%rdi),%eax
and    $0xffffffe0,%eax
movzbl %sil,%ecx
shr    $0x8,%esi
and    $0x1f,%esi
or     %eax,%esi
mov    %esi,0x18(%rdi)
mov    %ecx,0x1c(%rdi)
ret

LLVM IR (-O0):
define void @ip_set_frag_offset(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 = getelementptr inbounds i32, i32* %5, i64 6
%7 = load i32, i32* %6
%8 = and i32 %7, -32
store i32 %8, i32* %6
%9 = load i32, i32* %4
%10 = and i32 %9, 7936
%11 = ashr i32 %10, 8
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 6
%14 = load i32, i32* %13
%15 = or i32 %14, %11
store i32 %15, i32* %13
%16 = load i32, i32* %4
%17 = and i32 %16, 255
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i64 7
store i32 %17, i32* %19
ret void
}

LLVM IR (-O2):
define void @ip_set_frag_offset(i32* nocapture %0, i32 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 6
%4 = load i32, i32* %3
%5 = and i32 %4, -32
%6 = lshr i32 %1, 8
%7 = and i32 %6, 31
%8 = or i32 %5, %7
store i32 %8, i32* %3
%9 = and i32 %1, 255
%10 = getelementptr inbounds i32, i32* %0, i64 7
store i32 %9, i32* %10
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ KeySym;

/* Variables and functions */
int IsKeypadKey(int /*<<< orphan*/);
int x11_extras_IsKeypadKey(KeySym keysym) { return IsKeypadKey(keysym); }


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

x86 assembly (clang, -O2):
<x11_extras_IsKeypadKey>:
jmp    1030 <IsKeypadKey@plt>

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

LLVM IR (-O2):
define i32 @x11_extras_IsKeypadKey(i32 %0) {
%2 = tail call i32 @IsKeypadKey(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ foo(double);
void bar(double x) { foo(x); }


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

x86 assembly (clang, -O2):
<bar>:
jmp    1030 <foo@plt>

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

LLVM IR (-O2):
define void @bar(double %0) {
%2 = tail call i32 @foo(double %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void LibraryCall(void) { printf("Library function called\n"); }


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

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

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

LLVM IR (-O2):
@str = [24 x i8] c"Library function called\00"
define void @LibraryCall() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ SSL_CTX;

/* Variables and functions */
int /*<<< orphan*/ SSL_CTX_free(int /*<<< orphan*/ *);
void ssl_destroy_ctx(SSL_CTX *ctx) { SSL_CTX_free(ctx); }


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

x86 assembly (clang, -O2):
<ssl_destroy_ctx>:
jmp    1030 <SSL_CTX_free@plt>

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

LLVM IR (-O2):
define void @ssl_destroy_ctx(i32* %0) {
%2 = tail call i32 @SSL_CTX_free(i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MSG_NOSIGNAL;
int send(int, char *, int, int /*<<< orphan*/);
int send_nonse(int fd, char *buf, int n) {
  return send(fd, buf, n, MSG_NOSIGNAL);
}


x86 assembly (clang, -O0):
<send_nonse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    0x2ead(%rip),%rax
mov    (%rax),%ecx
call   1030 <send@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_nonse>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%ecx
jmp    1030 <send@plt>

LLVM IR (-O0):
@MSG_NOSIGNAL = global i32 0
define i32 @send_nonse(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = load i32, i32* @MSG_NOSIGNAL
%11 = call i32 @send(i32 %7, i8* %8, i32 %9, i32 %10)
ret i32 %11
}

LLVM IR (-O2):
@MSG_NOSIGNAL = global i32 0
define i32 @send_nonse(i32 %0, i8* %1, i32 %2) {
%4 = load i32, i32* @MSG_NOSIGNAL
%5 = tail call i32 @send(i32 %0, i8* %1, i32 %2, i32 %4)
ret i32 %5
}
/* Variables and functions */
char *strchr(char *, char);
char *strdup(char *);
char *underscore(char *s) {
  char *copy = strdup(s);
  char *space = copy;
  while ((space = strchr(space, ' ')))
    *space++ = '_';
  return copy;
}


x86 assembly (clang, -O0):
<underscore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1174 <underscore+0x54>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x5f,(%rax)
jmp    1141 <underscore+0x21>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<underscore>:
push   %rbx
call   1040 <strdup@plt>
mov    %rax,%rbx
nopl   0x0(%rax)
mov    %rax,%rdi
mov    $0x20,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     114b <underscore+0x2b>
movb   $0x5f,(%rax)
add    $0x1,%rax
jmp    1130 <underscore+0x10>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @underscore(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @strdup(i8* %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
store i8* %7, i8** %4
br label %8
8: ; preds = %12, %1
%9 = load i8*, i8** %4
%10 = call i8* @strchr(i8* %9, i8 signext 32)
store i8* %10, i8** %4
%11 = icmp ne i8* %10, null
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %4
store i8 95, i8* %13
br label %8
15: ; preds = %8
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
define i8* @underscore(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = tail call i8* @strchr(i8* dereferenceable(1) %2, i8 signext 32)
%4 = icmp eq i8* %3, null
br i1 %4, label %10, label %5
5: ; preds = %1, %5
%6 = phi i8* [ %8, %5 ], [ %3, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
store i8 95, i8* %6
%8 = tail call i8* @strchr(i8* dereferenceable(1) %7, i8 signext 32)
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %5
10: ; preds = %5, %1
ret i8* %2
}
void *memset_impl(void *dstpp, int c, unsigned len) {
  long long int dstp = (long long int)dstpp;
  while (dstp % 4 != 0) {
    ((unsigned char *)dstp)[0] = c;
    dstp += 1;
    len -= 1;
  }
  return dstpp;
}


x86 assembly (clang, -O0):
<memset_impl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    $0x4,%ecx
cqto
idiv   %rcx
cmp    $0x0,%rdx
je     1153 <memset_impl+0x53>
mov    -0xc(%rbp),%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1116 <memset_impl+0x16>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memset_impl>:
mov    %rdi,%rax
test   $0x3,%al
je     112e <memset_impl+0x2e>
mov    %sil,(%rax)
lea    0x1(%rax),%ecx
test   $0x3,%cl
je     112e <memset_impl+0x2e>
mov    %sil,0x1(%rax)
lea    0x2(%rax),%ecx
test   $0x3,%cl
je     112e <memset_impl+0x2e>
mov    %sil,0x2(%rax)
lea    0x3(%rax),%rcx
test   $0x3,%cl
je     112e <memset_impl+0x2e>
mov    %sil,(%rcx)
ret

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

LLVM IR (-O2):
define i8* @memset_impl(i8* returned %0, i32 %1, i32 %2) {
%4 = ptrtoint i8* %0 to i64
%5 = and i64 %4, 3
%6 = icmp eq i64 %5, 0
br i1 %6, label %24, label %7
7: ; preds = %3
%8 = trunc i32 %1 to i8
store i8 %8, i8* %0
%9 = add nsw i64 %4, 1
%10 = and i64 %9, 3
%11 = icmp eq i64 %10, 0
br i1 %11, label %24, label %12
12: ; preds = %7
%13 = inttoptr i64 %9 to i8*
store i8 %8, i8* %13
%14 = add nsw i64 %4, 2
%15 = and i64 %14, 3
%16 = icmp eq i64 %15, 0
br i1 %16, label %24, label %17
17: ; preds = %12
%18 = inttoptr i64 %14 to i8*
store i8 %8, i8* %18
%19 = add nsw i64 %4, 3
%20 = and i64 %19, 3
%21 = icmp eq i64 %20, 0
br i1 %21, label %24, label %22
22: ; preds = %17
%23 = inttoptr i64 %19 to i8*
store i8 %8, i8* %23
br label %24
24: ; preds = %7, %12, %17, %22, %3
ret i8* %0
}
char CAS2(volatile void *addr, volatile void *v1, volatile long v2, void *n1,
          long n2) {
  register char ret;
  __asm__ __volatile__("# CAS2 \n\t"
                       ""
                       "cmpxchg8b (%1) \n\t"
                       "sete %0               \n\t"
                       : "=a"(ret)
                       : "D"(addr), "d"(v2), "a"(v1), "b"(n1), "c"(n2));
  return ret;
}


x86 assembly (clang, -O0):
<CAS2>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rbx
mov    -0x30(%rbp),%rcx
cmpxchg8b (%rdi)
sete   %al
mov    %al,-0x31(%rbp)
movsbl -0x31(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<CAS2>:
push   %rbx
mov    %rcx,%rbx
mov    %rsi,%rax
mov    %rdx,-0x8(%rsp)
mov    -0x8(%rsp),%rdx
mov    %r8,%rcx
cmpxchg8b (%rdi)
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @CAS2(i8* %0, i8* %1, i64 %2, i8* %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8
store i8* %0, i8** %6
store i8* %1, i8** %7
store volatile i64 %2, i64* %8
store i8* %3, i8** %9
store i64 %4, i64* %10
%12 = load i8*, i8** %6
%13 = load volatile i64, i64* %8
%14 = load i8*, i8** %7
%15 = load i8*, i8** %9
%16 = load i64, i64* %10
%17 = call i8 asm sideeffect "# CAS2 \0A\09cmpxchg8b ($1) \0A\09sete $0 \0A\09", "={ax},{di},{dx},{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i8* %12, i64 %13, i8* %14, i8* %15, i64 %16)
store i8 %17, i8* %11
%18 = load i8, i8* %11
ret i8 %18
}

LLVM IR (-O2):
define signext i8 @CAS2(i8* %0, i8* %1, i64 %2, i8* %3, i64 %4) {
%6 = alloca i64
store volatile i64 %2, i64* %6
%7 = load volatile i64, i64* %6
%8 = tail call i8 asm sideeffect "# CAS2 \0A\09cmpxchg8b ($1) \0A\09sete $0 \0A\09", "={ax},{di},{dx},{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i8* %0, i64 %7, i8* %1, i8* %3, i64 %4)
ret i8 %8
}
double log2(double x) { return 4; }


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

x86 assembly (clang, -O2):
<log2>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @log2(double %0) {
%2 = alloca double
store double %0, double* %2
ret double 4.000000e+00
}

LLVM IR (-O2):
define double @log2(double %0) {
ret double 4.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void puterror(char *s) { fputs(s, stderr); }


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

x86 assembly (clang, -O2):
<puterror>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <fputs@plt>

LLVM IR (-O0):
@stderr = global i32 0
define void @puterror(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stderr
%5 = call i32 @fputs(i8* %3, i32 %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
define void @puterror(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fputs(i8* %0, i32 %2)
ret void
}
/* Variables and functions */
int f46(int *);
int f47(int *p) { return f46(p); }


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

x86 assembly (clang, -O2):
<f47>:
jmp    1030 <f46@plt>

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

LLVM IR (-O2):
define i32 @f47(i32* %0) {
%2 = tail call i32 @f46(i32* %0)
ret i32 %2
}
int test_imm_8Cuint8_reg(unsigned char val) {
  return ((val) & (0x8C << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_8Cuint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0x8c,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_8Cuint8_reg>:
test   $0x8c,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_8Cuint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -116
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void TIMER_RB_intr(void) {}


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

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

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

LLVM IR (-O2):
define void @TIMER_RB_intr() {
ret void
}
int fsm_reject(int in, void *context) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @fsm_reject(i32 %0, i8* nocapture readnone %1) {
ret i32 1
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
bool str_eql(char *str, char *other_str) { return strcmp(str, other_str) == 0; }


x86 assembly (clang, -O0):
<str_eql>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_eql>:
push   %rax
call   1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @str_eql(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i64 @strcmp(i8* %5, i8* %6)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @str_eql(i8* %0, i8* %1) {
%3 = tail call i64 @strcmp(i8* %0, i8* %1)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
void *malloc(size_t);
void *localMalloc(size_t size) {
  void *memory;
  if ((memory = malloc(size)))
    return memory;
  else {
    error("Out of memory!\n");
    return (void *)0;
  }
}


x86 assembly (clang, -O0):
<localMalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1150 <localMalloc+0x30>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1164 <localMalloc+0x44>
lea    0xea9(%rip),%rdi
call   1040 <error@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<localMalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <localMalloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <error@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Out of memory!\0A\00"
define i8* @localMalloc(i64 %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
%5 = load i64, i64* %3
%6 = call i8* @malloc(i64 %5)
store i8* %6, i8** %4
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i8*, i8** %4
store i8* %9, i8** %2
br label %12
10: ; preds = %1
%11 = call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i8* null, i8** %2
br label %12
12: ; preds = %10, %8
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@.str = [16 x i8] c"Out of memory!\0A\00"
define noalias i8* @localMalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @error(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %1, %4
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int _usage(void) {
  fputs("Usage: "
        "chown"
        " [-hR] owner[:group] file ...\n       "
        "chown"
        " -R [-H | -L | -P] owner[:group] file ...\n  -h	Set the user "
        "and group IDs on symbolic links\n  -R	Recursively change file user "
        "and group IDs\n",
        stderr);
  return 1;
}


x86 assembly (clang, -O0):
<_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_usage>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
lea    0xedf(%rip),%rdi
call   1030 <fputs@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [195 x i8] c"Usage: chown [-hR] owner[:group] file ...\0A chown -R [-H | -L | -P] owner[:group] file ...\0A -h\09Set the user and group IDs on symbolic links\0A -R\09Recursively change file user and group IDs\0A\00"
@stderr = global i32 0
define i32 @_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([195 x i8], [195 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}

LLVM IR (-O2):
@.str = [195 x i8] c"Usage: chown [-hR] owner[:group] file ...\0A chown -R [-H | -L | -P] owner[:group] file ...\0A -h\09Set the user and group IDs on symbolic links\0A -R\09Recursively change file user and group IDs\0A\00"
@stderr = global i32 0
define i32 @_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([195 x i8], [195 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 1
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strdup(char *src) {
  char *ret;
  int len = strlen(src);
  ret = (char *)malloc(len + 1);
  strcpy(ret, src);
  ret[len] = 0;
  return ret;
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %eax,%r15d
lea    0x1(%r15),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = add nsw i32 %7, 1
%9 = call i64 @malloc(i32 %8)
%10 = inttoptr i64 %9 to i8*
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = load i8*, i8** %2
%13 = call i32 @strcpy(i8* %11, i8* %12)
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 0, i8* %17
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i32 @strcpy(i8* %5, i8* %0)
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i8, i8* %5, i64 %7
store i8 0, i8* %8
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void puts(char *c) {
  while (*c != '\0') {
    putchar(*c);
    c++;
  }
}


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1149 <puts+0x39>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <puts+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <puts+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <puts+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call i32 @putchar(i8 signext %5)
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ft_putint_fd(int, int);
void ft_putint(int n) { ft_putint_fd(1, n); }


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

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

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

LLVM IR (-O2):
define void @ft_putint(i32 %0) {
%2 = tail call i32 @ft_putint_fd(i32 1, i32 %0)
ret void
}
/* Variables and functions */
int getmaxy(int /*<<< orphan*/);
int /*<<< orphan*/ stdscr;
int nmstermio_get_rows(void) { return getmaxy(stdscr); }


x86 assembly (clang, -O0):
<nmstermio_get_rows>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
call   1030 <getmaxy@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<nmstermio_get_rows>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <getmaxy@plt>

LLVM IR (-O0):
@stdscr = global i32 0
define i32 @nmstermio_get_rows() {
%1 = load i32, i32* @stdscr
%2 = call i32 @getmaxy(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@stdscr = global i32 0
define i32 @nmstermio_get_rows() {
%1 = load i32, i32* @stdscr
%2 = tail call i32 @getmaxy(i32 %1)
ret i32 %2
}
int schedee_priority_inherit(struct schedee *s, int priority) { return 0; }


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

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

LLVM IR (-O0):
%struct.schedee = type opaque
define i32 @schedee_priority_inherit(%struct.schedee* %0, i32 %1) {
%3 = alloca %struct.schedee*
%4 = alloca i32
store %struct.schedee* %0, %struct.schedee** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
%struct.schedee = type opaque
define i32 @schedee_priority_inherit(%struct.schedee* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
long get_num(char *, char *);
long hexwide(long);
char *int2hex(char *, long, long);
char *macint2hex(char *arg) {
  long int w = get_num("int2hex", arg);
  long int i = get_num("int2hex", arg);
  if (w < 1)
    w = hexwide(i);
  return int2hex(arg, i, w);
}


x86 assembly (clang, -O0):
<macint2hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1030 <get_num@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xea5(%rip),%rdi
call   1030 <get_num@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x1,-0x10(%rbp)
jge    117c <macint2hex+0x4c>
mov    -0x18(%rbp),%rdi
call   1050 <hexwide@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <int2hex@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<macint2hex>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
lea    0xec1(%rip),%r15
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <get_num@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <get_num@plt>
mov    %rax,%r15
test   %rbx,%rbx
jg     116b <macint2hex+0x3b>
mov    %r15,%rdi
call   1050 <hexwide@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <int2hex@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"int2hex\00"
define i8* @macint2hex(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @get_num(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %5)
store i64 %6, i64* %3
%7 = load i8*, i8** %2
%8 = call i64 @get_num(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %7)
store i64 %8, i64* %4
%9 = load i64, i64* %3
%10 = icmp slt i64 %9, 1
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i64, i64* %4
%13 = call i64 @hexwide(i64 %12)
store i64 %13, i64* %3
br label %14
14: ; preds = %11, %1
%15 = load i8*, i8** %2
%16 = load i64, i64* %4
%17 = load i64, i64* %3
%18 = call i8* @int2hex(i8* %15, i64 %16, i64 %17)
ret i8* %18
}

LLVM IR (-O2):
@.str = [8 x i8] c"int2hex\00"
define i8* @macint2hex(i8* %0) {
%2 = tail call i64 @get_num(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i64 @get_num(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = icmp slt i64 %2, 1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i64 @hexwide(i64 %3)
br label %7
7: ; preds = %5, %1
%8 = phi i64 [ %6, %5 ], [ %2, %1 ]
%9 = tail call i8* @int2hex(i8* %0, i64 %3, i64 %8)
ret i8* %9
}
void foo760(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo760(i32 %0) {
ret void
}
int vde_chain_nm3_alloc(void **mem, const int *idata, const double *rdata) {
  if (mem)
    *mem = 0;
  (void)idata;
  (void)rdata;
  return 0;
}


x86 assembly (clang, -O0):
<vde_chain_nm3_alloc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1126 <vde_chain_nm3_alloc+0x26>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<vde_chain_nm3_alloc>:
test   %rdi,%rdi
je     110c <vde_chain_nm3_alloc+0xc>
movq   $0x0,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @vde_chain_nm3_alloc(i8** %0, i32* %1, double* %2) {
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca double*
store i8** %0, i8*** %4
store i32* %1, i32** %5
store double* %2, double** %6
%7 = load i8**, i8*** %4
%8 = icmp ne i8** %7, null
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = load i8**, i8*** %4
store i8* null, i8** %10
br label %11
11: ; preds = %9, %3
%12 = load i32*, i32** %5
%13 = load double*, double** %6
ret i32 0
}

LLVM IR (-O2):
define i32 @vde_chain_nm3_alloc(i8** writeonly %0, i32* nocapture readnone %1, double* nocapture readnone %2) {
%4 = icmp eq i8** %0, null
br i1 %4, label %6, label %5
5: ; preds = %3
store i8* null, i8** %0
br label %6
6: ; preds = %5, %3
ret i32 0
}
void my_strcpy2(char *dst, char *src) {
  while (*src != 0) {
    *dst = *src;
    dst++;
    src++;
  }
  *dst = 0;
}


x86 assembly (clang, -O0):
<my_strcpy2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1145 <my_strcpy2+0x45>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <my_strcpy2+0xc>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strcpy2>:
mov    (%rsi),%al
test   %al,%al
je     1121 <my_strcpy2+0x21>
add    $0x1,%rsi
nopw   0x0(%rax,%rax,1)
mov    %al,(%rdi)
add    $0x1,%rdi
movzbl (%rsi),%eax
add    $0x1,%rsi
test   %al,%al
jne    1110 <my_strcpy2+0x10>
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @my_strcpy2(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %10, %5 ], [ %1, %2 ]
%8 = phi i8* [ %9, %5 ], [ %0, %2 ]
store i8 %6, i8* %8
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %9, %5 ]
store i8 0, i8* %14
ret void
}
int foo(int a, int b, int c) { return c - (a > b ? a : b); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    112a <foo+0x2a>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1130 <foo+0x30>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x14(%rbp),%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %edx,%eax
cmp    %esi,%edi
cmovg  %edi,%esi
sub    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, %1
%5 = select i1 %4, i32 %0, i32 %1
%6 = sub nsw i32 %2, %5
ret i32 %6
}