xunge/DecIR huggingface dataset:
void f(const char *c, int *i) {
  *i = 42;
  __builtin_memcpy(i + 1, c, sizeof(int));
  if (*i != 42)
    __builtin_abort();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x2a,(%rax)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
mov    (%rcx),%ecx
mov    %ecx,0x4(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0x2a,(%rax)
je     1149 <f+0x39>
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
movl   $0x2a,(%rsi)
mov    (%rdi),%eax
mov    %eax,0x4(%rsi)
ret

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

LLVM IR (-O2):
define void @f(i8* nocapture %0, i32* nocapture writeonly %1) {
store i32 42, i32* %1
%3 = getelementptr inbounds i32, i32* %1, i64 1
%4 = bitcast i8* %0 to i32*
%5 = load i32, i32* %4
store i32 %5, i32* %3
ret void
}
/* Variables and functions */
char *keynote_get_private_key(char *);
char *kn_get_string(char *buf) { return keynote_get_private_key(buf); }


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

x86 assembly (clang, -O2):
<kn_get_string>:
jmp    1030 <keynote_get_private_key@plt>

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

LLVM IR (-O2):
define i8* @kn_get_string(i8* %0) {
%2 = tail call i8* @keynote_get_private_key(i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ pm_error(char *);
void CombineServer(int const numFrames, const char *const masterHostName,
                   int const masterPortNum, const char *const outputFileName) {
  pm_error("This version of Ppmtompeg cannot run combine server because "
           "it does not have socket capability.");
}


x86 assembly (clang, -O0):
<CombineServer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xed3(%rip),%rdi
call   1030 <pm_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [96 x i8] c"This version of Ppmtompeg cannot run combine server because it does not have socket capability.\00"
define void @CombineServer(i32 %0, i8* %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%9 = call i32 @pm_error(i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [96 x i8] c"This version of Ppmtompeg cannot run combine server because it does not have socket capability.\00"
define void @CombineServer(i32 %0, i8* nocapture readnone %1, i32 %2, i8* nocapture readnone %3) {
%5 = tail call i32 @pm_error(i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str, i64 0, i64 0))
ret void
}
int main() { return !0; }


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 1
}
int do_832() { return 832; }


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

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

LLVM IR (-O0):
define i32 @do_832() {
ret i32 832
}

LLVM IR (-O2):
define i32 @do_832() {
ret i32 832
}
/* Type definitions */
struct stream {
  int dummy;
};

/* Variables and functions */
int decode_atom_format_5_1(unsigned char const *, struct stream *);
int decode_atom_format_5_3(const unsigned char *pkt, struct stream *stream) {
  return decode_atom_format_5_1(pkt, stream);
}


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

x86 assembly (clang, -O2):
<decode_atom_format_5_3>:
jmp    1030 <decode_atom_format_5_1@plt>

LLVM IR (-O0):
%struct.stream = type { i32 }
define i32 @decode_atom_format_5_3(i8* %0, %struct.stream* %1) {
%3 = alloca i8*
%4 = alloca %struct.stream*
store i8* %0, i8** %3
store %struct.stream* %1, %struct.stream** %4
%5 = load i8*, i8** %3
%6 = load %struct.stream*, %struct.stream** %4
%7 = call i32 @decode_atom_format_5_1(i8* %5, %struct.stream* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.stream = type { i32 }
define i32 @decode_atom_format_5_3(i8* %0, %struct.stream* %1) {
%3 = tail call i32 @decode_atom_format_5_1(i8* %0, %struct.stream* %1)
ret i32 %3
}
int int_cmp(void *i1, void *i2) {
  int j1 = *(int *)i1;
  int j2 = *(int *)i2;
  if (j1 > j2)
    return 1;
  else if (j1 < j2)
    return -1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<int_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1136 <int_cmp+0x36>
movl   $0x1,-0x4(%rbp)
jmp    1155 <int_cmp+0x55>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    114e <int_cmp+0x4e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1155 <int_cmp+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_cmp>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setl   %dl
neg    %edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovle %edx,%eax
ret

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

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 = icmp sgt i32 %4, %6
%8 = icmp slt i32 %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ ss2ucf();
void ss2ucf_(void) { ss2ucf(); }


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

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

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

LLVM IR (-O2):
define void @ss2ucf_() {
%1 = tail call i32 (...) @ss2ucf()
ret void
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ write(int, void *, scalar_t__);
void write_to_file(int fd, void *data, uint32_t size, uint32_t *off) {
  write(fd, data, size);
  *off += size;
}


x86 assembly (clang, -O0):
<write_to_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <write@plt>
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_to_file>:
push   %r14
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%rbx
call   1030 <write@plt>
add    %rbx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @write_to_file(i32 %0, i8* nocapture %1, i64 %2, i64* nocapture %3) {
%5 = tail call i32 @write(i32 %0, i8* %1, i64 %2)
%6 = load i64, i64* %3
%7 = add nsw i64 %6, %2
store i64 %7, i64* %3
ret void
}
void previsit(int V) {}


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

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

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

LLVM IR (-O2):
define void @previsit(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int net_create_socket() {
  int fd = socket(AF_INET, SOCK_STREAM, 0);
  if (fd < 0)
    return -1;
  return fd;
}


x86 assembly (clang, -O0):
<net_create_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <socket@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    114a <net_create_socket+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1150 <net_create_socket+0x40>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<net_create_socket>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
mov    0x2eb7(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <socket@plt>
test   %eax,%eax
mov    $0xffffffff,%ecx
cmovs  %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
define i32 @net_create_socket() {
%1 = alloca i32
%2 = alloca i32
%3 = load i32, i32* @AF_INET
%4 = load i32, i32* @SOCK_STREAM
%5 = call i32 @socket(i32 %3, i32 %4, i32 0)
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 -1, i32* %1
br label %11
9: ; preds = %0
%10 = load i32, i32* %2
store i32 %10, i32* %1
br label %11
11: ; preds = %9, %8
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
define i32 @net_create_socket() {
%1 = load i32, i32* @AF_INET
%2 = load i32, i32* @SOCK_STREAM
%3 = tail call i32 @socket(i32 %1, i32 %2, i32 0)
%4 = icmp sgt i32 %3, -1
%5 = select i1 %4, i32 %3, i32 -1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main() {
  {
    printf("Success\n");
    exit(0);
  };
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@str = [8 x i8] c"Success\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int prodotto_quaterna(int quaterna[]) {
  int prodotto = 0;
  size_t indice_quaterna;
  indice_quaterna = 0;
  while (indice_quaterna < 4) {
    prodotto += quaterna[indice_quaterna];
    indice_quaterna++;
  }
  return (prodotto);
}


x86 assembly (clang, -O0):
<prodotto_quaterna>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x4,-0x18(%rbp)
jae    1144 <prodotto_quaterna+0x44>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <prodotto_quaterna+0x17>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<prodotto_quaterna>:
movdqu (%rdi),%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%eax
ret

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

LLVM IR (-O2):
define i32 @prodotto_quaterna(i32* nocapture %0) {
%2 = bitcast i32* %0 to <4 x i32>*
%3 = load <4 x i32>, <4 x i32>* %2
%4 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ strncmp(char *, char *, size_t);
void uninivar_strncmp(void) {
  char *ct;
  char *s;
  size_t n;
  (void)strncmp(ct, s, n);
}


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

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

LLVM IR (-O0):
define void @uninivar_strncmp() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i64
%4 = load i8*, i8** %1
%5 = load i8*, i8** %2
%6 = load i64, i64* %3
%7 = call i32 @strncmp(i8* %4, i8* %5, i64 %6)
ret void
}

LLVM IR (-O2):
define void @uninivar_strncmp() {
ret void
}
int bar(int x) { return x + 32; }


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

x86 assembly (clang, -O2):
<bar>:
lea    0x20(%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @bar(i32 %0) {
%2 = add nsw i32 %0, 32
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int bof(FILE *badfile) {
  char buffer[12];
  fread(buffer, sizeof(char), 40, badfile);
  return 1;
}


x86 assembly (clang, -O0):
<bof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x14(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x1,%esi
mov    $0x28,%edx
call   1030 <fread@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bof>:
sub    $0x18,%rsp
mov    %rdi,%rcx
lea    0xc(%rsp),%rdi
mov    $0x1,%esi
mov    $0x28,%edx
call   1030 <fread@plt>
mov    $0x1,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @bof(i32* %0) {
%2 = alloca i32*
%3 = alloca [12 x i8]
store i32* %0, i32** %2
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %3, i64 0, i64 0
%5 = load i32*, i32** %2
%6 = call i32 @fread(i8* %4, i32 1, i32 40, i32* %5)
ret i32 1
}

LLVM IR (-O2):
define i32 @bof(i32* nocapture %0) {
%2 = alloca [12 x i8]
%3 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%4 = call i32 @fread(i8* %3, i32 1, i32 40, i32* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ f();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int i = 2;
  f();
  printf("%d", i);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 (...) @f()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 2)
ret i32 0
}
/* Variables and functions */
char *strchr(char const *, char const);
int main(void) {
  const int x = 0;
  const int *p = &x;
  const char q[] = "hello";
  char *r = strchr(q, q[0]);
  r[0];
  return x;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xec6(%rip),%ax
mov    %ax,-0x12(%rbp)
lea    -0x16(%rbp),%rdi
movsbl -0x16(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.q = [6 x i8] c"hello\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [6 x i8]
%5 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %2
store i32* %2, i32** %3
%6 = bitcast [6 x i8]* %4 to i8*
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%9 = load i8, i8* %8
%10 = call i8* @strchr(i8* %7, i8 signext %9)
store i8* %10, i8** %5
%11 = load i8*, i8** %5
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void target_mode_reset(void) {}


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

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

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

LLVM IR (-O2):
define void @target_mode_reset() {
ret void
}
/* Variables and functions */
scalar_t__ toupper(char);
char *pl_strtoupper(char *s) {
  for (size_t i = 0; s[i] != '\0'; ++i) {
    s[i] = (char)toupper(s[i]);
  }
  return s;
}


x86 assembly (clang, -O0):
<pl_strtoupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1168 <pl_strtoupper+0x58>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <pl_strtoupper+0x14>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pl_strtoupper>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
test   %al,%al
je     1146 <pl_strtoupper+0x36>
lea    0x1(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <toupper@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <pl_strtoupper+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @pl_strtoupper(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %1
ret i8* %0
5: ; preds = %1, %5
%6 = phi i8 [ %13, %5 ], [ %2, %1 ]
%7 = phi i8* [ %12, %5 ], [ %0, %1 ]
%8 = phi i64 [ %11, %5 ], [ 0, %1 ]
%9 = tail call i64 @toupper(i8 signext %6)
%10 = trunc i64 %9 to i8
store i8 %10, i8* %7
%11 = add i64 %8, 1
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %4, label %5
}
void setup_pieces(void) {}


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

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

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

LLVM IR (-O2):
define void @setup_pieces() {
ret void
}
/* Type definitions */
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double now(void) {
  struct timeval t;
  gettimeofday(&t, NULL);
  return t.tv_sec + (0.000001 * t.tv_usec);
}


x86 assembly (clang, -O0):
<now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
movsd  0xec9(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<now>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  0x10(%rsp),%xmm0
mulsd  0xed2(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
define double @now() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load double, double* %5
%7 = call double @llvm.fmuladd.f64(double 0x3EB0C6F7A0B5ED8D, double %6, double %4)
ret double %7
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
define double @now() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load double, double* %6
%8 = tail call double @llvm.fmuladd.f64(double %7, double 0x3EB0C6F7A0B5ED8D, double %5)
ret double %8
}
int fun139() { return 139; }


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

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

LLVM IR (-O0):
define i32 @fun139() {
ret i32 139
}

LLVM IR (-O2):
define i32 @fun139() {
ret i32 139
}
/* Variables and functions */
int assign_long(unsigned long *, char const *);
char *get_value_if_matches(char const *, char const *);
int assign_long_if_matches(char const *line, char const *argument,
                           unsigned long *target) {
  char const *value = get_value_if_matches(line, argument);
  return (value ? (assign_long(target, value), 1) : 0);
}


x86 assembly (clang, -O0):
<assign_long_if_matches>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <get_value_if_matches@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     116a <assign_long_if_matches+0x4a>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <assign_long@plt>
mov    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1174 <assign_long_if_matches+0x54>
xor    %eax,%eax
mov    %eax,-0x24(%rbp)
jmp    1174 <assign_long_if_matches+0x54>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assign_long_if_matches>:
push   %rbx
mov    %rdx,%rbx
call   1040 <get_value_if_matches@plt>
test   %rax,%rax
je     1140 <assign_long_if_matches+0x20>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <assign_long@plt>
mov    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @assign_long_if_matches(i8* %0, i8* %1, i64* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64* %2, i64** %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = call i8* @get_value_if_matches(i8* %8, i8* %9)
store i8* %10, i8** %7
%11 = load i8*, i8** %7
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %17
13: ; preds = %3
%14 = load i64*, i64** %6
%15 = load i8*, i8** %7
%16 = call i32 @assign_long(i64* %14, i8* %15)
br label %18
17: ; preds = %3
br label %18
18: ; preds = %17, %13
%19 = phi i32 [ 1, %13 ], [ 0, %17 ]
ret i32 %19
}

LLVM IR (-O2):
define i32 @assign_long_if_matches(i8* %0, i8* %1, i64* %2) {
%4 = tail call i8* @get_value_if_matches(i8* %0, i8* %1)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @assign_long(i64* %2, i8* %4)
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ 1, %6 ], [ 0, %3 ]
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int8_t cmp(const void *v1, const void *v2) {
  intptr_t cmv = (intptr_t)v1 - (intptr_t)v2;
  return (int8_t)((cmv > 0) - (cmv < 0));
}


x86 assembly (clang, -O0):
<cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%eax
cmpq   $0x0,-0x18(%rbp)
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp>:
sub    %rsi,%rdi
xor    %eax,%eax
test   %rdi,%rdi
setg   %al
sar    $0x3f,%rdi
add    %edi,%eax
ret

LLVM IR (-O0):
define i32 @cmp(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %6 to i64
%8 = load i8*, i8** %4
%9 = ptrtoint i8* %8 to i64
%10 = sub nsw i64 %7, %9
store i64 %10, i64* %5
%11 = load i64, i64* %5
%12 = icmp sgt i64 %11, 0
%13 = zext i1 %12 to i32
%14 = load i64, i64* %5
%15 = icmp slt i64 %14, 0
%16 = zext i1 %15 to i32
%17 = sub nsw i32 %13, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @cmp(i8* %0, i8* %1) {
%3 = ptrtoint i8* %0 to i64
%4 = ptrtoint i8* %1 to i64
%5 = sub nsw i64 %3, %4
%6 = icmp sgt i64 %5, 0
%7 = zext i1 %6 to i32
%8 = ashr i64 %5, 63
%9 = trunc i64 %8 to i32
%10 = add nsw i32 %9, %7
ret i32 %10
}
int is_option(char *argv_element, int only) {
  return ((argv_element == 0) || (argv_element[0] == '-') ||
          (only && argv_element[0] == '+'));
}


x86 assembly (clang, -O0):
<is_option>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x1,%al
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1155 <is_option+0x55>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x2d,%ecx
mov    %al,-0xd(%rbp)
je     1155 <is_option+0x55>
xor    %eax,%eax
cmpl   $0x0,-0xc(%rbp)
mov    %al,-0xe(%rbp)
je     114f <is_option+0x4f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
sete   %al
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_option>:
mov    $0x1,%eax
test   %rdi,%rdi
je     111d <is_option+0x1d>
mov    (%rdi),%cl
cmp    $0x2d,%cl
je     111d <is_option+0x1d>
xor    %eax,%eax
test   %esi,%esi
je     111d <is_option+0x1d>
cmp    $0x2b,%cl
sete   %al
ret

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

LLVM IR (-O2):
define i32 @is_option(i8* %0, i32 %1) {
%3 = icmp eq i8* %0, null
br i1 %3, label %12, label %4
4: ; preds = %2
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 45
br i1 %6, label %12, label %7
7: ; preds = %4
%8 = icmp eq i32 %1, 0
br i1 %8, label %12, label %9
9: ; preds = %7
%10 = icmp eq i8 %5, 43
%11 = zext i1 %10 to i32
br label %12
12: ; preds = %7, %9, %4, %2
%13 = phi i32 [ 1, %4 ], [ 1, %2 ], [ 0, %7 ], [ %11, %9 ]
ret i32 %13
}
void UI_set_result(void) {}


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

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

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

LLVM IR (-O2):
define void @UI_set_result() {
ret void
}
/* Variables and functions */
int tracepoint_probe_register(char *, void *);
__attribute__((always_)) int register_trace_module_put(
    void (*probe)(struct module *mod, unsigned long ip, int refcnt)) {
  return tracepoint_probe_register("module_put", (void *)probe);
}


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

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

LLVM IR (-O0):
%struct.module = type opaque
@.str = [11 x i8] c"module_put\00"
define i32 @register_trace_module_put(void (%struct.module*, i64, i32)* %0) {
%2 = alloca void (%struct.module*, i64, i32)*
store void (%struct.module*, i64, i32)* %0, void (%struct.module*, i64, i32)** %2
%3 = load void (%struct.module*, i64, i32)*, void (%struct.module*, i64, i32)** %2
%4 = bitcast void (%struct.module*, i64, i32)* %3 to i8*
%5 = call i32 @tracepoint_probe_register(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 %5
}

LLVM IR (-O2):
%struct.module = type opaque
@.str = [11 x i8] c"module_put\00"
define i32 @register_trace_module_put(void (%struct.module*, i64, i32)* %0) {
%2 = bitcast void (%struct.module*, i64, i32)* %0 to i8*
%3 = tail call i32 @tracepoint_probe_register(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ check(int /*<<< orphan*/, char *);
int /*<<< orphan*/ mkdir(char const *, int);
int /*<<< orphan*/ mount(char *, char const *, char *, int /*<<< orphan*/,
                         char *);
void mount_proc(const char *dst) {
  check(mkdir(dst, 0700), "mkdir");
  check(mount("", dst, "proc", 0, ""), "mount(/proc)");
}


x86 assembly (clang, -O0):
<mount_proc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
mov    %eax,%edi
lea    0xead(%rip),%rsi
call   1050 <check@plt>
mov    -0x8(%rbp),%rsi
lea    0xeb4(%rip),%r8
lea    0xe9c(%rip),%rdx
xor    %ecx,%ecx
mov    %r8,%rdi
call   1040 <mount@plt>
mov    %eax,%edi
lea    0xe8e(%rip),%rsi
call   1050 <check@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mount_proc>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1c0,%esi
call   1030 <mkdir@plt>
lea    0xebb(%rip),%rsi
mov    %eax,%edi
call   1050 <check@plt>
lea    0xeb3(%rip),%rdx
lea    0xebd(%rip),%rdi
mov    %rbx,%rsi
xor    %ecx,%ecx
mov    %rdi,%r8
call   1040 <mount@plt>
lea    0xe9d(%rip),%rsi
mov    %eax,%edi
pop    %rbx
jmp    1050 <check@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"mkdir\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [5 x i8] c"proc\00"
@.str.3 = [13 x i8] c"mount(/proc)\00"
define void @mount_proc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @mkdir(i8* %3, i32 448)
%5 = call i32 @check(i32 %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %2
%7 = call i32 @mount(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @check(i32 %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"mkdir\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [5 x i8] c"proc\00"
@.str.3 = [13 x i8] c"mount(/proc)\00"
define void @mount_proc(i8* %0) {
%2 = tail call i32 @mkdir(i8* %0, i32 448)
%3 = tail call i32 @check(i32 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @mount(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @check(i32 %4, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
ret void
}
int plus(int x, int y) {
  if (x != 0)
    if (y != 0) {
      int z = x + y;
      if (z != 0)
        return 1;
    }
  return 0;
}


x86 assembly (clang, -O0):
<plus>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1147 <plus+0x47>
cmpl   $0x0,-0xc(%rbp)
je     1142 <plus+0x42>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     113d <plus+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    114e <plus+0x4e>
jmp    1142 <plus+0x42>
jmp    1147 <plus+0x47>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<plus>:
test   %edi,%edi
setne  %al
test   %esi,%esi
setne  %cl
and    %al,%cl
add    %edi,%esi
setne  %al
and    %cl,%al
movzbl %al,%eax
ret

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

LLVM IR (-O2):
define i32 @plus(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = icmp eq i32 %1, 0
%5 = or i1 %3, %4
%6 = sub i32 0, %1
%7 = icmp eq i32 %6, %0
%8 = or i1 %7, %5
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}
/* Variables and functions */
size_t strlen(const char *s) {
  char *sBeg = (char *)s;
  while (*s != 0) {
    s++;
  }
  return (size_t)(s - sBeg);
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1131 <strlen+0x31>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
ret i64 %10
}
int my_is_prime(int nb) {
  int i;
  i = 2;
  if (nb < 2)
    return (0);
  else {
    while (i < nb) {
      if (nb % i == 0)
        return (0);
      ++i;
    }
    return (1);
  }
}


x86 assembly (clang, -O0):
<my_is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1124 <my_is_prime+0x24>
movl   $0x0,-0x4(%rbp)
jmp    1166 <my_is_prime+0x66>
jmp    1129 <my_is_prime+0x29>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115f <my_is_prime+0x5f>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1151 <my_is_prime+0x51>
movl   $0x0,-0x4(%rbp)
jmp    1166 <my_is_prime+0x66>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1129 <my_is_prime+0x29>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_is_prime>:
xor    %ecx,%ecx
cmp    $0x2,%edi
jge    110a <my_is_prime+0xa>
mov    %ecx,%eax
ret
jne    1112 <my_is_prime+0x12>
mov    $0x1,%eax
ret
mov    $0x2,%esi
nopw   0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1107 <my_is_prime+0x7>
add    $0x1,%esi
cmp    %esi,%edi
jne    1120 <my_is_prime+0x20>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @my_is_prime(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = icmp eq i32 %0, 2
br i1 %4, label %12, label %7
5: ; preds = %7
%6 = icmp eq i32 %11, %0
br i1 %6, label %12, label %7
7: ; preds = %3, %5
%8 = phi i32 [ %11, %5 ], [ 2, %3 ]
%9 = srem i32 %0, %8
%10 = icmp eq i32 %9, 0
%11 = add nuw nsw i32 %8, 1
br i1 %10, label %12, label %5
12: ; preds = %7, %5, %3, %1
%13 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 0, %7 ], [ 1, %5 ]
ret i32 %13
}
int ft_str_is_numeric(char *str) {
  int i;
  int result;
  i = 0;
  result = 1;
  while (str[i]) {
    if (str[i] < '0' || str[i] > '9')
      result = 0;
    i++;
  }
  return (result);
}


x86 assembly (clang, -O0):
<ft_str_is_numeric>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1167 <ft_str_is_numeric+0x67>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     1152 <ft_str_is_numeric+0x52>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jle    1159 <ft_str_is_numeric+0x59>
movl   $0x0,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <ft_str_is_numeric+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_str_is_numeric>:
mov    (%rdi),%cl
test   %cl,%cl
je     1135 <ft_str_is_numeric+0x35>
add    $0x1,%rdi
mov    $0x1,%eax
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0xc6,%cl
cmp    $0xf6,%cl
cmovb  %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1120 <ft_str_is_numeric+0x20>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_str_is_numeric(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %11, %4 ], [ 0, %1 ]
%6 = phi i8 [ %13, %4 ], [ %2, %1 ]
%7 = phi i32 [ %10, %4 ], [ 1, %1 ]
%8 = add i8 %6, -58
%9 = icmp ult i8 %8, -10
%10 = select i1 %9, i32 0, i32 %7
%11 = add nuw nsw i64 %5, 1
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %15, label %4
15: ; preds = %4, %1
%16 = phi i32 [ 1, %1 ], [ %10, %4 ]
ret i32 %16
}
__attribute__((visibility("default"))) int my_export(int x) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @my_export(i32 returned %0) {
ret i32 %0
}
extern void gui_ksys_exit(int value) {
  __asm__ __volatile__("int $0x40" : : "a"(-1), "b"(value));
}


x86 assembly (clang, -O0):
<gui_ksys_exit>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%ebx
mov    $0xffffffff,%eax
int    $0x40
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_ksys_exit>:
push   %rbx
mov    %edi,%ebx
mov    $0xffffffff,%eax
int    $0x40
pop    %rbx
ret

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

LLVM IR (-O2):
define void @gui_ksys_exit(i32 %0) {
tail call void asm sideeffect "int $$0x40", "{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 -1, i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
void printlf(int n, char *f) {
  if (f)
    printf(".lf %d %s\n", n, f);
  else
    printf(".lf %d\n", n);
}


x86 assembly (clang, -O0):
<printlf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1144 <printlf+0x34>
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1155 <printlf+0x45>
mov    -0x4(%rbp),%esi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printlf>:
mov    %rsi,%rdx
mov    %edi,%esi
test   %rdx,%rdx
je     1128 <printlf+0x18>
lea    0xedf(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xedc(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c".lf %d %s\0A\00"
@.str.1 = [8 x i8] c".lf %d\0A\00"
define void @printlf(i32 %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %1)
br label %8
6: ; preds = %2
%7 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %8
8: ; preds = %6, %4
ret void
}