xunge/DecIR huggingface dataset:
void SeNoticeF(fmt, a, b, c) char *fmt, *a, *b, *c;
{
  char buf[256];
  sprintf(buf, fmt, a, b, c);
  SeNotice(buf);
}


x86 assembly (clang, -O0):
<SeNoticeF>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x120(%rbp),%rdi
mov    $0x0,%al
call   1030 <SeNotice@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SeNoticeF>:
push   %rbx
sub    $0x100,%rsp
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <SeNotice@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @SeNoticeF(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [256 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %5
%12 = load i8*, i8** %6
%13 = load i8*, i8** %7
%14 = load i8*, i8** %8
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %10, i8* %11, i8* %12, i8* %13, i8* %14)
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @SeNotice to i32 (i8*, ...)*)(i8* %16)
ret void
}

LLVM IR (-O2):
define void @SeNoticeF(i8* nocapture %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca [256 x i8]
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%7 = call i32 (i8*, i8*, ...) @sprintf(i8* %6, i8* dereferenceable(1) %0, i8* %1, i8* %2, i8* %3)
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @SeNotice to i32 (i8*, ...)*)(i8* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void foobar(int i) { printf("Printing from Lib.so: %d\n", i); }


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

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

LLVM IR (-O0):
@.str = [26 x i8] c"Printing from Lib.so: %d\0A\00"
define void @foobar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Printing from Lib.so: %d\0A\00"
define void @foobar(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int O_RDWR;
int O_SYNC;
int flags_o_readwritesync(void) { return (O_RDWR | O_SYNC); }


x86 assembly (clang, -O0):
<flags_o_readwritesync>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
mov    0x2ecc(%rip),%rcx
or     (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flags_o_readwritesync>:
mov    0x2ee1(%rip),%rcx
mov    0x2ed2(%rip),%rax
mov    (%rax),%eax
or     (%rcx),%eax
ret

LLVM IR (-O0):
@O_RDWR = global i32 0
@O_SYNC = global i32 0
define i32 @flags_o_readwritesync() {
%1 = load i32, i32* @O_RDWR
%2 = load i32, i32* @O_SYNC
%3 = or i32 %1, %2
ret i32 %3
}

LLVM IR (-O2):
@O_RDWR = global i32 0
@O_SYNC = global i32 0
define i32 @flags_o_readwritesync() {
%1 = load i32, i32* @O_RDWR
%2 = load i32, i32* @O_SYNC
%3 = or i32 %2, %1
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void local_error(char *errmess) {
  fprintf(stderr, "%s", errmess);
  fprintf(stderr, "This is an error function.\n");
  exit(1);
}


x86 assembly (clang, -O0):
<local_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
lea    0xeac(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<local_error>:
push   %rbx
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rbx
mov    (%rbx),%edi
lea    0xecc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xebf(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [28 x i8] c"This is an error function.\0A\00"
define void @local_error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stderr
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [28 x i8] c"This is an error function.\0A\00"
define void @local_error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ alsa_close_audio();
void alsa_mmap_close_audio(void) { alsa_close_audio(); }


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

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

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

LLVM IR (-O2):
define void @alsa_mmap_close_audio() {
%1 = tail call i32 (...) @alsa_close_audio()
ret void
}
XFreeFontNames() {}


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

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

LLVM IR (-O0):
define i32 @XFreeFontNames() {
%1 = alloca i32
%2 = load i32, i32* %1
ret i32 %2
}

LLVM IR (-O2):
define i32 @XFreeFontNames() {
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ SXNET;

/* Variables and functions */
scalar_t__ ASN1_item_new(int /*<<< orphan*/ *);
int /*<<< orphan*/ SXNET_it;
SXNET *SXNET_new(void) { return (SXNET *)ASN1_item_new(&SXNET_it); }


x86 assembly (clang, -O0):
<SXNET_new>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ecd(%rip),%rdi
call   1030 <ASN1_item_new@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SXNET_new>:
mov    0x2ed1(%rip),%rdi
jmp    1030 <ASN1_item_new@plt>

LLVM IR (-O0):
@SXNET_it = global i32 0
define i32* @SXNET_new() {
%1 = call i64 @ASN1_item_new(i32* @SXNET_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}

LLVM IR (-O2):
@SXNET_it = global i32 0
define i32* @SXNET_new() {
%1 = tail call i64 @ASN1_item_new(i32* @SXNET_it)
%2 = inttoptr i64 %1 to i32*
ret i32* %2
}
/* Variables and functions */
int /*<<< orphan*/ def_section(char *, int);
void def_code(int attr) { def_section("CODE", attr); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"CODE\00"
define void @def_code(i32 %0) {
%2 = tail call i32 @def_section(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int chess_file(int square) {
  assert(square >= 0 && square <= 63);
  return square & 7;
}


x86 assembly (clang, -O0):
<chess_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1134 <chess_file+0x24>
cmpl   $0x3f,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
and    $0x7,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chess_file>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x40,%ebx
setb   %dil
call   1030 <assert@plt>
and    $0x7,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @chess_file(i32 %0) {
%2 = icmp ult i32 %0, 64
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = and i32 %0, 7
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ handle_45(int /*<<< orphan*/);
int gen_45() { handle_45(0); }


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

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

LLVM IR (-O0):
define i32 @gen_45() {
%1 = alloca i32
%2 = call i32 @handle_45(i32 0)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @gen_45() {
%1 = tail call i32 @handle_45(i32 0)
ret i32 undef
}
/* Variables and functions */
void *malloc(size_t);
void *allocate_buffer(size_t size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<allocate_buffer>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @allocate_buffer(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
/* Variables and functions */
int EXIT_SUCCESS;
int multip(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%d\n", multip(255, 255));
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xff,%esi
mov    %esi,%edi
call   1040 <multip@plt>
mov    %eax,%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xff,%edi
mov    $0xff,%esi
call   1040 <multip@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @multip(i32 255, i32 255)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
int sd_is_left_mergeable(struct key *key, unsigned long bsize) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.key = type opaque
define i32 @sd_is_left_mergeable(%struct.key* nocapture readnone %0, i64 %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ glEndList();
int /*<<< orphan*/ printf(char *, ...);
void trace_glEndList(void) {
  printf("%20s(", "glEndList");
  printf(");\n");
  glEndList();
}


x86 assembly (clang, -O0):
<trace_glEndList>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xed4(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <glEndList@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<trace_glEndList>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0xec7(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <glEndList@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"%20s(\00"
@.str.1 = [10 x i8] c"glEndList\00"
@.str.2 = [4 x i8] c");\0A\00"
define void @trace_glEndList() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 (...) @glEndList()
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%20s(\00"
@.str.1 = [10 x i8] c"glEndList\00"
@str = [3 x i8] c");\00"
define void @trace_glEndList() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @glEndList()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void *realloc(void *, size_t);
void *xrealloc(void *ptr, size_t size) {
  void *value = realloc(ptr, size);
  if (value == 0)
    printf("Virtual memory exhausted");
  return value;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1158 <xrealloc+0x38>
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [25 x i8] c"Virtual memory exhausted\00"
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
void g_pattern_match() {}


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

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

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

LLVM IR (-O2):
define void @g_pattern_match() {
ret void
}
int main(int argc, char **argv) {
  int x[5];
  int y;
  int z[5] = {10, 20, 30, 40, 50};
  int i;
  for (i = 0; i < 5; ++i) {
    x[i] = z[i];
    if (i == 3)
      y = x[i];
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xee7(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xee4(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xee2(%rip),%eax
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x54(%rbp)
cmpl   $0x5,-0x54(%rbp)
jge    117a <main+0x7a>
movslq -0x54(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%ecx
movslq -0x54(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
cmpl   $0x3,-0x54(%rbp)
jne    1167 <main+0x67>
movslq -0x54(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x34(%rbp)
jmp    116c <main+0x6c>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1138 <main+0x38>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
void loop(void (*init)(void *), void (*step)(void *), void *result) {
  unsigned long i;
  i = 0;
  init(result);
  while (i < (53681 * 50)) {
    step(result);
    i++;
  }
}


x86 assembly (clang, -O0):
<loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rdi
call   *%rax
cmpq   $0x28f492,-0x20(%rbp)
jae    114f <loop+0x4f>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rdi
call   *%rax
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1126 <loop+0x26>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<loop>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rax
mov    %rdx,%rdi
call   *%rax
mov    $0x28f492,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   *%r14
add    $0xffffffffffffffff,%rbx
jne    1120 <loop+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @loop(void (i8*)* nocapture %0, void (i8*)* nocapture %1, i8* %2) {
tail call void %0(i8* %2)
br label %4
4: ; preds = %3, %4
%5 = phi i64 [ 0, %3 ], [ %6, %4 ]
tail call void %1(i8* %2)
%6 = add nuw nsw i64 %5, 1
%7 = icmp eq i64 %6, 2684050
br i1 %7, label %8, label %4
8: ; preds = %4
ret void
}
/* Variables and functions */
int chdir(char *);
int idris2_changeDir(char *dir) { return chdir(dir); }


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

x86 assembly (clang, -O2):
<idris2_changeDir>:
jmp    1030 <chdir@plt>

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

LLVM IR (-O2):
define i32 @idris2_changeDir(i8* %0) {
%2 = tail call i32 @chdir(i8* %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ strftime(char *, int, char *, int /*<<< orphan*/);
char *makeYearTxt(int ts, char *txt) {
  strftime(txt, 5, "%Y", localtime((time_t *)&ts));
  return txt;
}


x86 assembly (clang, -O0):
<makeYearTxt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%ecx
mov    $0x5,%esi
lea    0xeae(%rip),%rdx
call   1040 <strftime@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<makeYearTxt>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xec3(%rip),%rdx
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %eax,%ecx
call   1040 <strftime@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%Y\00"
define i8* @makeYearTxt(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 = call i32 @localtime(i32* %3)
%7 = call i32 @strftime(i8* %5, i32 5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i8*, i8** %4
ret i8* %8
}

LLVM IR (-O2):
@.str = [3 x i8] c"%Y\00"
define i8* @makeYearTxt(i32 %0, i8* returned %1) {
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 @localtime(i32* %3)
%5 = call i32 @strftime(i8* %1, i32 5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i8* %1
}
OP(ed, c9) {}


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

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

LLVM IR (-O0):
define i32 @OP(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int foo(int k, int j) {
  if (k >= 10) {
    if (j > k) {
      if (j < 10)
        abort();
    }
  }
  return j;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0xa,-0x4(%rbp)
jl     114f <foo+0x3f>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jle    114a <foo+0x3a>
cmpl   $0xa,-0x8(%rbp)
jge    1145 <foo+0x35>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    114a <foo+0x3a>
jmp    114f <foo+0x3f>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    $0xa,%edi
jl     111e <foo+0xe>
cmp    %edi,%esi
jle    111e <foo+0xe>
cmp    $0x9,%esi
jle    1121 <foo+0x11>
mov    %esi,%eax
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @foo(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 = icmp sge i32 %5, 10
br i1 %6, label %7, label %18
7: ; preds = %2
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = icmp sgt i32 %8, %9
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 10
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %11
br label %17
17: ; preds = %16, %7
br label %18
18: ; preds = %17, %2
%19 = load i32, i32* %4
ret i32 %19
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 returned %1) {
%3 = icmp sgt i32 %0, 9
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = icmp sgt i32 %1, %0
%6 = icmp slt i32 %1, 10
%7 = and i1 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %4
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %4, %2
ret i32 %1
}
void reg_write32(unsigned int address, unsigned int value) {
  unsigned int *mem = (unsigned int *)address;
  *mem = value;
}


x86 assembly (clang, -O0):
<reg_write32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @reg_write32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %5
%9 = load i32, i32* %4
%10 = load i32*, i32** %5
store i32 %9, i32* %10
ret void
}

LLVM IR (-O2):
define void @reg_write32(i32 %0, i32 %1) {
%3 = zext i32 %0 to i64
%4 = inttoptr i64 %3 to i32*
store i32 %1, i32* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ hpgs_get_prefix();
char *hpgs_sprintf_malloc(char *, int /*<<< orphan*/, char, char, char,
                          char const *);
char *hpgs_share_filename(const char *rel_filename) {
  return hpgs_sprintf_malloc("%s%cshare%chpgs%c%s", hpgs_get_prefix(), '/', '/',
                             '/', rel_filename);
}


x86 assembly (clang, -O0):
<hpgs_share_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1040 <hpgs_get_prefix@plt>
mov    %eax,%esi
mov    -0x8(%rbp),%r9
lea    0xec0(%rip),%rdi
mov    $0x2f,%r8d
mov    %r8d,%edx
mov    %r8d,%ecx
call   1030 <hpgs_sprintf_malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hpgs_share_filename>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <hpgs_get_prefix@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
mov    $0x2f,%edx
mov    $0x2f,%ecx
mov    $0x2f,%r8d
mov    %rbx,%r9
pop    %rbx
jmp    1030 <hpgs_sprintf_malloc@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"%s%cshare%chpgs%c%s\00"
define i8* @hpgs_share_filename(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @hpgs_get_prefix()
%4 = load i8*, i8** %2
%5 = call i8* @hpgs_sprintf_malloc(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %3, i8 signext 47, i8 signext 47, i8 signext 47, i8* %4)
ret i8* %5
}

LLVM IR (-O2):
@.str = [20 x i8] c"%s%cshare%chpgs%c%s\00"
define i8* @hpgs_share_filename(i8* %0) {
%2 = tail call i32 (...) @hpgs_get_prefix()
%3 = tail call i8* @hpgs_sprintf_malloc(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %2, i8 signext 47, i8 signext 47, i8 signext 47, i8* %0)
ret i8* %3
}
int apply_sign(const int v, const int s) { return s < 0 ? -v : v; }


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

x86 assembly (clang, -O2):
<apply_sign>:
mov    %edi,%eax
neg    %eax
test   %esi,%esi
cmovns %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @apply_sign(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, 0
%4 = sub nsw i32 0, %0
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Variables and functions */
char *lltoa_wp(long long, char *, int, int /*<<< orphan*/, char);
char *lltoa(long long val, char *buffer, int base) {
  return lltoa_wp(val, buffer, base, 0, ' ');
}


x86 assembly (clang, -O0):
<lltoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
mov    $0x20,%r8d
call   1030 <lltoa_wp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lltoa>:
xor    %ecx,%ecx
mov    $0x20,%r8d
jmp    1030 <lltoa_wp@plt>

LLVM IR (-O0):
define i8* @lltoa(i64 %0, i8* %1, i32 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
store i64 %0, i64* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i64, i64* %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i8* @lltoa_wp(i64 %7, i8* %8, i32 %9, i32 0, i8 signext 32)
ret i8* %10
}

LLVM IR (-O2):
define i8* @lltoa(i64 %0, i8* %1, i32 %2) {
%4 = tail call i8* @lltoa_wp(i64 %0, i8* %1, i32 %2, i32 0, i8 signext 32)
ret i8* %4
}
/* Variables and functions */
char *get_ses_fru_desc(char *buf) {
  if (!buf)
    return NULL;
  while (*buf == ' ')
    buf++;
  return buf;
}


x86 assembly (clang, -O0):
<get_ses_fru_desc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1120 <get_ses_fru_desc+0x20>
movq   $0x0,-0x8(%rbp)
jmp    114e <get_ses_fru_desc+0x4e>
jmp    1125 <get_ses_fru_desc+0x25>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1146 <get_ses_fru_desc+0x46>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1125 <get_ses_fru_desc+0x25>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_ses_fru_desc>:
test   %rdi,%rdi
je     111e <get_ses_fru_desc+0x1e>
add    $0xffffffffffffffff,%rdi
nopl   0x0(%rax)
lea    0x1(%rdi),%rax
cmpb   $0x20,0x1(%rdi)
mov    %rax,%rdi
je     1110 <get_ses_fru_desc+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i8* @get_ses_fru_desc(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i8* [ %7, %3 ], [ %0, %1 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 32
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %3, label %8
8: ; preds = %3, %1
%9 = phi i8* [ null, %1 ], [ %4, %3 ]
ret i8* %9
}
/* Type definitions */
struct mempool {
  int dummy;
};

/* Variables and functions */
scalar_t__ mp_dmemdup(struct mempool *, char const *, scalar_t__);
scalar_t__ strlen(char const *);
const char *mp_dstrdup(struct mempool *mp, const char *str) {
  return (const char *)mp_dmemdup(mp, str, strlen(str) + 1);
}


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

x86 assembly (clang, -O2):
<mp_dstrdup>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <mp_dmemdup@plt>

LLVM IR (-O0):
%struct.mempool = type { i32 }
define i8* @mp_dstrdup(%struct.mempool* %0, i8* %1) {
%3 = alloca %struct.mempool*
%4 = alloca i8*
store %struct.mempool* %0, %struct.mempool** %3
store i8* %1, i8** %4
%5 = load %struct.mempool*, %struct.mempool** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i64 @strlen(i8* %7)
%9 = add nsw i64 %8, 1
%10 = call i64 @mp_dmemdup(%struct.mempool* %5, i8* %6, i64 %9)
%11 = inttoptr i64 %10 to i8*
ret i8* %11
}

LLVM IR (-O2):
%struct.mempool = type { i32 }
define i8* @mp_dstrdup(%struct.mempool* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = add nsw i64 %3, 1
%5 = tail call i64 @mp_dmemdup(%struct.mempool* %0, i8* %1, i64 %4)
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}
int test_imm_0Euint16_reg(unsigned short val) {
  return ((val) & (-0x0E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_0Euint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xfffffff2,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_0Euint16_reg>:
test   $0xfff2,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_0Euint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, -14
%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_0Euint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -14
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
void main() {
  long l = 2L * 3L;
  printf("l = %f.\n", l);
}


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

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
mov    $0x6,%esi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [9 x i8] c"l = %f.\0A\00"
define void @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 6)
ret void
}
unsigned hash_ptr(const void *ptr) {
  return ((unsigned)(((char *)(ptr) - (char *)0) >> 3));
}


x86 assembly (clang, -O0):
<hash_ptr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
sub    $0x0,%rax
sar    $0x3,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash_ptr>:
mov    %rdi,%rax
shr    $0x3,%rax
ret

LLVM IR (-O0):
define i32 @hash_ptr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
%5 = sub i64 %4, 0
%6 = ashr i64 %5, 3
%7 = trunc i64 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @hash_ptr(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = lshr i64 %2, 3
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int cmToIn(float);
float cmToFt(float cm) { return cmToIn(cm) / 12; }


x86 assembly (clang, -O0):
<cmToFt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <cmToIn@plt>
mov    $0xc,%ecx
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmToFt>:
push   %rax
call   1030 <cmToIn@plt>
cltq
imul   $0x2aaaaaab,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @cmToFt(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @cmToIn(float %3)
%5 = sdiv i32 %4, 12
%6 = sitofp i32 %5 to float
ret float %6
}

LLVM IR (-O2):
define float @cmToFt(float %0) {
%2 = tail call i32 @cmToIn(float %0)
%3 = sdiv i32 %2, 12
%4 = sitofp i32 %3 to float
ret float %4
}
void aplicaTirada(char tauler[6][7], int columna, int fila, char jugador) {
  tauler[fila][columna] = jugador;
}


x86 assembly (clang, -O0):
<aplicaTirada>:
push   %rbp
mov    %rsp,%rbp
mov    %cl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
imul   $0x7,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<aplicaTirada>:
movslq %edx,%rax
movslq %esi,%rdx
lea    0x0(,%rax,8),%rsi
sub    %rax,%rsi
add    %rdi,%rsi
mov    %cl,(%rdx,%rsi,1)
ret

LLVM IR (-O0):
define void @aplicaTirada([7 x i8]* %0, i32 %1, i32 %2, i8 signext %3) {
%5 = alloca [7 x i8]*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
store [7 x i8]* %0, [7 x i8]** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8 %3, i8* %8
%9 = load i8, i8* %8
%10 = load [7 x i8]*, [7 x i8]** %5
%11 = load i32, i32* %7
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [7 x i8], [7 x i8]* %10, i64 %12
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [7 x i8], [7 x i8]* %13, i64 0, i64 %15
store i8 %9, i8* %16
ret void
}

LLVM IR (-O2):
define void @aplicaTirada([7 x i8]* nocapture writeonly %0, i32 %1, i32 %2, i8 signext %3) {
%5 = sext i32 %2 to i64
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %0, i64 %5, i64 %6
store i8 %3, i8* %7
ret void
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ SVCXPRT;

/* Variables and functions */
scalar_t__ svc_getcaller(int /*<<< orphan*/ *);
struct sockaddr *nfs_getrpccaller(SVCXPRT *xprt) {
  return (struct sockaddr *)(char *)svc_getcaller(xprt);
}


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

x86 assembly (clang, -O2):
<nfs_getrpccaller>:
jmp    1030 <svc_getcaller@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define %struct.sockaddr* @nfs_getrpccaller(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i64 @svc_getcaller(i32* %3)
%5 = inttoptr i64 %4 to i8*
%6 = bitcast i8* %5 to %struct.sockaddr*
ret %struct.sockaddr* %6
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define %struct.sockaddr* @nfs_getrpccaller(i32* %0) {
%2 = tail call i64 @svc_getcaller(i32* %0)
%3 = inttoptr i64 %2 to %struct.sockaddr*
ret %struct.sockaddr* %3
}
/* Type definitions */
struct sshbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sshbuf_len(struct sshbuf const *);
int /*<<< orphan*/ sshbuf_ptr(struct sshbuf const *);
int sshbuf_put_string(struct sshbuf *, int /*<<< orphan*/, int /*<<< orphan*/);
int sshbuf_put_stringb(struct sshbuf *buf, const struct sshbuf *v) {
  return sshbuf_put_string(buf, sshbuf_ptr(v), sshbuf_len(v));
}


x86 assembly (clang, -O0):
<sshbuf_put_stringb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <sshbuf_ptr@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <sshbuf_len@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    %eax,%edx
call   1030 <sshbuf_put_string@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sshbuf_put_stringb>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1050 <sshbuf_ptr@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <sshbuf_len@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %eax,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <sshbuf_put_string@plt>

LLVM IR (-O0):
%struct.sshbuf = type { i32 }
define i32 @sshbuf_put_stringb(%struct.sshbuf* %0, %struct.sshbuf* %1) {
%3 = alloca %struct.sshbuf*
%4 = alloca %struct.sshbuf*
store %struct.sshbuf* %0, %struct.sshbuf** %3
store %struct.sshbuf* %1, %struct.sshbuf** %4
%5 = load %struct.sshbuf*, %struct.sshbuf** %3
%6 = load %struct.sshbuf*, %struct.sshbuf** %4
%7 = call i32 @sshbuf_ptr(%struct.sshbuf* %6)
%8 = load %struct.sshbuf*, %struct.sshbuf** %4
%9 = call i32 @sshbuf_len(%struct.sshbuf* %8)
%10 = call i32 @sshbuf_put_string(%struct.sshbuf* %5, i32 %7, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
%struct.sshbuf = type { i32 }
define i32 @sshbuf_put_stringb(%struct.sshbuf* %0, %struct.sshbuf* %1) {
%3 = tail call i32 @sshbuf_ptr(%struct.sshbuf* %1)
%4 = tail call i32 @sshbuf_len(%struct.sshbuf* %1)
%5 = tail call i32 @sshbuf_put_string(%struct.sshbuf* %0, i32 %3, i32 %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "usage: realpath [-q] [path ...]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"usage: realpath [-q] [path ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"usage: realpath [-q] [path ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
OP(ed, f5) { illegal_2(); }


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <illegal_2@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @OP(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = call i32 (...) @illegal_2()
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_2()
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void *runner1(void *args) {
  int *a = (int *)args;
  int i, sum = 0;
  for (i = 0; i < *a; i += 2) {
    sum += i;
  }
  printf("Even Sum: %d\n", sum);
}


x86 assembly (clang, -O0):
<runner1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    1158 <runner1+0x48>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    1132 <runner1+0x22>
mov    -0x20(%rbp),%esi
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runner1>:
mov    (%rdi),%esi
test   %esi,%esi
jle    1137 <runner1+0x27>
add    $0xffffffff,%esi
mov    %esi,%eax
shr    %eax
lea    -0x1(%rax),%ecx
imul   %eax,%ecx
and    $0xfffffffe,%ecx
and    $0xfffffffe,%esi
add    %ecx,%esi
lea    0xece(%rip),%rdi
jmp    1030 <printf@plt>
xor    %esi,%esi
lea    0xec0(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Even Sum: %d\0A\00"
define i8* @runner1(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %4
store i32 0, i32* %6
store i32 0, i32* %5
br label %9
9: ; preds = %18, %1
%10 = load i32, i32* %5
%11 = load i32*, i32** %4
%12 = load i32, i32* %11
%13 = icmp slt i32 %10, %12
br i1 %13, label %14, label %21
14: ; preds = %9
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = add nsw i32 %16, %15
store i32 %17, i32* %6
br label %18
18: ; preds = %14
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 2
store i32 %20, i32* %5
br label %9
21: ; preds = %9
%22 = load i32, i32* %6
%23 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = load i8*, i8** %2
ret i8* %24
}

LLVM IR (-O2):
@.str = [14 x i8] c"Even Sum: %d\0A\00"
define noalias i8* @runner1(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %14
5: ; preds = %1
%6 = add nsw i32 %3, -1
%7 = lshr i32 %6, 1
%8 = lshr i32 %6, 1
%9 = add nsw i32 %7, -1
%10 = mul i32 %8, %9
%11 = and i32 %10, -2
%12 = and i32 %6, -2
%13 = add i32 %12, %11
br label %14
14: ; preds = %5, %1
%15 = phi i32 [ 0, %1 ], [ %13, %5 ]
%16 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i8* undef
}