xunge/DecIR huggingface dataset:
int inzcont(fields, nfields)
register char **fields;
int nfields;
{
  if (nfields < 3 || nfields > 7) {
    error("wrong number of fields on Zone continuation line");
    return 0;
  }
  return inzsub(fields, nfields, 1);
}


x86 assembly (clang, -O0):
<inzcont>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x3,-0x14(%rbp)
jl     1143 <inzcont+0x23>
cmpl   $0x7,-0x14(%rbp)
jle    115d <inzcont+0x3d>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1040 <error@plt>
movl   $0x0,-0x4(%rbp)
jmp    1173 <inzcont+0x53>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    $0x1,%edx
mov    $0x0,%al
call   1030 <inzsub@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inzcont>:
lea    -0x8(%rsi),%eax
cmp    $0xfffffffa,%eax
ja     113b <inzcont+0x1b>
push   %rax
lea    0xed0(%rip),%rdi
xor    %eax,%eax
call   1040 <error@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    $0x1,%edx
xor    %eax,%eax
jmp    1030 <inzsub@plt>

LLVM IR (-O0):
@.str = [49 x i8] c"wrong number of fields on Zone continuation line\00"
define i32 @inzcont(i8** %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i8** %0, i8*** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp slt i32 %6, 3
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp sgt i32 %9, 7
br i1 %10, label %11, label %13
11: ; preds = %8, %2
%12 = call i32 (i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %17
13: ; preds = %8
%14 = load i8**, i8*** %4
%15 = load i32, i32* %5
%16 = call i32 (i8**, i32, i32, ...) bitcast (i32 (...)* @inzsub to i32 (i8**, i32, i32, ...)*)(i8** %14, i32 %15, i32 1)
store i32 %16, i32* %3
br label %17
17: ; preds = %13, %11
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@.str = [49 x i8] c"wrong number of fields on Zone continuation line\00"
define i32 @inzcont(i8** %0, i32 %1) {
%3 = add i32 %1, -8
%4 = icmp ult i32 %3, -5
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @error to i32 (i8*, ...)*)(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
br label %9
7: ; preds = %2
%8 = tail call i32 (i8**, i32, i32, ...) bitcast (i32 (...)* @inzsub to i32 (i8**, i32, i32, ...)*)(i8** %0, i32 %1, i32 1)
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ 0, %5 ], [ %8, %7 ]
ret i32 %10
}
double inv_q30_to_double(long q30) { return (double)q30 / ((double)(1 << 30)); }


x86 assembly (clang, -O0):
<inv_q30_to_double>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
movsd  0xeea(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<inv_q30_to_double>:
cvtsi2sd %rdi,%xmm0
mulsd  0xef3(%rip),%xmm0
ret

LLVM IR (-O0):
define double @inv_q30_to_double(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = sitofp i64 %3 to double
%5 = fdiv double %4, 0x41D0000000000000
ret double %5
}

LLVM IR (-O2):
define double @inv_q30_to_double(i64 %0) {
%2 = sitofp i64 %0 to double
%3 = fmul double %2, 0x3E10000000000000
ret double %3
}
int main() {
  float angle = 90;
  float radian, cosine, sine;
  radian = angle / 180 * 3.14159;
  asm("fsincos" : "=t"(cosine), "=u"(sine) : "0"(radian));
  printf("The cosine is %f, and the sine is %f\n", cosine, sine);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xee5(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  0xecf(%rip),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb7(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
flds   -0x18(%rbp)
fsincos
fxch   %st(1)
fstps  -0x20(%rbp)
fstps  -0x1c(%rbp)
movss  -0x20(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
movss  %xmm1,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe76(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
flds   0xee6(%rip)
fsincos
fstpl  0x10(%rsp)
movsd  0x10(%rsp),%xmm0
fstpl  0x8(%rsp)
movsd  0x8(%rsp),%xmm1
lea    0xecd(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"The cosine is %f, and the sine is %f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
store i32 0, i32* %1
store float 9.000000e+01, float* %2
%6 = load float, float* %2
%7 = fdiv float %6, 1.800000e+02
%8 = fpext float %7 to double
%9 = fmul double %8, 3.141590e+00
%10 = fptrunc double %9 to float
store float %10, float* %3
%11 = load float, float* %3
%12 = call { float, float } asm "fsincos", "={st},={st(1)},0,~{dirflag},~{fpsr},~{flags}"(float %11)
%13 = extractvalue { float, float } %12, 0
%14 = extractvalue { float, float } %12, 1
store float %13, float* %4
store float %14, float* %5
%15 = load float, float* %4
%16 = fpext float %15 to double
%17 = load float, float* %5
%18 = fpext float %17 to double
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), double %16, double %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"The cosine is %f, and the sine is %f\0A\00"
define i32 @main() {
%1 = tail call { float, float } asm "fsincos", "={st},={st(1)},0,~{dirflag},~{fpsr},~{flags}"(float 0x3FF921FA00000000)
%2 = extractvalue { float, float } %1, 0
%3 = extractvalue { float, float } %1, 1
%4 = fpext float %2 to double
%5 = fpext float %3 to double
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), double %4, double %5)
ret i32 0
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  int /*<<< orphan*/ fts_name;
};
typedef TYPE_1__ FTSENT;

/* Variables and functions */
int strcoll(int /*<<< orphan*/, int /*<<< orphan*/);
int find_compare(const FTSENT *const *s1, const FTSENT *const *s2) {
  return (strcoll((*s1)->fts_name, (*s2)->fts_name));
}


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

x86 assembly (clang, -O2):
<find_compare>:
mov    (%rdi),%rax
mov    (%rax),%edi
mov    (%rsi),%rax
mov    (%rax),%esi
jmp    1030 <strcoll@plt>

LLVM IR (-O0):
%struct.TYPE_4__ = type { i32 }
define i32 @find_compare(%struct.TYPE_4__** %0, %struct.TYPE_4__** %1) {
%3 = alloca %struct.TYPE_4__**
%4 = alloca %struct.TYPE_4__**
store %struct.TYPE_4__** %0, %struct.TYPE_4__*** %3
store %struct.TYPE_4__** %1, %struct.TYPE_4__*** %4
%5 = load %struct.TYPE_4__**, %struct.TYPE_4__*** %3
%6 = load %struct.TYPE_4__*, %struct.TYPE_4__** %5
%7 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = load %struct.TYPE_4__**, %struct.TYPE_4__*** %4
%10 = load %struct.TYPE_4__*, %struct.TYPE_4__** %9
%11 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @strcoll(i32 %8, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.TYPE_4__ = type { i32 }
define i32 @find_compare(%struct.TYPE_4__** nocapture %0, %struct.TYPE_4__** nocapture %1) {
%3 = load %struct.TYPE_4__*, %struct.TYPE_4__** %0
%4 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %3, i64 0, i32 0
%5 = load i32, i32* %4
%6 = load %struct.TYPE_4__*, %struct.TYPE_4__** %1
%7 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %6, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i32 @strcoll(i32 %5, i32 %8)
ret i32 %9
}
int strfetch(s, i)
char *s;
{ return (s[i - 1]); }


x86 assembly (clang, -O0):
<strfetch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strfetch>:
movslq %esi,%rax
movsbl -0x1(%rax,%rdi,1),%eax
ret

LLVM IR (-O0):
define i32 @strfetch(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 = sub nsw i32 %6, 1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %5, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @strfetch(i8* nocapture %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
ret i32 %7
}
int main(void) {
  int *a;
  int b[4];
  a[4] = b[3];
  return 0;
}


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

x86 assembly (clang, -O2):
LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [4 x i32]
store i32 0, i32* %1
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %3, i64 0, i64 3
%5 = load i32, i32* %4
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 4
store i32 %5, i32* %7
ret i32 0
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void clearCommand() { system("clear"); }


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

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

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

LLVM IR (-O2):
@.str = [6 x i8] c"clear\00"
define void @clearCommand() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
rstofill() { printf(".%d\n", 35); }


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

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

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

LLVM IR (-O2):
@.str = [5 x i8] c".%d\0A\00"
define i32 @rstofill() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 35)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void cli_print_pad(int cnt) {
  for (int i = 0; i < cnt; i++) {
    printf(" ");
  }
}


x86 assembly (clang, -O0):
<cli_print_pad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1148 <cli_print_pad+0x38>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <cli_print_pad+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_print_pad>:
push   %rbx
test   %edi,%edi
jle    112f <cli_print_pad+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <cli_print_pad+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @cli_print_pad(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %4, label %3
3: ; preds = %4, %1
ret void
4: ; preds = %1, %4
%5 = phi i32 [ %7, %4 ], [ 0, %1 ]
%6 = tail call i32 @putchar(i32 32)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, %0
br i1 %8, label %3, label %4
}
/* Type definitions */
typedef char GLubyte;
typedef scalar_t__ GLenum;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
scalar_t__ glad_glGetError();
char *gluErrorString(scalar_t__);
int /*<<< orphan*/ stderr;
void check_error() {
  GLenum err = glad_glGetError();
  if (err != 0) {
    const GLubyte *err_desc = gluErrorString(err);
    fprintf(stderr, "OpenGL error: %s", err_desc);
  }
}


x86 assembly (clang, -O0):
<check_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <glad_glGetError@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1174 <check_error+0x44>
mov    -0x8(%rbp),%rdi
call   1040 <gluErrorString@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe91(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_error>:
push   %rax
xor    %eax,%eax
call   1050 <glad_glGetError@plt>
test   %rax,%rax
je     115e <check_error+0x2e>
mov    %rax,%rdi
call   1040 <gluErrorString@plt>
mov    0x2e94(%rip),%rcx
mov    (%rcx),%edi
lea    0xeab(%rip),%rsi
mov    %rax,%rdx
pop    %rax
jmp    1030 <fprintf@plt>
pop    %rax
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"OpenGL error: %s\00"
define void @check_error() {
%1 = alloca i64
%2 = alloca i8*
%3 = call i64 (...) @glad_glGetError()
store i64 %3, i64* %1
%4 = load i64, i64* %1
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %0
%7 = load i64, i64* %1
%8 = call i8* @gluErrorString(i64 %7)
store i8* %8, i8** %2
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %2
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %6, %0
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"OpenGL error: %s\00"
define void @check_error() {
%1 = tail call i64 (...) @glad_glGetError()
%2 = icmp eq i64 %1, 0
br i1 %2, label %7, label %3
3: ; preds = %0
%4 = tail call i8* @gluErrorString(i64 %1)
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %4)
br label %7
7: ; preds = %3, %0
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ length;
};
typedef TYPE_1__ XIMText;

/* Variables and functions */
unsigned short get_XIMText_length(void *_p) {
  return (unsigned short)((XIMText *)_p)->length;
}


x86 assembly (clang, -O0):
<get_XIMText_length>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_XIMText_length>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i64 }
define zeroext i16 @get_XIMText_length(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_2__*
%5 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %4, i32 0, i32 0
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i16
ret i16 %7
}

LLVM IR (-O2):
define zeroext i16 @get_XIMText_length(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i16
ret i16 %4
}
int roundUp(int numToRound, int multiple) {
  if (multiple == 0) {
    return numToRound;
  }
  int remainder = numToRound % multiple;
  if (remainder == 0) {
    return numToRound;
  }
  return numToRound + multiple - remainder;
}


x86 assembly (clang, -O0):
<roundUp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    111f <roundUp+0x1f>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114a <roundUp+0x4a>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    113e <roundUp+0x3e>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114a <roundUp+0x4a>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<roundUp>:
test   %esi,%esi
je     1112 <roundUp+0x12>
mov    %edi,%eax
cltd
idiv   %esi
add    %edi,%esi
sub    %edx,%esi
test   %edx,%edx
cmovne %esi,%edi
mov    %edi,%eax
ret

LLVM IR (-O0):
define i32 @roundUp(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* %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %4
store i32 %10, i32* %3
br label %25
11: ; preds = %2
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = srem i32 %12, %13
store i32 %14, i32* %6
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %11
%18 = load i32, i32* %4
store i32 %18, i32* %3
br label %25
19: ; preds = %11
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = add nsw i32 %20, %21
%23 = load i32, i32* %6
%24 = sub nsw i32 %22, %23
store i32 %24, i32* %3
br label %25
25: ; preds = %19, %17, %9
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @roundUp(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = srem i32 %0, %1
%6 = icmp eq i32 %5, 0
%7 = add nsw i32 %1, %0
%8 = sub i32 %7, %5
%9 = select i1 %6, i32 %0, i32 %8
br label %10
10: ; preds = %2, %4
%11 = phi i32 [ %9, %4 ], [ %0, %2 ]
ret i32 %11
}
void __attribute__((no)) bar(int *p) { asm volatile("" : : "r"(p) : "memory"); }


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

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

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

LLVM IR (-O2):
define void @bar(i32* %0) {
tail call void asm sideeffect "", "r,~{memory},~{dirflag},~{fpsr},~{flags}"(i32* %0)
ret void
}
__attribute__((__no__)) int add512(int a, int *b) {
  int c = a + 512;
  if (c != 0)
    *b = a;
  return c;
}


x86 assembly (clang, -O0):
<add512>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x200,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1129 <add512+0x29>
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<add512>:
mov    %edi,%eax
add    $0x200,%eax
je     110b <add512+0xb>
mov    %edi,(%rsi)
ret

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

LLVM IR (-O2):
define i32 @add512(i32 %0, i32* nocapture writeonly %1) {
%3 = add nsw i32 %0, 512
%4 = icmp eq i32 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %2
store i32 %0, i32* %1
br label %6
6: ; preds = %5, %2
ret i32 %3
}
/* Variables and functions */
int anetWriteWidthType(int, char *, int, int, int /*<<< orphan*/);
int catAnetBlockWrite(int fd, char *buf, int count) {
  return anetWriteWidthType(fd, buf, count, 1, 0);
}


x86 assembly (clang, -O0):
<catAnetBlockWrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1030 <anetWriteWidthType@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<catAnetBlockWrite>:
mov    $0x1,%ecx
xor    %r8d,%r8d
jmp    1030 <anetWriteWidthType@plt>

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

LLVM IR (-O2):
define i32 @catAnetBlockWrite(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @anetWriteWidthType(i32 %0, i8* %1, i32 %2, i32 1, i32 0)
ret i32 %4
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void MPURegionDisable(uint32_t ui32Region) {
  ;
  (*((volatile uint32_t *)(0xE000ED98))) = ui32Region;
  (*((volatile uint32_t *)(0xE000EDA0))) &= ~0x00000001;
}


x86 assembly (clang, -O0):
<MPURegionDisable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0xe000ed98,%eax
mov    %ecx,(%rax)
mov    $0xe000eda0,%eax
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
mov    $0xe000eda0,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<MPURegionDisable>:
mov    $0xe000eda0,%eax
mov    %edi,-0x8(%rax)
andl   $0xfffffffe,(%rax)
ret

LLVM IR (-O0):
define void @MPURegionDisable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
store volatile i32 %3, i32* inttoptr (i64 3758157208 to i32*)
%4 = load volatile i32, i32* inttoptr (i64 3758157216 to i32*)
%5 = and i32 %4, -2
store volatile i32 %5, i32* inttoptr (i64 3758157216 to i32*)
ret void
}

LLVM IR (-O2):
define void @MPURegionDisable(i32 %0) {
store volatile i32 %0, i32* inttoptr (i64 3758157208 to i32*)
%2 = load volatile i32, i32* inttoptr (i64 3758157216 to i32*)
%3 = and i32 %2, -2
store volatile i32 %3, i32* inttoptr (i64 3758157216 to i32*)
ret void
}
int addimmhi3(int a) { return a + 50; }


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

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

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

LLVM IR (-O2):
define i32 @addimmhi3(i32 %0) {
%2 = add nsw i32 %0, 50
ret i32 %2
}
unsigned int __attribute__((warn_unused_result))
__kfifo_uint_must_check_helper(unsigned int val) {
  return val;
}


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

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

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

LLVM IR (-O2):
define i32 @__kfifo_uint_must_check_helper(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ checkHeap();
char *malloc(int);
void offEndCheck() {
  char *p = malloc(10);
  p[10] = 7;
  checkHeap();
}


x86 assembly (clang, -O0):
<offEndCheck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x7,0xa(%rax)
mov    $0x0,%al
call   1040 <checkHeap@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @offEndCheck() {
%1 = alloca i8*
%2 = call i8* @malloc(i32 10)
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = getelementptr inbounds i8, i8* %3, i64 10
store i8 7, i8* %4
%5 = call i32 (...) @checkHeap()
ret void
}

LLVM IR (-O2):
define void @offEndCheck() {
%1 = tail call i32 (...) @checkHeap()
ret void
}
__typeof__(islower((void *)1)) test_islower_39(void) {
  return islower((void *)1);
}


x86 assembly (clang, -O0):
<test_islower_39>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
mov    %eax,%edi
call   1030 <islower@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_islower_39() {
%1 = call i32 @islower(i32 ptrtoint (i8* inttoptr (i64 1 to i8*) to i32))
ret i32 %1
}

LLVM IR (-O2):
define i32 @test_islower_39() {
%1 = tail call i32 @islower(i32 1)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ free(int *);
int *malloc(int);
int main(void) {
  int *p = malloc(sizeof(int));
  *(p - 1) = -1;
  free(p);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
movl   $0xffffffff,-0x4(%rax)
mov    %rax,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
store i32 0, i32* %1
%3 = call i32* @malloc(i32 4)
store i32* %3, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 -1
store i32 -1, i32* %5
%6 = load i32*, i32** %2
%7 = call i32 @free(i32* %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* @malloc(i32 4)
%2 = getelementptr inbounds i32, i32* %1, i64 -1
store i32 -1, i32* %2
%3 = tail call i32 @free(i32* %1)
ret i32 0
}
/* Variables and functions */
int cpu_read8(int);
int cpu_read16(int adr) { return cpu_read8(adr) | (cpu_read8(adr + 1) << 8); }


x86 assembly (clang, -O0):
<cpu_read16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <cpu_read8@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1030 <cpu_read8@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
shl    $0x8,%ecx
or     %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpu_read16>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <cpu_read8@plt>
mov    %eax,%ebp
add    $0x1,%ebx
mov    %ebx,%edi
call   1030 <cpu_read8@plt>
shl    $0x8,%eax
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cpu_read16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @cpu_read8(i32 %3)
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 1
%7 = call i32 @cpu_read8(i32 %6)
%8 = shl i32 %7, 8
%9 = or i32 %4, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @cpu_read16(i32 %0) {
%2 = tail call i32 @cpu_read8(i32 %0)
%3 = add nsw i32 %0, 1
%4 = tail call i32 @cpu_read8(i32 %3)
%5 = shl i32 %4, 8
%6 = or i32 %5, %2
ret i32 %6
}
int return_result(en)
int en;
{ return list_sub(en); }


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

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

LLVM IR (-O0):
define i32 @return_result(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i32, ...) bitcast (i32 (...)* @list_sub to i32 (i32, ...)*)(i32 %3)
ret i32 %4
}

LLVM IR (-O2):
define i32 @return_result(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @list_sub to i32 (i32, ...)*)(i32 %0)
ret i32 %2
}
/* Variables and functions */
int rand();
int gb_rand(void) { return rand(); }


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

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

LLVM IR (-O0):
define i32 @gb_rand() {
%1 = call i32 (...) @rand()
ret i32 %1
}

LLVM IR (-O2):
define i32 @gb_rand() {
%1 = tail call i32 (...) @rand()
ret i32 %1
}
void SteamAPI_ISteamHTMLSurface_MouseMove(void *self) {
  xlogf("%s(self = %p)\n", __func__, self);
}


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

x86 assembly (clang, -O2):
<SteamAPI_ISteamHTMLSurface_MouseMove>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xeee(%rip),%rsi
xor    %eax,%eax
jmp    1030 <xlogf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamHTMLSurface_MouseMove = [37 x i8] c"SteamAPI_ISteamHTMLSurface_MouseMove\00"
define void @SteamAPI_ISteamHTMLSurface_MouseMove(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @__func__.SteamAPI_ISteamHTMLSurface_MouseMove, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s(self = %p)\0A\00"
@__func__.SteamAPI_ISteamHTMLSurface_MouseMove = [37 x i8] c"SteamAPI_ISteamHTMLSurface_MouseMove\00"
define void @SteamAPI_ISteamHTMLSurface_MouseMove(i8* %0) {
%2 = tail call i32 (i8*, i8*, i8*, ...) bitcast (i32 (...)* @xlogf to i32 (i8*, i8*, i8*, ...)*)(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([37 x i8], [37 x i8]* @__func__.SteamAPI_ISteamHTMLSurface_MouseMove, i64 0, i64 0), i8* %0)
ret void
}
char *cat(char *s1, char *s2) {
  while ((*s1 = *s2++))
    s1++;
  return s1;
}


x86 assembly (clang, -O0):
<cat>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
je     113c <cat+0x3c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <cat+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cat>:
mov    %rdi,%rax
mov    (%rsi),%cl
mov    %cl,(%rdi)
test   %cl,%cl
je     1122 <cat+0x22>
add    $0x1,%rsi
nop
movzbl (%rsi),%ecx
mov    %cl,0x1(%rax)
add    $0x1,%rax
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <cat+0x10>
ret

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

LLVM IR (-O2):
define i8* @cat(i8* writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
store i8 %3, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %8, %5 ], [ %1, %2 ]
%7 = phi i8* [ %9, %5 ], [ %0, %2 ]
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = load i8, i8* %8
store i8 %10, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %2
%13 = phi i8* [ %0, %2 ], [ %9, %5 ]
ret i8* %13
}
int main(int argc, const char *argv[]) {
  unsigned a = 0;
  unsigned b = ~a;
  unsigned c = a & b;
  unsigned d = a | b;
  unsigned e = 0b00110011 ^ 0b11001100;
  unsigned f = 100 << 2;
  unsigned g = 100 >> 2;
  unsigned char h = 0b00001111;
  unsigned i = (h << 4) + (h >> 4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
movl   $0xff,-0x24(%rbp)
movl   $0x190,-0x28(%rbp)
movl   $0x19,-0x2c(%rbp)
movb   $0xf,-0x2d(%rbp)
movzbl -0x2d(%rbp),%eax
shl    $0x4,%eax
movzbl -0x2d(%rbp),%ecx
sar    $0x4,%ecx
add    %ecx,%eax
mov    %eax,-0x34(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%15 = load i32, i32* %6
%16 = xor i32 %15, -1
store i32 %16, i32* %7
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = and i32 %17, %18
store i32 %19, i32* %8
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = or i32 %20, %21
store i32 %22, i32* %9
store i32 255, i32* %10
store i32 400, i32* %11
store i32 25, i32* %12
store i8 15, i8* %13
%23 = load i8, i8* %13
%24 = zext i8 %23 to i32
%25 = shl i32 %24, 4
%26 = load i8, i8* %13
%27 = zext i8 %26 to i32
%28 = ashr i32 %27, 4
%29 = add nsw i32 %25, %28
store i32 %29, i32* %14
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
int f(unsigned long long a) { return a >> 18; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x12,%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 18
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @f(i64 %0) {
%2 = lshr i64 %0, 18
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void vecmath_status(void) { printf("Supported vector length: %d\n", 2); }


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"Supported vector length: %d\0A\00"
define void @vecmath_status() {
%1 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 2)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"Supported vector length: %d\0A\00"
define void @vecmath_status() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SSL_library_init();
int /*<<< orphan*/ SSL_load_error_strings();
void socket_init(void) {
  SSL_load_error_strings();
  SSL_library_init();
  (void)0;
}


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

x86 assembly (clang, -O2):
<socket_init>:
push   %rax
xor    %eax,%eax
call   1040 <SSL_load_error_strings@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <SSL_library_init@plt>

LLVM IR (-O0):
define void @socket_init() {
%1 = call i32 (...) @SSL_load_error_strings()
%2 = call i32 (...) @SSL_library_init()
ret void
}

LLVM IR (-O2):
define void @socket_init() {
%1 = tail call i32 (...) @SSL_load_error_strings()
%2 = tail call i32 (...) @SSL_library_init()
ret void
}
long gcd1(long a, long b) { return (a % b == 0 ? b : gcd1(b, a % b)); }


x86 assembly (clang, -O0):
<gcd1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
cmp    $0x0,%rdx
jne    1141 <gcd1+0x31>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    115b <gcd1+0x4b>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rax
cqto
idivq  -0x10(%rbp)
mov    %rdx,%rsi
call   1030 <gcd1@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd1>:
mov    %rsi,%rdx
mov    %rdi,%rax
jmp    111d <gcd1+0x1d>
nopl   0x0(%rax,%rax,1)
cqto
idiv   %rcx
mov    %rcx,%rax
test   %rdx,%rdx
je     1132 <gcd1+0x32>
mov    %rdx,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    1110 <gcd1+0x10>
xor    %edx,%edx
div    %ecx
jmp    1115 <gcd1+0x15>
mov    %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @gcd1(i64 %0, i64 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %0, %2 ], [ %5, %3 ]
%5 = phi i64 [ %1, %2 ], [ %6, %3 ]
%6 = srem i64 %4, %5
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %3
8: ; preds = %3
ret i64 %5
}
/* Type definitions */
struct sockaddr {
  int dummy;
};
struct gc_arena {
  int dummy;
};

/* Variables and functions */
char const *print_sockaddr_ex(struct sockaddr const *, char *, int,
                              struct gc_arena *);
const char *print_sockaddr(const struct sockaddr *addr, struct gc_arena *gc) {
  return print_sockaddr_ex(addr, ":", (1 << 1), gc);
}


x86 assembly (clang, -O0):
<print_sockaddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rcx
lea    0xed1(%rip),%rsi
mov    $0x2,%edx
call   1030 <print_sockaddr_ex@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_sockaddr>:
mov    %rsi,%rcx
lea    0xee6(%rip),%rsi
mov    $0x2,%edx
jmp    1030 <print_sockaddr_ex@plt>

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
%struct.gc_arena = type { i32 }
@.str = [2 x i8] c":\00"
define i8* @print_sockaddr(%struct.sockaddr* %0, %struct.gc_arena* %1) {
%3 = alloca %struct.sockaddr*
%4 = alloca %struct.gc_arena*
store %struct.sockaddr* %0, %struct.sockaddr** %3
store %struct.gc_arena* %1, %struct.gc_arena** %4
%5 = load %struct.sockaddr*, %struct.sockaddr** %3
%6 = load %struct.gc_arena*, %struct.gc_arena** %4
%7 = call i8* @print_sockaddr_ex(%struct.sockaddr* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 2, %struct.gc_arena* %6)
ret i8* %7
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
%struct.gc_arena = type { i32 }
@.str = [2 x i8] c":\00"
define i8* @print_sockaddr(%struct.sockaddr* %0, %struct.gc_arena* %1) {
%3 = tail call i8* @print_sockaddr_ex(%struct.sockaddr* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32 2, %struct.gc_arena* %1)
ret i8* %3
}
int angel_sysctl_destroy(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @angel_sysctl_destroy() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int, int);
void test3() {
  int px = (int)malloc(120);
  *(int *)px = 8;
  *(int *)(px + 4) = 9;
  printf("Testing writing (int*): %d %d\n", *(int *)px, *(int *)(px + 4));
  free((void *)px);
}


x86 assembly (clang, -O0):
<test3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x78,%edi
call   1050 <malloc@plt>
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movl   $0x8,(%rax)
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
movl   $0x9,(%rax)
movslq -0x4(%rbp),%rax
mov    (%rax),%esi
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
mov    (%rax),%edx
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
movslq -0x4(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test3>:
push   %rbx
mov    $0x78,%edi
call   1050 <malloc@plt>
movslq %eax,%rbx
movl   $0x8,(%rbx)
lea    0x4(%rbx),%eax
cltq
movl   $0x9,(%rax)
mov    (%rbx),%esi
lea    0xea8(%rip),%rdi
mov    $0x9,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"Testing writing (int*): %d %d\0A\00"
define void @test3() {
%1 = alloca i32
%2 = call i64 @malloc(i32 120)
%3 = trunc i64 %2 to i32
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
store i32 8, i32* %6
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 4
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i32*
store i32 9, i32* %10
%11 = load i32, i32* %1
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load i32, i32* %13
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 4
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i32*
%19 = load i32, i32* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %19)
%21 = load i32, i32* %1
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i8*
%24 = call i32 @free(i8* %23)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"Testing writing (int*): %d %d\0A\00"
define void @test3() {
%1 = tail call i64 @malloc(i32 120)
%2 = shl i64 %1, 32
%3 = ashr exact i64 %2, 32
%4 = inttoptr i64 %3 to i32*
store i32 8, i32* %4
%5 = add i64 %2, 17179869184
%6 = ashr exact i64 %5, 32
%7 = inttoptr i64 %6 to i32*
store i32 9, i32* %7
%8 = load i32, i32* %4
%9 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i32 %8, i32 9)
%10 = inttoptr i64 %3 to i8*
%11 = tail call i32 @free(i8* %10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ifct_noscale(double *, int);
void ifct_defn_scaling(double *f, int length) { ifct_noscale(f, length); }


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

x86 assembly (clang, -O2):
<ifct_defn_scaling>:
jmp    1030 <ifct_noscale@plt>

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

LLVM IR (-O2):
define void @ifct_defn_scaling(double* %0, i32 %1) {
%3 = tail call i32 @ifct_noscale(double* %0, i32 %1)
ret void
}
int r_fib(int n) {
  if (n == 1 || n == 0)
    return 1;
  return r_fib(n - 1) + r_fib(n - 2);
}


x86 assembly (clang, -O0):
<r_fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     112f <r_fib+0x1f>
cmpl   $0x0,-0x8(%rbp)
jne    113b <r_fib+0x2b>
movl   $0x1,-0x4(%rbp)
jmp    115e <r_fib+0x4e>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <r_fib@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <r_fib@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r_fib>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
cmp    $0x2,%edi
jb     1145 <r_fib+0x35>
mov    %edi,%ebx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    -0x1(%rbx),%edi
call   1030 <r_fib@plt>
add    $0xfffffffe,%ebx
add    %eax,%ebp
cmp    $0x1,%ebx
ja     1130 <r_fib+0x20>
add    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @r_fib(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %13, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -1
%7 = tail call i32 @r_fib(i32 %6)
%8 = add nsw i32 %4, -2
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %8, 2
br i1 %10, label %11, label %3
11: ; preds = %3
%12 = add i32 %9, 1
br label %13
13: ; preds = %11, %1
%14 = phi i32 [ 1, %1 ], [ %12, %11 ]
ret i32 %14
}
void drawpixelses(void *s, long a) { *((long *)(s)) = a; }


x86 assembly (clang, -O0):
<drawpixelses>:
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):
<drawpixelses>:
mov    %rsi,(%rdi)
ret

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

LLVM IR (-O2):
define void @drawpixelses(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
/* Variables and functions */
int errno;
void set_errno(int e) { errno = e; }


x86 assembly (clang, -O0):
<set_errno>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    0x2ecf(%rip),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_errno>:
mov    0x2ed9(%rip),%rax
mov    %edi,(%rax)
ret

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

LLVM IR (-O2):
@errno = global i32 0
define void @set_errno(i32 %0) {
store i32 %0, i32* @errno
ret void
}
int subt(int a, int b) { return (a - b); }


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

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

LLVM IR (-O0):
define i32 @subt(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 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @subt(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
void RTThreadGetState(void) {}


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

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

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

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