xunge/DecIR huggingface dataset:
int idx_row(int el, int idx) { return (9 * (el) + (idx)); }


x86 assembly (clang, -O0):
<idx_row>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
imul   $0x9,-0x4(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<idx_row>:
lea    (%rdi,%rdi,8),%eax
add    %esi,%eax
ret

LLVM IR (-O0):
define i32 @idx_row(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 = mul nsw i32 9, %5
%7 = load i32, i32* %4
%8 = add nsw i32 %6, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @idx_row(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, 9
%4 = add nsw i32 %3, %1
ret i32 %4
}
/* Variables and functions */
int nextInt(int);
int /*<<< orphan*/ rshift();
void spin() {
  int lim = nextInt(6) + 1;
  int i;
  for (i = 1; i < lim; i++) {
    rshift();
  }
}


x86 assembly (clang, -O0):
<spin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x6,%edi
call   1040 <nextInt@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1160 <spin+0x40>
mov    $0x0,%al
call   1030 <rshift@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113f <spin+0x1f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spin>:
push   %rbx
mov    $0x6,%edi
call   1040 <nextInt@plt>
test   %eax,%eax
jle    114c <spin+0x2c>
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rshift@plt>
add    $0xffffffff,%ebx
jne    1140 <spin+0x20>
pop    %rbx
ret

LLVM IR (-O0):
define void @spin() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @nextInt(i32 6)
%4 = add nsw i32 %3, 1
store i32 %4, i32* %1
store i32 1, i32* %2
br label %5
5: ; preds = %11, %0
%6 = load i32, i32* %2
%7 = load i32, i32* %1
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = call i32 (...) @rshift()
br label %11
11: ; preds = %9
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %5
14: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @spin() {
%1 = tail call i32 @nextInt(i32 6)
%2 = icmp slt i32 %1, 1
br i1 %2, label %8, label %3
3: ; preds = %0, %3
%4 = phi i32 [ %6, %3 ], [ 1, %0 ]
%5 = tail call i32 (...) @rshift()
%6 = add nuw i32 %4, 1
%7 = icmp eq i32 %4, %1
br i1 %7, label %8, label %3
8: ; preds = %3, %0
ret void
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  unsigned char request_code;
};
struct TYPE_4__ {
  TYPE_1__ xerror;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
void set_XEvent_xerror_request_code(void *_p, unsigned char _v) {
  ((XEvent *)_p)->xerror.request_code = (unsigned char)_v;
}


x86 assembly (clang, -O0):
<set_XEvent_xerror_request_code>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XEvent_xerror_request_code>:
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i8 }
define void @set_XEvent_xerror_request_code(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i8 %5, i8* %9
ret void
}

LLVM IR (-O2):
define void @set_XEvent_xerror_request_code(i8* nocapture writeonly %0, i8 zeroext %1) {
store i8 %1, i8* %0
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
uint16_t udiv16(uint16_t a, uint16_t b) {
  uint16_t r;
  if (b == 0) {
    fprintf(stderr, "Should not happen\n");
    exit(EXIT_FAILURE);
  }
  r = a / b;
  return r;
}


x86 assembly (clang, -O0):
<udiv16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    115b <udiv16+0x3b>
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<udiv16>:
test   %esi,%esi
je     112a <udiv16+0xa>
mov    %edi,%eax
cltd
idiv   %esi
ret
push   %rax
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"Should not happen\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @udiv16(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* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = sdiv i32 %14, %15
store i32 %16, i32* %5
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"Should not happen\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @udiv16(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = sdiv i32 %0, %1
ret i32 %10
}
/* Variables and functions */
scalar_t__ strlen(char *);
char *mvd_name(char *dir_name) {
  if (strlen(dir_name) > 0 && dir_name[0] == '%')
    return &dir_name[1];
  else
    return dir_name;
}


x86 assembly (clang, -O0):
<mvd_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    1150 <mvd_name+0x40>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x25,%eax
jne    1150 <mvd_name+0x40>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1158 <mvd_name+0x48>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mvd_name>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %rax,%rax
jle    1129 <mvd_name+0x19>
xor    %eax,%eax
cmpb   $0x25,(%rbx)
sete   %al
add    %rax,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @mvd_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @strlen(i8* %4)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %1
%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, 37
br i1 %12, label %13, label %16
13: ; preds = %7
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8* %15, i8** %2
br label %18
16: ; preds = %7, %1
%17 = load i8*, i8** %3
store i8* %17, i8** %2
br label %18
18: ; preds = %16, %13
%19 = load i8*, i8** %2
ret i8* %19
}

LLVM IR (-O2):
define i8* @mvd_name(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = icmp sgt i64 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 37
%7 = zext i1 %6 to i64
%8 = getelementptr i8, i8* %0, i64 %7
br label %9
9: ; preds = %4, %1
%10 = phi i8* [ %0, %1 ], [ %8, %4 ]
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ get_tok();
main() {
  get_tok();
  exit(0);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <get_tok@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @get_tok()
%3 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @get_tok()
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ off_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fseeko(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
__attribute__((__weak__, __always___)) int
softboundcets_fseeko(FILE *stream, off_t offset, int whence) {
  return fseeko(stream, offset, whence);
}


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

x86 assembly (clang, -O2):
<softboundcets_fseeko>:
jmp    1030 <fseeko@plt>

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

LLVM IR (-O2):
define weak i32 @softboundcets_fseeko(i32* %0, i32 %1, i32 %2) {
%4 = tail call i32 @fseeko(i32* %0, i32 %1, i32 %2)
ret i32 %4
}
void getPtr(void **targ, void *src) { *targ = src; }


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

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

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

LLVM IR (-O2):
define void @getPtr(i8** nocapture writeonly %0, i8* %1) {
store i8* %1, i8** %0
ret void
}
void SynthOS_panic() {}


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

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

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

LLVM IR (-O2):
define void @SynthOS_panic() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void print_help() {
  puts("usage: docker-sandbox [ OPTIONS ] COMMAND [ ARGS ... ]\n"
       "options:\n"
       "  -v VOLUME[:ro]  mount VOLUME as an external volume\n"
       "  --network NET   use alternative network mode\n"
       "  -i              keep stdin open\n"
       "  -t              allocate tty\n"
       "  -h              print help\n");
}


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

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

LLVM IR (-O0):
@.str = [259 x i8] c"usage: docker-sandbox [ OPTIONS ] COMMAND [ ARGS ... ]\0Aoptions:\0A -v VOLUME[:ro] mount VOLUME as an external volume\0A --network NET use alternative network mode\0A -i keep stdin open\0A -t allocate tty\0A -h print help\0A\00"
define void @print_help() {
%1 = call i32 @puts(i8* getelementptr inbounds ([259 x i8], [259 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [259 x i8] c"usage: docker-sandbox [ OPTIONS ] COMMAND [ ARGS ... ]\0Aoptions:\0A -v VOLUME[:ro] mount VOLUME as an external volume\0A --network NET use alternative network mode\0A -i keep stdin open\0A -t allocate tty\0A -h print help\0A\00"
define void @print_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([259 x i8], [259 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *malloc(int);
int main() {
  char *x = malloc(100);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @malloc(i32 100)
store i8* %3, i8** %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int uint16_t;

/* Variables and functions */
int crc16(int /*<<< orphan*/ const *, int /*<<< orphan*/);
uint16_t icrc16(const uint8_t *buffer, uint32_t size) {
  return crc16(buffer, size) ^ 0xFFFF;
}


x86 assembly (clang, -O0):
<icrc16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <crc16@plt>
xor    $0xffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<icrc16>:
push   %rax
call   1030 <crc16@plt>
xor    $0xffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @icrc16(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = call i32 @crc16(i32* %5, i32 %6)
%8 = xor i32 %7, 65535
ret i32 %8
}

LLVM IR (-O2):
define i32 @icrc16(i32* %0, i32 %1) {
%3 = tail call i32 @crc16(i32* %0, i32 %1)
%4 = xor i32 %3, 65535
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void Usage(char *proc) { printf("%s -[a|d|g] -[L|A|R]\n", proc); }


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"%s -[a|d|g] -[L|A|R]\0A\00"
define void @Usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"%s -[a|d|g] -[L|A|R]\0A\00"
define void @Usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ perror(char *);
void *realloc(void *, size_t);
void *erealloc_fof(void *ptr, size_t size) {
  void *np = realloc(ptr, size);
  if (np == NULL) {
    free(ptr);
    perror("realloc");
  }
  return np;
}


x86 assembly (clang, -O0):
<erealloc_fof>:
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    1171 <erealloc_fof+0x41>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
lea    0xe94(%rip),%rdi
call   1050 <perror@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erealloc_fof>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     114f <erealloc_fof+0x1f>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %r14,%rdi
call   1030 <free@plt>
lea    0xea2(%rip),%rdi
call   1050 <perror@plt>
jmp    1144 <erealloc_fof+0x14>

LLVM IR (-O0):
@.str = [8 x i8] c"realloc\00"
define i8* @erealloc_fof(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 %15
11: ; preds = %2
%12 = load i8*, i8** %3
%13 = call i32 @free(i8* %12)
%14 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %11, %2
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
@.str = [8 x i8] c"realloc\00"
define noalias i8* @erealloc_fof(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 %8
5: ; preds = %2
%6 = tail call i32 @free(i8* %0)
%7 = tail call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %5, %2
ret i8* %3
}
/* Type definitions */
struct utmpx {
  int dummy;
};

/* Variables and functions */
int ENOENT;
int write_entry_utmp(struct utmpx const *);
int write_entry_wtmp(struct utmpx const *);
int write_entry_both(const struct utmpx *store) {
  int r, s;
  r = write_entry_utmp(store);
  s = write_entry_wtmp(store);
  if (r >= 0)
    r = s;
  if (r == -ENOENT)
    r = 0;
  return r;
}


x86 assembly (clang, -O0):
<write_entry_both>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <write_entry_utmp@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <write_entry_wtmp@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1154 <write_entry_both+0x34>
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
xor    %ecx,%ecx
mov    0x2e78(%rip),%rdx
sub    (%rdx),%ecx
cmp    %ecx,%eax
jne    1171 <write_entry_both+0x51>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_entry_both>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <write_entry_utmp@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <write_entry_wtmp@plt>
test   %ebp,%ebp
cmovs  %ebp,%eax
mov    0x2e97(%rip),%rcx
xor    %edx,%edx
mov    (%rcx),%ecx
add    %eax,%ecx
cmove  %edx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.utmpx = type { i32 }
@ENOENT = global i32 0
define i32 @write_entry_both(%struct.utmpx* %0) {
%2 = alloca %struct.utmpx*
%3 = alloca i32
%4 = alloca i32
store %struct.utmpx* %0, %struct.utmpx** %2
%5 = load %struct.utmpx*, %struct.utmpx** %2
%6 = call i32 @write_entry_utmp(%struct.utmpx* %5)
store i32 %6, i32* %3
%7 = load %struct.utmpx*, %struct.utmpx** %2
%8 = call i32 @write_entry_wtmp(%struct.utmpx* %7)
store i32 %8, i32* %4
%9 = load i32, i32* %3
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = load i32, i32* %4
store i32 %12, i32* %3
br label %13
13: ; preds = %11, %1
%14 = load i32, i32* %3
%15 = load i32, i32* @ENOENT
%16 = sub nsw i32 0, %15
%17 = icmp eq i32 %14, %16
br i1 %17, label %18, label %19
18: ; preds = %13
store i32 0, i32* %3
br label %19
19: ; preds = %18, %13
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
%struct.utmpx = type { i32 }
@ENOENT = global i32 0
define i32 @write_entry_both(%struct.utmpx* %0) {
%2 = tail call i32 @write_entry_utmp(%struct.utmpx* %0)
%3 = tail call i32 @write_entry_wtmp(%struct.utmpx* %0)
%4 = icmp sgt i32 %2, -1
%5 = select i1 %4, i32 %3, i32 %2
%6 = load i32, i32* @ENOENT
%7 = sub nsw i32 0, %6
%8 = icmp eq i32 %5, %7
%9 = select i1 %8, i32 0, i32 %5
ret i32 %9
}
float map(float max, float min, int a, int CorR) {
  float temp1, temp2, result;
  temp1 = min - max;
  temp2 = (temp1 * a) / (CorR - 1);
  result = max + temp2;
  return result;
}


x86 assembly (clang, -O0):
<map>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
mulss  %xmm1,%xmm0
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<map>:
cvtsi2ss %edi,%xmm2
add    $0xffffffff,%esi
cvtsi2ss %esi,%xmm3
subss  %xmm0,%xmm1
mulss  %xmm1,%xmm2
divss  %xmm3,%xmm2
addss  %xmm2,%xmm0
ret

LLVM IR (-O0):
define float @map(float %0, float %1, i32 %2, i32 %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca i32
%8 = alloca i32
%9 = alloca float
%10 = alloca float
%11 = alloca float
store float %0, float* %5
store float %1, float* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%12 = load float, float* %6
%13 = load float, float* %5
%14 = fsub float %12, %13
store float %14, float* %9
%15 = load float, float* %9
%16 = load i32, i32* %7
%17 = sitofp i32 %16 to float
%18 = fmul float %15, %17
%19 = load i32, i32* %8
%20 = sub nsw i32 %19, 1
%21 = sitofp i32 %20 to float
%22 = fdiv float %18, %21
store float %22, float* %10
%23 = load float, float* %5
%24 = load float, float* %10
%25 = fadd float %23, %24
store float %25, float* %11
%26 = load float, float* %11
ret float %26
}

LLVM IR (-O2):
define float @map(float %0, float %1, i32 %2, i32 %3) {
%5 = fsub float %1, %0
%6 = sitofp i32 %2 to float
%7 = fmul float %5, %6
%8 = add nsw i32 %3, -1
%9 = sitofp i32 %8 to float
%10 = fdiv float %7, %9
%11 = fadd float %10, %0
ret float %11
}
/* Variables and functions */
int get(int /*<<< orphan*/, int *);
int main() {
  int stack_val = 5;
  int ret = get(0, &stack_val);
  return ret - 5;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x5,0x4(%rsp)
lea    0x4(%rsp),%rsi
xor    %edi,%edi
call   1030 <get@plt>
add    $0xfffffffb,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
%4 = call i32 @get(i32 0, i32* %2)
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = sub nsw i32 %5, 5
ret i32 %6
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%3 = call i32 @get(i32 0, i32* %1)
%4 = add nsw i32 %3, -5
ret i32 %4
}
swap(int *x, int *y) {
  int tep;
  tep = *x;
  *x = *y;
  *y = tep;
}


x86 assembly (clang, -O0):
<swap>:
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),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @swap(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 = load i32, i32* %7
store i32 %8, i32* %6
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
%11 = load i32*, i32** %4
store i32 %10, i32* %11
%12 = load i32, i32* %6
%13 = load i32*, i32** %5
store i32 %12, i32* %13
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @swap(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret i32 undef
}
int clQueue_opts(unsigned int i, unsigned int argc, char **argv) { return -1; }


x86 assembly (clang, -O0):
<clQueue_opts>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @clQueue_opts(i32 %0, i32 %1, i8** nocapture readnone %2) {
ret i32 -1
}
/* Variables and functions */
int SYS_gettid;
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%d\n", SYS_gettid);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@SYS_gettid = global i32 0
define i32 @main() {
%1 = load i32, i32* @SYS_gettid
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ O_RDWR;
int /*<<< orphan*/ close(int);
int open64(char const *, int /*<<< orphan*/);
int file_exists(const char *path) {
  int fd = open64(path, O_RDWR);
  if (fd > -1) {
    close(fd);
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1040 <open64@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jle    115f <file_exists+0x3f>
mov    -0x14(%rbp),%edi
call   1030 <close@plt>
movl   $0x1,-0x4(%rbp)
jmp    1166 <file_exists+0x46>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_exists>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
call   1040 <open64@plt>
test   %eax,%eax
js     1141 <file_exists+0x21>
mov    %eax,%edi
call   1030 <close@plt>
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@O_RDWR = global i32 0
define i32 @file_exists(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = load i32, i32* @O_RDWR
%7 = call i32 @open64(i8* %5, i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, -1
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i32, i32* %4
%12 = call i32 @close(i32 %11)
store i32 1, i32* %2
br label %14
13: ; preds = %1
store i32 0, i32* %2
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@O_RDWR = global i32 0
define i32 @file_exists(i8* nocapture %0) {
%2 = load i32, i32* @O_RDWR
%3 = tail call i32 @open64(i8* %0, i32 %2)
%4 = icmp sgt i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @close(i32 %3)
br label %7
7: ; preds = %1, %5
%8 = phi i32 [ 1, %5 ], [ 0, %1 ]
ret i32 %8
}
int ext2_init_acl(struct inode *inode, struct inode *dir) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.inode = type opaque
define i32 @ext2_init_acl(%struct.inode* nocapture readnone %0, %struct.inode* nocapture readnone %1) {
ret i32 0
}
unsigned long long int fib(int n) {
  int x, y;
  if (n < 2)
    return n;
  else {
#pragma omp task shared(x)
    x = fib(n - 1);
#pragma omp task shared(y)
    y = fib(n - 2);
#pragma omp taskwait
    return x + y;
  }
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1132 <fib+0x22>
movslq -0xc(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    115a <fib+0x4a>
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
cltq
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    $0x1,%edi
jg     1120 <fib+0x10>
movslq %ebx,%rax
jmp    113a <fib+0x2a>
lea    -0x1(%rbx),%edi
call   1030 <fib@plt>
mov    %rax,%r14
add    $0xfffffffe,%ebx
mov    %ebx,%edi
call   1030 <fib@plt>
add    %r14d,%eax
cltq
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i64 @fib(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
br label %5
5: ; preds = %3, %7
%6 = phi i64 [ %14, %7 ], [ %4, %3 ]
ret i64 %6
7: ; preds = %1
%8 = add nsw i32 %0, -1
%9 = tail call i64 @fib(i32 %8)
%10 = add nsw i32 %0, -2
%11 = tail call i64 @fib(i32 %10)
%12 = add i64 %11, %9
%13 = shl i64 %12, 32
%14 = ashr exact i64 %13, 32
br label %5
}
/* Variables and functions */
unsigned long long random();
int /*<<< orphan*/ srandom(unsigned int);
void ikrand_(int *ik, double *ikran) {
  unsigned long *likran;
  unsigned long long *llikran;
  srandom((unsigned int)*ik);
  if (sizeof(long long) > sizeof(double)) {
    likran = (unsigned long *)ikran;
    *likran = random();
  } else {
    llikran = (unsigned long long *)ikran;
    *llikran = random();
    *llikran <<= (8 * sizeof(unsigned long));
    *llikran |= random();
  }
}


x86 assembly (clang, -O0):
<ikrand_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <srandom@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1040 <random@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
mov    $0x40,%ecx
shl    %cl,%rdx
mov    %rdx,%rcx
mov    %rcx,(%rax)
mov    $0x0,%al
call   1040 <random@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
or     (%rax),%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ikrand_>:
push   %rbx
mov    %rsi,%rbx
mov    (%rdi),%edi
call   1030 <srandom@plt>
xor    %eax,%eax
call   1040 <random@plt>
xor    %eax,%eax
call   1040 <random@plt>
or     %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @ikrand_(i32* %0, double* %1) {
%3 = alloca i32*
%4 = alloca double*
%5 = alloca i64*
%6 = alloca i64*
store i32* %0, i32** %3
store double* %1, double** %4
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
%9 = call i32 @srandom(i32 %8)
%10 = load double*, double** %4
%11 = bitcast double* %10 to i64*
store i64* %11, i64** %6
%12 = call i64 (...) @random()
%13 = load i64*, i64** %6
store i64 %12, i64* %13
%14 = load i64*, i64** %6
%15 = load i64, i64* %14
%16 = shl i64 %15, 64
store i64 %16, i64* %14
%17 = call i64 (...) @random()
%18 = load i64*, i64** %6
%19 = load i64, i64* %18
%20 = or i64 %19, %17
store i64 %20, i64* %18
ret void
}

LLVM IR (-O2):
define void @ikrand_(i32* nocapture %0, double* nocapture %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @srandom(i32 %3)
%5 = bitcast double* %1 to i64*
%6 = tail call i64 (...) @random()
%7 = tail call i64 (...) @random()
%8 = load i64, i64* %5
%9 = or i64 %8, %7
store i64 %9, i64* %5
ret void
}
/* Variables and functions */
char *asnprintf(char *, ...);
int /*<<< orphan*/ free(char *);
int main() {
  char *str;
  str = asnprintf("%lld", 5);
  free(str);
  str =
      asnprintf("%s", "This string is much longer and will require a realloc");
  free(str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x5,%esi
mov    $0x0,%al
call   1040 <asnprintf@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
lea    0xeaf(%rip),%rdi
lea    0xeab(%rip),%rsi
mov    $0x0,%al
call   1040 <asnprintf@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <asnprintf@plt>
mov    %rax,%rdi
call   1030 <free@plt>
lea    0xec2(%rip),%rdi
lea    0xebe(%rip),%rsi
xor    %eax,%eax
call   1040 <asnprintf@plt>
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [54 x i8] c"This string is much longer and will require a realloc\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* (i8*, ...) @asnprintf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 5)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @free(i8* %4)
%6 = call i8* (i8*, ...) @asnprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
store i8* %6, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @free(i8* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%lld\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [54 x i8] c"This string is much longer and will require a realloc\00"
define i32 @main() {
%1 = tail call i8* (i8*, ...) @asnprintf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 5)
%2 = tail call i32 @free(i8* %1)
%3 = tail call i8* (i8*, ...) @asnprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @free(i8* %3)
ret i32 0
}
/* Variables and functions */
char *utf8_skip_char(char const *);
size_t utf8_strlen1(const char *s) {
  unsigned int l = 0;
  while (s[0]) {
    s = utf8_skip_char(s);
    l++;
  }
  return l;
}


x86 assembly (clang, -O0):
<utf8_strlen1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <utf8_strlen1+0x3b>
mov    -0x8(%rbp),%rdi
call   1030 <utf8_skip_char@plt>
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <utf8_strlen1+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8_strlen1>:
push   %rbx
xor    %ebx,%ebx
cmpb   $0x0,(%rdi)
je     1132 <utf8_strlen1+0x22>
mov    %rdi,%rax
nopl   0x0(%rax,%rax,1)
mov    %rax,%rdi
call   1030 <utf8_skip_char@plt>
add    $0x1,%ebx
cmpb   $0x0,(%rax)
jne    1120 <utf8_strlen1+0x10>
mov    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @utf8_strlen1(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = tail call i8* @utf8_skip_char(i8* %6)
%8 = add i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4
%12 = zext i32 %8 to i64
br label %13
13: ; preds = %11, %1
%14 = phi i64 [ 0, %1 ], [ %12, %11 ]
ret i64 %14
}
void Fatal(void) {
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<Fatal>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <Fatal+0x9>
jmp    1109 <Fatal+0x9>

x86 assembly (clang, -O2):
<Fatal>:
jmp    1100 <Fatal>

LLVM IR (-O0):
define void @Fatal() {
br label %1
1: ; preds = %1, %0
br label %1
}

LLVM IR (-O2):
define void @Fatal() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ gui_sidebar_key_pressed(unsigned char);
int /*<<< orphan*/ pic_send_EOI_normal(int);
unsigned char ps2_read();
void isr_irq_1() {
  unsigned char data = ps2_read();
  gui_sidebar_key_pressed(data);
  pic_send_EOI_normal(1);
}


x86 assembly (clang, -O0):
<isr_irq_1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <ps2_read@plt>
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1050 <gui_sidebar_key_pressed@plt>
mov    $0x1,%edi
call   1040 <pic_send_EOI_normal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isr_irq_1>:
push   %rax
xor    %eax,%eax
call   1030 <ps2_read@plt>
movzbl %al,%edi
call   1050 <gui_sidebar_key_pressed@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <pic_send_EOI_normal@plt>

LLVM IR (-O0):
define void @isr_irq_1() {
%1 = alloca i8
%2 = call zeroext i8 (...) @ps2_read()
store i8 %2, i8* %1
%3 = load i8, i8* %1
%4 = call i32 @gui_sidebar_key_pressed(i8 zeroext %3)
%5 = call i32 @pic_send_EOI_normal(i32 1)
ret void
}

LLVM IR (-O2):
define void @isr_irq_1() {
%1 = tail call zeroext i8 (...) @ps2_read()
%2 = tail call i32 @gui_sidebar_key_pressed(i8 zeroext %1)
%3 = tail call i32 @pic_send_EOI_normal(i32 1)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void DESReset(uint32_t ui32Base) {
  ASSERT(ui32Base == 0x44038000);
  (*((volatile uint32_t *)(ui32Base + 0x00000034))) |= 0x00000002;
  while (((*((volatile uint32_t *)(ui32Base + 0x00000038))) & 0x00000001) ==
         0) {
  }
}


x86 assembly (clang, -O0):
<DESReset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x44038000,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x4(%rbp),%eax
add    $0x34,%eax
cltq
mov    (%rax),%ecx
or     $0x2,%ecx
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
add    $0x38,%eax
cltq
mov    (%rax),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1159 <DESReset+0x49>
jmp    113e <DESReset+0x2e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DESReset>:
push   %rbx
mov    %edi,%ebx
xor    %edi,%edi
cmp    $0x44038000,%ebx
sete   %dil
call   1030 <ASSERT@plt>
movslq %ebx,%rax
orl    $0x2,0x34(%rax)
nopl   0x0(%rax,%rax,1)
testl  $0x1,0x38(%rax)
je     1130 <DESReset+0x20>
pop    %rbx
ret

LLVM IR (-O0):
define void @DESReset(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1141080064
%5 = zext i1 %4 to i32
%6 = call i32 @ASSERT(i32 %5)
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 52
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
%11 = load volatile i32, i32* %10
%12 = or i32 %11, 2
store volatile i32 %12, i32* %10
br label %13
13: ; preds = %21, %1
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 56
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
%18 = load volatile i32, i32* %17
%19 = and i32 %18, 1
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %13
br label %13
22: ; preds = %13
ret void
}

LLVM IR (-O2):
define void @DESReset(i32 %0) {
%2 = icmp eq i32 %0, 1141080064
%3 = zext i1 %2 to i32
%4 = tail call i32 @ASSERT(i32 %3)
%5 = add nsw i32 %0, 52
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = or i32 %8, 2
store volatile i32 %9, i32* %7
%10 = add nsw i32 %0, 56
%11 = sext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
br label %13
13: ; preds = %13, %1
%14 = load volatile i32, i32* %12
%15 = and i32 %14, 1
%16 = icmp eq i32 %15, 0
br i1 %16, label %13, label %17
17: ; preds = %13
ret void
}
void RTSha1Init(void) {}


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

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

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

LLVM IR (-O2):
define void @RTSha1Init() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ syscall2(int, int);
void exit(int exitcode) { syscall2(1, exitcode); }


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

x86 assembly (clang, -O2):
<exit>:
push   %rax
mov    %edi,%esi
mov    $0x1,%edi
call   1030 <syscall2@plt>

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

LLVM IR (-O2):
define void @exit(i32 %0) {
%2 = tail call i32 @syscall2(i32 1, i32 %0)
unreachable
}
/* Variables and functions */
scalar_t__ atof(char *);
int /*<<< orphan*/ skipSpace(char **);
scalar_t__ strspn(char *, char *);
float parseFloat(char **token) {
  skipSpace(token);
  float f = (float)atof(*token);
  *token += strspn(*token, "+-0123456789.");
  return f;
}


x86 assembly (clang, -O0):
<parseFloat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <skipSpace@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <atof@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
lea    0xe97(%rip),%rsi
call   1040 <strspn@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
movss  -0xc(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseFloat>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1050 <skipSpace@plt>
mov    (%r14),%rbx
mov    %rbx,%rdi
call   1030 <atof@plt>
cvtsi2ss %rax,%xmm0
movss  %xmm0,0x4(%rsp)
lea    0xea7(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strspn@plt>
add    %rbx,%rax
mov    %rax,(%r14)
movss  0x4(%rsp),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"+-0123456789.\00"
define float @parseFloat(i8** %0) {
%2 = alloca i8**
%3 = alloca float
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = call i32 @skipSpace(i8** %4)
%6 = load i8**, i8*** %2
%7 = load i8*, i8** %6
%8 = call i64 @atof(i8* %7)
%9 = sitofp i64 %8 to float
store float %9, float* %3
%10 = load i8**, i8*** %2
%11 = load i8*, i8** %10
%12 = call i64 @strspn(i8* %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%13 = load i8**, i8*** %2
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8, i8* %14, i64 %12
store i8* %15, i8** %13
%16 = load float, float* %3
ret float %16
}

LLVM IR (-O2):
@.str = [14 x i8] c"+-0123456789.\00"
define float @parseFloat(i8** %0) {
%2 = tail call i32 @skipSpace(i8** %0)
%3 = load i8*, i8** %0
%4 = tail call i64 @atof(i8* %3)
%5 = sitofp i64 %4 to float
%6 = tail call i64 @strspn(i8* %3, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = getelementptr inbounds i8, i8* %3, i64 %6
store i8* %7, i8** %0
ret float %5
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int dummy;
};

/* Variables and functions */
struct tm *gmtime(int /*<<< orphan*/ const *);
int /*<<< orphan*/ memcpy(struct tm *, struct tm *, int);
struct tm *gmtime_r(const time_t *timep, struct tm *tm) {
  struct tm *r;
  r = gmtime(timep);
  memcpy(tm, r, sizeof(*r));
  return tm;
}


x86 assembly (clang, -O0):
<gmtime_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <gmtime@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gmtime_r>:
push   %rbx
mov    %rsi,%rbx
call   1040 <gmtime@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define %struct.tm* @gmtime_r(i32* %0, %struct.tm* %1) {
%3 = alloca i32*
%4 = alloca %struct.tm*
%5 = alloca %struct.tm*
store i32* %0, i32** %3
store %struct.tm* %1, %struct.tm** %4
%6 = load i32*, i32** %3
%7 = call %struct.tm* @gmtime(i32* %6)
store %struct.tm* %7, %struct.tm** %5
%8 = load %struct.tm*, %struct.tm** %4
%9 = load %struct.tm*, %struct.tm** %5
%10 = call i32 @memcpy(%struct.tm* %8, %struct.tm* %9, i32 4)
%11 = load %struct.tm*, %struct.tm** %4
ret %struct.tm* %11
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define %struct.tm* @gmtime_r(i32* %0, %struct.tm* returned %1) {
%3 = tail call %struct.tm* @gmtime(i32* %0)
%4 = tail call i32 @memcpy(%struct.tm* %1, %struct.tm* %3, i32 4)
ret %struct.tm* %1
}
int ps8622_init(struct drm_device *dev, struct i2c_client *client,
                struct device_node *node) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.drm_device = type opaque
%struct.i2c_client = type opaque
%struct.device_node = type opaque
define i32 @ps8622_init(%struct.drm_device* %0, %struct.i2c_client* %1, %struct.device_node* %2) {
%4 = alloca %struct.drm_device*
%5 = alloca %struct.i2c_client*
%6 = alloca %struct.device_node*
store %struct.drm_device* %0, %struct.drm_device** %4
store %struct.i2c_client* %1, %struct.i2c_client** %5
store %struct.device_node* %2, %struct.device_node** %6
ret i32 0
}

LLVM IR (-O2):
%struct.drm_device = type opaque
%struct.i2c_client = type opaque
%struct.device_node = type opaque
define i32 @ps8622_init(%struct.drm_device* nocapture readnone %0, %struct.i2c_client* nocapture readnone %1, %struct.device_node* nocapture readnone %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exec(char *);
int /*<<< orphan*/ wait(int /*<<< orphan*/);
void test_main(void) { wait(exec("child-args childarg")); }


x86 assembly (clang, -O0):
<test_main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <exec@plt>
mov    %eax,%edi
call   1040 <wait@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <exec@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <wait@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"child-args childarg\00"
define void @test_main() {
%1 = call i32 @exec(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @wait(i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"child-args childarg\00"
define void @test_main() {
%1 = tail call i32 @exec(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @wait(i32 %1)
ret void
}