xunge/DecIR huggingface dataset:
void AsmDisposeMem() {}


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

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

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

LLVM IR (-O2):
define void @AsmDisposeMem() {
ret void
}
float test2f(float x) { return __builtin_cosf(x); }


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

x86 assembly (clang, -O2):
<test2f>:
jmp    1030 <cosf@plt>

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

LLVM IR (-O2):
define float @test2f(float %0) {
%2 = tail call float @cosf(float %0)
ret float %2
}
void f_blank_p2() { return; }


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

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

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

LLVM IR (-O2):
define void @f_blank_p2() {
ret void
}
/* Variables and functions */
int setresgid(int, int, int);
int setegid(int gid) { return setresgid(-1, gid, -1); }


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

x86 assembly (clang, -O2):
<setegid>:
mov    %edi,%esi
mov    $0xffffffff,%edi
mov    $0xffffffff,%edx
jmp    1030 <setresgid@plt>

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

LLVM IR (-O2):
define i32 @setegid(i32 %0) {
%2 = tail call i32 @setresgid(i32 -1, i32 %0, i32 -1)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
scalar_t__ fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int aiff_seek_to_sound_data(FILE *file_ptr) {
  if (fseek(file_ptr, 12 + 16, SEEK_SET) != 0)
    return (-1);
  return (0);
}


x86 assembly (clang, -O0):
<aiff_seek_to_sound_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2eb9(%rip),%rax
mov    (%rax),%edx
mov    $0x1c,%esi
call   1030 <fseek@plt>
cmp    $0x0,%rax
je     1149 <aiff_seek_to_sound_data+0x39>
movl   $0xffffffff,-0x4(%rbp)
jmp    1150 <aiff_seek_to_sound_data+0x40>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aiff_seek_to_sound_data>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edx
mov    $0x1c,%esi
call   1030 <fseek@plt>
neg    %rax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SEEK_SET = global i32 0
define i32 @aiff_seek_to_sound_data(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* @SEEK_SET
%6 = call i64 @fseek(i32* %4, i32 28, i32 %5)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %10
9: ; preds = %1
store i32 0, i32* %2
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@SEEK_SET = global i32 0
define i32 @aiff_seek_to_sound_data(i32* nocapture %0) {
%2 = load i32, i32* @SEEK_SET
%3 = tail call i64 @fseek(i32* %0, i32 28, i32 %2)
%4 = icmp ne i64 %3, 0
%5 = sext i1 %4 to i32
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int feof(int /*<<< orphan*/ *);
int img_stdio_feof(void *obj) {
  FILE *file = (FILE *)obj;
  return feof(file);
}


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

x86 assembly (clang, -O2):
<img_stdio_feof>:
jmp    1030 <feof@plt>

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

LLVM IR (-O2):
define i32 @img_stdio_feof(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @feof(i32* %2)
ret i32 %3
}
void cond_dummy_init(const struct XCSF *xcsf, struct Cl *c) {
  (void)xcsf;
  (void)c;
}


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

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

LLVM IR (-O0):
%struct.XCSF = type opaque
%struct.Cl = type opaque
define void @cond_dummy_init(%struct.XCSF* %0, %struct.Cl* %1) {
%3 = alloca %struct.XCSF*
%4 = alloca %struct.Cl*
store %struct.XCSF* %0, %struct.XCSF** %3
store %struct.Cl* %1, %struct.Cl** %4
%5 = load %struct.XCSF*, %struct.XCSF** %3
%6 = load %struct.Cl*, %struct.Cl** %4
ret void
}

LLVM IR (-O2):
%struct.XCSF = type opaque
%struct.Cl = type opaque
define void @cond_dummy_init(%struct.XCSF* nocapture %0, %struct.Cl* nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int inotify_add_watch(int fd, const char *name, uint32_t mask) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @inotify_add_watch(i32 %0, i8* nocapture readnone %1, i32 %2) {
ret i32 -1
}
/* Variables and functions */
int strerror_r(int, char *, size_t);
int posix_strerror(int errnum, char *buf, size_t buflen) {
  return strerror_r(errnum, buf, buflen);
}


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

x86 assembly (clang, -O2):
<posix_strerror>:
jmp    1030 <strerror_r@plt>

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

LLVM IR (-O2):
define i32 @posix_strerror(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 @strerror_r(i32 %0, i8* %1, i64 %2)
ret i32 %4
}
void Ctypes_hook_rd_sgn_s32(void) {}


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

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

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

LLVM IR (-O2):
define void @Ctypes_hook_rd_sgn_s32() {
ret void
}
/* Variables and functions */
char *malloc(long);
int /*<<< orphan*/ memcpy(char *, char *, long);
char *term(char *in, long size) {
  char *out = malloc(size + 1);
  if (!out)
    return NULL;
  memcpy(out, in, size);
  out[size] = '\0';
  return out;
}


x86 assembly (clang, -O0):
<term>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1159 <term+0x39>
movq   $0x0,-0x8(%rbp)
jmp    117e <term+0x5e>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<term>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x1(%rsi),%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     114f <term+0x2f>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1030 <memcpy@plt>
movb   $0x0,(%rbx,%r14,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @term(i8* %0, i64 %1) {
%3 = add nsw i64 %1, 1
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @memcpy(i8* %4, i8* %0, i64 %1)
%8 = getelementptr inbounds i8, i8* %4, i64 %1
store i8 0, i8* %8
br label %9
9: ; preds = %2, %6
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ TV_Shutdown(char const *);
void SV_Shutdown(const char *finalmsg) { TV_Shutdown(finalmsg); }


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

x86 assembly (clang, -O2):
<SV_Shutdown>:
jmp    1030 <TV_Shutdown@plt>

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

LLVM IR (-O2):
define void @SV_Shutdown(i8* %0) {
%2 = tail call i32 @TV_Shutdown(i8* %0)
ret void
}
/* Type definitions */
struct rblists {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct rblists *);
void rb_closelist(struct rblists *rblistp) {
  if (rblistp) {
    free(rblistp);
  }
}


x86 assembly (clang, -O0):
<rb_closelist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1130 <rb_closelist+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rb_closelist>:
test   %rdi,%rdi
je     111a <rb_closelist+0xa>
jmp    1030 <free@plt>
ret

LLVM IR (-O0):
%struct.rblists = type { i32 }
define void @rb_closelist(%struct.rblists* %0) {
%2 = alloca %struct.rblists*
store %struct.rblists* %0, %struct.rblists** %2
%3 = load %struct.rblists*, %struct.rblists** %2
%4 = icmp ne %struct.rblists* %3, null
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load %struct.rblists*, %struct.rblists** %2
%7 = call i32 @free(%struct.rblists* %6)
br label %8
8: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
%struct.rblists = type { i32 }
define void @rb_closelist(%struct.rblists* %0) {
%2 = icmp eq %struct.rblists* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(%struct.rblists* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
char *getcwd(char *, int);
char *getpwd(char *buf, int len) { return getcwd(buf, len); }


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

x86 assembly (clang, -O2):
<getpwd>:
jmp    1030 <getcwd@plt>

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

LLVM IR (-O2):
define i8* @getpwd(i8* %0, i32 %1) {
%3 = tail call i8* @getcwd(i8* %0, i32 %1)
ret i8* %3
}
/* Variables and functions */
int get_response(char *);
int /*<<< orphan*/ set_cr_noecho_mode();
int /*<<< orphan*/ set_nodelay_mode();
int /*<<< orphan*/ tty_mode(int);
int main(int argc, char *argv[]) {
  tty_mode(0);
  set_nodelay_mode();
  set_cr_noecho_mode();
  int response = get_response("Do you want another transaction");
  tty_mode(1);
  return response;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1060 <tty_mode@plt>
mov    $0x0,%al
call   1040 <set_nodelay_mode@plt>
mov    $0x0,%al
call   1050 <set_cr_noecho_mode@plt>
lea    0xe8e(%rip),%rdi
call   1030 <get_response@plt>
mov    %eax,-0x14(%rbp)
mov    $0x1,%edi
call   1060 <tty_mode@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1060 <tty_mode@plt>
xor    %eax,%eax
call   1040 <set_nodelay_mode@plt>
xor    %eax,%eax
call   1050 <set_cr_noecho_mode@plt>
lea    0xea3(%rip),%rdi
call   1030 <get_response@plt>
mov    %eax,%ebx
mov    $0x1,%edi
call   1060 <tty_mode@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Do you want another transaction\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @tty_mode(i32 0)
%8 = call i32 (...) @set_nodelay_mode()
%9 = call i32 (...) @set_cr_noecho_mode()
%10 = call i32 @get_response(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i32 %10, i32* %6
%11 = call i32 @tty_mode(i32 1)
%12 = load i32, i32* %6
ret i32 %12
}

LLVM IR (-O2):
@.str = [32 x i8] c"Do you want another transaction\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @tty_mode(i32 0)
%4 = tail call i32 (...) @set_nodelay_mode()
%5 = tail call i32 (...) @set_cr_noecho_mode()
%6 = tail call i32 @get_response(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @tty_mode(i32 1)
ret i32 %6
}
short SwapEndianness2(short val) {
  return ((val & 0xFF) << 8) | ((val & 0xFF00) >> 8);
}


x86 assembly (clang, -O0):
<SwapEndianness2>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%eax
and    $0xff,%eax
shl    $0x8,%eax
movswl -0x2(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<SwapEndianness2>:
mov    %edi,%eax
rol    $0x8,%ax
ret

LLVM IR (-O0):
define signext i16 @SwapEndianness2(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 255
%6 = shl i32 %5, 8
%7 = load i16, i16* %2
%8 = sext i16 %7 to i32
%9 = and i32 %8, 65280
%10 = ashr i32 %9, 8
%11 = or i32 %6, %10
%12 = trunc i32 %11 to i16
ret i16 %12
}

LLVM IR (-O2):
define signext i16 @SwapEndianness2(i16 signext %0) {
%2 = tail call i16 @llvm.bswap.i16(i16 %0)
ret i16 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printArray(int *a, int size) {
  for (int i = 0; i < size; i++)
    printf("%d ", a[i]);
}


x86 assembly (clang, -O0):
<printArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1157 <printArray+0x47>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printArray+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArray>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <printArray+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <printArray+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @printArray(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(int argc, char **argv) {
  fprintf(stderr,
          "Usage: %s read|write|reset ["
          "/dev/ucmb"
          "]\n",
          argv[0]);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [40 x i8] c"Usage: %s read|write|reset [/dev/ucmb]\0A\00"
define void @usage(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* @stderr
%6 = load i8**, i8*** %4
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %8)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [40 x i8] c"Usage: %s read|write|reset [/dev/ucmb]\0A\00"
define void @usage(i32 %0, i8** nocapture %1) {
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %1
%5 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}
void foo(int *n) {
  for (int i = 0; i < 32; i++) {
    int x = 0;
    x++;
    if (i & 4)
      x++;
    x++;
  }
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    1158 <foo+0x58>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    $0x4,%eax
cmp    $0x0,%eax
je     1141 <foo+0x41>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <foo+0xf>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @foo(i32* nocapture %0) {
ret void
}
/* Variables and functions */
int q();
int t(void) { return q() + 1; }


x86 assembly (clang, -O0):
<t>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <q@plt>
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<t>:
push   %rax
xor    %eax,%eax
call   1030 <q@plt>
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @t() {
%1 = call i32 (...) @q()
%2 = add nsw i32 %1, 1
ret i32 %2
}

LLVM IR (-O2):
define i32 @t() {
%1 = tail call i32 (...) @q()
%2 = add nsw i32 %1, 1
ret i32 %2
}
void disable_ints(void) { __asm__ volatile("cli" : : : "cc"); }


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

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

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

LLVM IR (-O2):
define void @disable_ints() {
tail call void asm sideeffect "cli", "~{cc},~{dirflag},~{fpsr},~{flags}"()
ret void
}
int cmd_drop_cid() { return 1; }


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

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

LLVM IR (-O0):
define i32 @cmd_drop_cid() {
ret i32 1
}

LLVM IR (-O2):
define i32 @cmd_drop_cid() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *const);
void func(const char *const str) { printf("%s\n", str); }


x86 assembly (clang, -O0):
<func>:
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):
<func>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @func(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ crypto_scalarmult(unsigned char *, unsigned char *,
                                     unsigned char *);
void crypto_scalarmult_bench(unsigned char *buf) {
  crypto_scalarmult(buf, buf + 32, buf + 64);
}


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

x86 assembly (clang, -O2):
<crypto_scalarmult_bench>:
lea    0x20(%rdi),%rsi
lea    0x40(%rdi),%rdx
jmp    1030 <crypto_scalarmult@plt>

LLVM IR (-O0):
define void @crypto_scalarmult_bench(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 32
%6 = load i8*, i8** %2
%7 = getelementptr inbounds i8, i8* %6, i64 64
%8 = call i32 @crypto_scalarmult(i8* %3, i8* %5, i8* %7)
ret void
}

LLVM IR (-O2):
define void @crypto_scalarmult_bench(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 32
%3 = getelementptr inbounds i8, i8* %0, i64 64
%4 = tail call i32 @crypto_scalarmult(i8* %0, i8* %2, i8* %3)
ret void
}
/* Variables and functions */
float __math_check_oflowf(float);
float check_oflowf(float x) { return 0 ? __math_check_oflowf(x) : x; }


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

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

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

LLVM IR (-O2):
define float @check_oflowf(float returned %0) {
ret float %0
}
/* Variables and functions */
int strcmp(char const *const, char const *const);
int gca_cmp_charptr(const void *aa, const void *bb) {
  const char *const a = *(const char *const *)aa;
  const char *const b = *(const char *const *)bb;
  return strcmp(a, b);
}


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

x86 assembly (clang, -O2):
<gca_cmp_charptr>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @gca_cmp_charptr(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i8**
%9 = load i8*, i8** %8
store i8* %9, i8** %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i8**
%12 = load i8*, i8** %11
store i8* %12, i8** %6
%13 = load i8*, i8** %5
%14 = load i8*, i8** %6
%15 = call i32 @strcmp(i8* %13, i8* %14)
ret i32 %15
}

LLVM IR (-O2):
define i32 @gca_cmp_charptr(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ XML_GetFeatureList();
int main() {
  XML_GetFeatureList();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @XML_GetFeatureList()
ret i32 0
}
/* Type definitions */
struct timeval {
  unsigned long tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
unsigned long clock_seconds(void) {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return tv.tv_sec;
}


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

x86 assembly (clang, -O2):
<clock_seconds>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i64 }
define i64 @clock_seconds() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i64, i64* %3
ret i64 %4
}

LLVM IR (-O2):
%struct.timeval = type { i64 }
define i64 @clock_seconds() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i64, i64* %4
ret i64 %5
}
void flierr(x, y, k) long double x, y;
int k;
{
  printf("Test %d: ", k + 1);
  printf("floorl(%.15Le) =?= %.15Le\n", x, y);
}


x86 assembly (clang, -O0):
<flierr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
mov    %edi,-0x24(%rbp)
mov    -0x24(%rbp),%esi
add    $0x1,%esi
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
fldt   -0x10(%rbp)
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  0x10(%rax)
fstpt  (%rax)
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flierr>:
sub    $0x38,%rsp
fldt   0x40(%rsp)
fstpt  0x2c(%rsp)
fldt   0x50(%rsp)
fstpt  0x20(%rsp)
lea    0x1(%rdi),%esi
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
fldt   0x20(%rsp)
fstpt  0x10(%rsp)
fldt   0x2c(%rsp)
fstpt  (%rsp)
lea    0xebf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Test %d: \00"
@.str.1 = [27 x i8] c"floorl(%.15Le) =?= %.15Le\0A\00"
define void @flierr(x86_fp80 %0, x86_fp80 %1, i32 %2) {
%4 = alloca x86_fp80
%5 = alloca x86_fp80
%6 = alloca i32
store x86_fp80 %0, x86_fp80* %4
store x86_fp80 %1, x86_fp80* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = add nsw i32 %7, 1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load x86_fp80, x86_fp80* %4
%11 = load x86_fp80, x86_fp80* %5
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %10, x86_fp80 %11)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Test %d: \00"
@.str.1 = [27 x i8] c"floorl(%.15Le) =?= %.15Le\0A\00"
define void @flierr(x86_fp80 %0, x86_fp80 %1, i32 %2) {
%4 = add nsw i32 %2, 1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), x86_fp80 %0, x86_fp80 %1)
ret void
}
int bar(float x) { return 2241; }


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

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

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

LLVM IR (-O2):
define i32 @bar(float %0) {
ret i32 2241
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
void erreur_nbJ(int nbJ) {
  printf("Le nombre de mises à jours nbJ n'est pas positif: %d\n", nbJ);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<erreur_nbJ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<erreur_nbJ>:
push   %rax
mov    %edi,%esi
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [55 x i8] c"Le nombre de mises \C3\A0 jours nbJ n'est pas positif: %d\0A\00"
@EXIT_FAILURE = global i32 0
define void @erreur_nbJ(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @EXIT_FAILURE
%6 = call i32 @exit(i32 %5)
unreachable
}

LLVM IR (-O2):
@.str = [55 x i8] c"Le nombre de mises \C3\A0 jours nbJ n'est pas positif: %d\0A\00"
@EXIT_FAILURE = global i32 0
define void @erreur_nbJ(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
int next(int a[], int n, int i) {
  if (i == n)
    i = 0;
  else
    i++;
  while (a[i] == 0) {
    i++;
    if (i == n) {
      i = 0;
    }
  }
  return i;
}


x86 assembly (clang, -O0):
<next>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1126 <next+0x26>
movl   $0x0,-0x10(%rbp)
jmp    112f <next+0x2f>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <next+0x34>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1167 <next+0x67>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    1162 <next+0x62>
movl   $0x0,-0x10(%rbp)
jmp    1134 <next+0x34>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next>:
lea    0x1(%rdx),%eax
xor    %ecx,%ecx
cmp    %esi,%edx
nopw   0x0(%rax,%rax,1)
cmove  %ecx,%eax
movslq %eax,%rdx
cmpl   $0x0,(%rdi,%rdx,4)
jne    1123 <next+0x23>
add    $0x1,%eax
cmp    %esi,%eax
jmp    1110 <next+0x10>
ret

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

LLVM IR (-O2):
define i32 @next(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %2, %1
%5 = add nsw i32 %2, 1
%6 = select i1 %4, i32 0, i32 %5
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %3, %11
%12 = phi i32 [ %15, %11 ], [ %6, %3 ]
%13 = add nsw i32 %12, 1
%14 = icmp eq i32 %13, %1
%15 = select i1 %14, i32 0, i32 %13
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %0, i64 %16
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, 0
br i1 %19, label %11, label %20
20: ; preds = %11, %3
%21 = phi i32 [ %6, %3 ], [ %15, %11 ]
ret i32 %21
}
/* Type definitions */
typedef int /*<<< orphan*/ command;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
int /*<<< orphan*/ stdout;
void textcolor_bg(int bg) {
  char command[64];
  snprintf(command, sizeof(command), "\033[%dm", bg + 40);
  fprintf(stdout, "%s", command);
  fflush(stdout);
}


x86 assembly (clang, -O0):
<textcolor_bg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x4(%rbp),%ecx
add    $0x28,%ecx
mov    $0x40,%esi
lea    0xeaf(%rip),%rdx
call   1030 <snprintf@plt>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
lea    -0x50(%rbp),%rdx
lea    0xe9c(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<textcolor_bg>:
push   %r14
push   %rbx
sub    $0x48,%rsp
lea    0x28(%rdi),%ecx
lea    0xebf(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x40,%esi
call   1030 <snprintf@plt>
mov    0x2e88(%rip),%rbx
mov    (%rbx),%edi
lea    0xea5(%rip),%rsi
mov    %r14,%rdx
call   1040 <fprintf@plt>
mov    (%rbx),%edi
call   1050 <fflush@plt>
add    $0x48,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[%dm\00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"%s\00"
define void @textcolor_bg(i32 %0) {
%2 = alloca i32
%3 = alloca [64 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 40
%7 = call i32 @snprintf(i8* %4, i32 64, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @stdout
%9 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%10 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @stdout
%12 = call i32 @fflush(i32 %11)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[%dm\00"
@stdout = global i32 0
@.str.1 = [3 x i8] c"%s\00"
define void @textcolor_bg(i32 %0) {
%2 = alloca [64 x i8]
%3 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%4 = add nsw i32 %0, 40
%5 = call i32 @snprintf(i8* %3, i32 64, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32, i32* @stdout
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%8 = load i32, i32* @stdout
%9 = call i32 @fflush(i32 %8)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int __syscall_kill(int /*<<< orphan*/, int);
int kill(pid_t pid, int sig) { return (__syscall_kill(pid, sig)); }


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

x86 assembly (clang, -O2):
<kill>:
jmp    1030 <__syscall_kill@plt>

LLVM IR (-O0):
define i32 @kill(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 @__syscall_kill(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @kill(i32 %0, i32 %1) {
%3 = tail call i32 @__syscall_kill(i32 %0, i32 %1)
ret i32 %3
}
int NESGetOffset(int x, int y, int width) { return ((y * width) + x); }


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

x86 assembly (clang, -O2):
<NESGetOffset>:
imul   %edx,%esi
lea    (%rsi,%rdi,1),%eax
ret

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

LLVM IR (-O2):
define i32 @NESGetOffset(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %2, %1
%5 = add nsw i32 %4, %0
ret i32 %5
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ _nvram_buf_del(char *, char *);
int nvram_commit(int /*<<< orphan*/);
int32_t nvram_del(char *section, char *key) {
  ;
  if ((0) == _nvram_buf_del(section, key))
    return nvram_commit(0);
  return (-1);
}


x86 assembly (clang, -O0):
<nvram_del>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <_nvram_buf_del@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
jne    1158 <nvram_del+0x38>
xor    %edi,%edi
call   1030 <nvram_commit@plt>
mov    %eax,-0x4(%rbp)
jmp    115f <nvram_del+0x3f>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nvram_del>:
push   %rax
call   1040 <_nvram_buf_del@plt>
test   %eax,%eax
je     1131 <nvram_del+0x11>
mov    $0xffffffff,%eax
pop    %rcx
ret
xor    %edi,%edi
pop    %rax
jmp    1030 <nvram_commit@plt>

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

LLVM IR (-O2):
define i32 @nvram_del(i8* %0, i8* %1) {
%3 = tail call i32 @_nvram_buf_del(i8* %0, i8* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @nvram_commit(i32 0)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ -1, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ outop2str(char *);
void outlea() { outop2str("LEA"); }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"LEA\00"
define void @outlea() {
%1 = call i32 @outop2str(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"LEA\00"
define void @outlea() {
%1 = tail call i32 @outop2str(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void giveup(char *msg) {
  fprintf(stderr, "balance: %s\n", msg);
  exit(1);
}


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

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [13 x i8] c"balance: %s\0A\00"
define void @giveup(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
scalar_t__ EOF;
scalar_t__ getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char const *argv[]) {
  printf("press any key plz \n");
  printf("getchar() != EOF is %d\n", getchar() != EOF);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    0x2e96(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
and    $0x1,%al
movzbl %al,%esi
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    0x2e9d(%rip),%rcx
xor    %esi,%esi
cmp    (%rcx),%rax
setne  %sil
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"press any key plz \0A\00"
@.str.1 = [27 x i8] c"getchar()\C2\A0!=\C2\A0EOF is\C2\A0%d\0A\00"
@EOF = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%7 = call i64 (...) @getchar()
%8 = load i64, i64* @EOF
%9 = icmp ne i64 %7, %8
%10 = zext i1 %9 to i32
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [27 x i8] c"getchar()\C2\A0!=\C2\A0EOF is\C2\A0%d\0A\00"
@EOF = global i64 0
@str = [19 x i8] c"press any key plz \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%4 = tail call i64 (...) @getchar()
%5 = load i64, i64* @EOF
%6 = icmp ne i64 %4, %5
%7 = zext i1 %6 to i32
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ do_uninit_read(int *);
void uninit_test3(int *val_p) { do_uninit_read(val_p); }


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

x86 assembly (clang, -O2):
<uninit_test3>:
jmp    1030 <do_uninit_read@plt>

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

LLVM IR (-O2):
define void @uninit_test3(i32* %0) {
%2 = tail call i32 @do_uninit_read(i32* %0)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint64_t;

/* Variables and functions */
void to_be_array(uint8_t *result, const uint64_t src) {
  for (size_t i = 0; i < 8; ++i) {
    result[7 - i] = (src >> (8 * i)) & 0xFF;
  }
}


x86 assembly (clang, -O0):
<to_be_array>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x8,-0x18(%rbp)
jae    1154 <to_be_array+0x54>
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%ecx
sar    %cl,%edx
and    $0xff,%edx
mov    -0x8(%rbp),%rax
mov    $0x7,%ecx
sub    -0x18(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1113 <to_be_array+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_be_array>:
mov    %esi,%eax
movzbl %al,%ecx
mov    %ecx,0x1c(%rdi)
movzbl %ah,%ecx
mov    %ecx,0x18(%rdi)
mov    %esi,%ecx
shr    $0x10,%ecx
movzbl %cl,%ecx
mov    %ecx,0x14(%rdi)
shr    $0x18,%eax
mov    %eax,0x10(%rdi)
ret

LLVM IR (-O0):
define void @to_be_array(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i64
store i32* %0, i32** %3
store i32 %1, i32* %4
store i64 0, i64* %5
br label %6
6: ; preds = %20, %2
%7 = load i64, i64* %5
%8 = icmp ult i64 %7, 8
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load i32, i32* %4
%11 = load i64, i64* %5
%12 = mul i64 8, %11
%13 = trunc i64 %12 to i32
%14 = ashr i32 %10, %13
%15 = and i32 %14, 255
%16 = load i32*, i32** %3
%17 = load i64, i64* %5
%18 = sub i64 7, %17
%19 = getelementptr inbounds i32, i32* %16, i64 %18
store i32 %15, i32* %19
br label %20
20: ; preds = %9
%21 = load i64, i64* %5
%22 = add i64 %21, 1
store i64 %22, i64* %5
br label %6
23: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @to_be_array(i32* nocapture writeonly %0, i32 %1) {
%3 = and i32 %1, 255
%4 = getelementptr inbounds i32, i32* %0, i64 7
store i32 %3, i32* %4
%5 = lshr i32 %1, 8
%6 = and i32 %5, 255
%7 = getelementptr inbounds i32, i32* %0, i64 6
store i32 %6, i32* %7
%8 = lshr i32 %1, 16
%9 = and i32 %8, 255
%10 = getelementptr inbounds i32, i32* %0, i64 5
store i32 %9, i32* %10
%11 = lshr i32 %1, 24
%12 = getelementptr inbounds i32, i32* %0, i64 4
store i32 %11, i32* %12
ret void
}