xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ lgen(char *, char *, int);
void cgldlab(int id) { lgen("%s\t$%c%d,%%rax", "movq", id); }


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

x86 assembly (clang, -O2):
<cgldlab>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
lea    0xeef(%rip),%rsi
jmp    1030 <lgen@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%s\09$%c%d,%%rax\00"
@.str.1 = [5 x i8] c"movq\00"
define void @cgldlab(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @lgen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s\09$%c%d,%%rax\00"
@.str.1 = [5 x i8] c"movq\00"
define void @cgldlab(i32 %0) {
%2 = tail call i32 @lgen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
scalar_t__ EOF;
scalar_t__ fputs(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ onOutputError();
int /*<<< orphan*/ stdout;
void putString(const char *string) {
  if (fputs(string, stdout) == EOF)
    onOutputError();
}


x86 assembly (clang, -O0):
<putString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2ea3(%rip),%rcx
cmp    (%rcx),%rax
jne    1155 <putString+0x35>
mov    $0x0,%al
call   1040 <onOutputError@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putString>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
mov    0x2eb2(%rip),%rcx
cmp    (%rcx),%rax
jne    1143 <putString+0x23>
xor    %eax,%eax
pop    %rcx
jmp    1040 <onOutputError@plt>
pop    %rax
ret

LLVM IR (-O0):
@stdout = global i32 0
@EOF = global i64 0
define void @putString(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stdout
%5 = call i64 @fputs(i8* %3, i32 %4)
%6 = load i64, i64* @EOF
%7 = icmp eq i64 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @onOutputError()
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@EOF = global i64 0
define void @putString(i8* %0) {
%2 = load i32, i32* @stdout
%3 = tail call i64 @fputs(i8* %0, i32 %2)
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 (...) @onOutputError()
br label %8
8: ; preds = %6, %1
ret void
}
int test_imm_C1int64_lowword_reg(long long val) {
  return ((val) & (0xC1 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C1int64_lowword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
and    $0xc1,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_C1int64_lowword_reg>:
test   $0xc1,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_C1int64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 193
%5 = icmp ne i64 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_C1int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 193
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void expression_2(double *fn_1, double *fn_0) { fn_0[0] = fn_1[0]; }


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

x86 assembly (clang, -O2):
<expression_2>:
movsd  (%rdi),%xmm0
movsd  %xmm0,(%rsi)
ret

LLVM IR (-O0):
define void @expression_2(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
store double %7, double* %9
ret void
}

LLVM IR (-O2):
define void @expression_2(double* nocapture %0, double* nocapture writeonly %1) {
%3 = load double, double* %0
store double %3, double* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strncmp(char const *, char *, int);
int string_null_or_empty(const char *str) {
  if (!str)
    return 1;
  if (!strncmp(str, "", 1))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<string_null_or_empty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <string_null_or_empty+0x23>
movl   $0x1,-0x4(%rbp)
jmp    1164 <string_null_or_empty+0x54>
mov    -0x10(%rbp),%rdi
lea    0xec2(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    115d <string_null_or_empty+0x4d>
movl   $0x1,-0x4(%rbp)
jmp    1164 <string_null_or_empty+0x54>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_null_or_empty>:
test   %rdi,%rdi
je     1135 <string_null_or_empty+0x25>
push   %rax
lea    0xee3(%rip),%rsi
mov    $0x1,%edx
call   1030 <strncmp@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
sete   %al
add    $0x8,%rsp
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @string_null_or_empty(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store i32 1, i32* %2
br label %13
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = call i32 @strncmp(i8* %8, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 1)
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %7
store i32 1, i32* %2
br label %13
12: ; preds = %7
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11, %6
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @string_null_or_empty(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i32 @strncmp(i8* %0, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i32 1)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 1, %1 ], [ %6, %3 ]
ret i32 %8
}
/* Type definitions */
struct strbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sb_append(struct strbuf *, char const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
void sb_append_str(struct strbuf *sb, const char *s) {
  sb_append(sb, s, strlen(s));
}


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

x86 assembly (clang, -O2):
<sb_append_str>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <sb_append@plt>

LLVM IR (-O0):
%struct.strbuf = type { i32 }
define void @sb_append_str(%struct.strbuf* %0, i8* %1) {
%3 = alloca %struct.strbuf*
%4 = alloca i8*
store %struct.strbuf* %0, %struct.strbuf** %3
store i8* %1, i8** %4
%5 = load %struct.strbuf*, %struct.strbuf** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @sb_append(%struct.strbuf* %5, i8* %6, i32 %8)
ret void
}

LLVM IR (-O2):
%struct.strbuf = type { i32 }
define void @sb_append_str(%struct.strbuf* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @sb_append(%struct.strbuf* %0, i8* %1, i32 %3)
ret void
}
/* Variables and functions */
double nintegrate_r(double (*)(double, void *), void *, double, double, int);
double nintegrate(double (*func)(double, void *), void *params, double a,
                  double b) {
  return nintegrate_r(func, params, a, b, 1024);
}


x86 assembly (clang, -O0):
<nintegrate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
mov    $0x400,%edx
call   1030 <nintegrate_r@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nintegrate>:
mov    $0x400,%edx
jmp    1030 <nintegrate_r@plt>

LLVM IR (-O0):
define double @nintegrate(double (double, i8*)* %0, i8* %1, double %2, double %3) {
%5 = alloca double (double, i8*)*
%6 = alloca i8*
%7 = alloca double
%8 = alloca double
store double (double, i8*)* %0, double (double, i8*)** %5
store i8* %1, i8** %6
store double %2, double* %7
store double %3, double* %8
%9 = load double (double, i8*)*, double (double, i8*)** %5
%10 = load i8*, i8** %6
%11 = load double, double* %7
%12 = load double, double* %8
%13 = call double @nintegrate_r(double (double, i8*)* %9, i8* %10, double %11, double %12, i32 1024)
ret double %13
}

LLVM IR (-O2):
define double @nintegrate(double (double, i8*)* %0, i8* %1, double %2, double %3) {
%5 = tail call double @nintegrate_r(double (double, i8*)* %0, i8* %1, double %2, double %3, i32 1024)
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void foo(void) { printf("Hello, from foo-land!!\n"); }


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

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

LLVM IR (-O0):
@.str = [24 x i8] c"Hello, from foo-land!!\0A\00"
define void @foo() {
%1 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [23 x i8] c"Hello, from foo-land!!\00"
define void @foo() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int cos(double);
double fp(double x) { return (2 * cos(x) - x * 1 / 5.); }


x86 assembly (clang, -O0):
<fp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <cos@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
movsd  0xed2(%rip),%xmm1
mulsd  -0x8(%rbp),%xmm1
movsd  0xebd(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fp>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <cos@plt>
add    %eax,%eax
cvtsi2sd %eax,%xmm1
movsd  (%rsp),%xmm0
divsd  0xed2(%rip),%xmm0
addsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @fp(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i32 @cos(double %3)
%5 = mul nsw i32 2, %4
%6 = sitofp i32 %5 to double
%7 = load double, double* %2
%8 = fmul double %7, 1.000000e+00
%9 = fdiv double %8, 5.000000e+00
%10 = fsub double %6, %9
ret double %10
}

LLVM IR (-O2):
define double @fp(double %0) {
%2 = tail call i32 @cos(double %0)
%3 = shl nsw i32 %2, 1
%4 = sitofp i32 %3 to double
%5 = fdiv double %0, 5.000000e+00
%6 = fsub double %4, %5
ret double %6
}
void prefetcht2(const void *v) {
  __asm__ volatile("prefetcht2 %0" : : "m"(*(const char *)v));
}


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

x86 assembly (clang, -O2):
<prefetcht2>:
prefetcht2 (%rdi)
ret

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

LLVM IR (-O2):
define void @prefetcht2(i8* %0) {
tail call void asm sideeffect "prefetcht2 $0", "*m,~{dirflag},~{fpsr},~{flags}"(i8* elementtype(i8) %0)
ret void
}
void GraphDisplay() {}


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

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

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

LLVM IR (-O2):
define void @GraphDisplay() {
ret void
}
/* Type definitions */
struct sockaddr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ connect(int, struct sockaddr *, int);
int socket(int, int, int);
int client(int domain, int type, int protocol, struct sockaddr *serv_addr,
           int addrlen) {
  int returnvalue;
  returnvalue = socket(domain, type, protocol);
  connect(returnvalue, serv_addr, addrlen);
  return returnvalue;
}


x86 assembly (clang, -O0):
<client>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1040 <socket@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <connect@plt>
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<client>:
push   %rbp
push   %r14
push   %rbx
mov    %r8d,%r14d
mov    %rcx,%rbx
call   1040 <socket@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <connect@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
define i32 @client(i32 %0, i32 %1, i32 %2, %struct.sockaddr* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.sockaddr*
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store %struct.sockaddr* %3, %struct.sockaddr** %9
store i32 %4, i32* %10
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = call i32 @socket(i32 %12, i32 %13, i32 %14)
store i32 %15, i32* %11
%16 = load i32, i32* %11
%17 = load %struct.sockaddr*, %struct.sockaddr** %9
%18 = load i32, i32* %10
%19 = call i32 @connect(i32 %16, %struct.sockaddr* %17, i32 %18)
%20 = load i32, i32* %11
ret i32 %20
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
define i32 @client(i32 %0, i32 %1, i32 %2, %struct.sockaddr* %3, i32 %4) {
%6 = tail call i32 @socket(i32 %0, i32 %1, i32 %2)
%7 = tail call i32 @connect(i32 %6, %struct.sockaddr* %3, i32 %4)
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ PKCS7;

/* Variables and functions */
int /*<<< orphan*/ PKCS7_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *PKCS7_new();
int /*<<< orphan*/ print_pkcs7(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  PKCS7 *p7;
  p7 = PKCS7_new();
  printf("--before:\n");
  print_pkcs7(p7);
  PKCS7_free(p7);
  return 0;
}


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)
mov    $0x0,%al
call   1040 <PKCS7_new@plt>
mov    %rax,-0x18(%rbp)
lea    0xe98(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <print_pkcs7@plt>
mov    -0x18(%rbp),%rdi
call   1060 <PKCS7_free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <PKCS7_new@plt>
mov    %rax,%rbx
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <print_pkcs7@plt>
mov    %rbx,%rdi
call   1060 <PKCS7_free@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"--before:\0A\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* (...) @PKCS7_new()
store i32* %7, i32** %6
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%9 = load i32*, i32** %6
%10 = call i32 @print_pkcs7(i32* %9)
%11 = load i32*, i32** %6
%12 = call i32 @PKCS7_free(i32* %11)
ret i32 0
}

LLVM IR (-O2):
@str = [10 x i8] c"--before:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* (...) @PKCS7_new()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @print_pkcs7(i32* %3)
%6 = tail call i32 @PKCS7_free(i32* %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
void epilogue() {
  puts("\tleave\n");
  puts("\tret\n");
}


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

x86 assembly (clang, -O2):
<epilogue>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee4(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"\09leave\0A\00"
@.str.1 = [6 x i8] c"\09ret\0A\00"
define void @epilogue() {
%1 = call i32 @puts(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"\09leave\0A\00"
@.str.1 = [6 x i8] c"\09ret\0A\00"
define void @epilogue() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int /*<<< orphan*/ putchar(char);
void _print_char(void *d) {
  if (d == NULL)
    putchar('\0');
  else
    printf("%c", *(char *)d);
}


x86 assembly (clang, -O0):
<_print_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1143 <_print_char+0x23>
xor    %edi,%edi
call   1030 <putchar@plt>
jmp    1156 <_print_char+0x36>
mov    -0x8(%rbp),%rax
lea    0xeb2(%rip),%rdi
movsbl (%rax),%esi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_print_char>:
test   %rdi,%rdi
je     1134 <_print_char+0x14>
movsbl (%rdi),%esi
lea    0xed1(%rip),%rdi
jmp    1040 <printf@plt>
xor    %edi,%edi
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @_print_char(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @putchar(i8 signext 0)
br label %8
5: ; preds = %1
%6 = load i8, i8* %0
%7 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %6)
br label %8
8: ; preds = %5, %3
ret void
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ EXIT_FAILURE;
int clock_gettime(int /*<<< orphan*/, struct timespec *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
struct timespec timestamp() {
  struct timespec now;
  if (clock_gettime(CLOCK_MONOTONIC, &now) == -1) {
    perror("problem with get_time from clock");
    exit(EXIT_FAILURE);
  }
  return now;
}


x86 assembly (clang, -O0):
<timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
cmp    $0xffffffff,%eax
jne    116d <timestamp+0x3d>
lea    0xea6(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timestamp>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <clock_gettime@plt>
cmp    $0xffffffff,%eax
je     114c <timestamp+0x1c>
mov    (%rsp),%eax
pop    %rcx
ret
lea    0xead(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC = global i32 0
@.str = [33 x i8] c"problem with get_time from clock\00"
@EXIT_FAILURE = global i32 0
define i32 @timestamp() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = call i32 @exit(i32 %7)
unreachable
9: ; preds = %0
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%11 = load i32, i32* %10
ret i32 %11
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC = global i32 0
@.str = [33 x i8] c"problem with get_time from clock\00"
@EXIT_FAILURE = global i32 0
define i32 @timestamp() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = call i32 @exit(i32 %7)
unreachable
9: ; preds = %0
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%11 = load i32, i32* %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void f(unsigned short ad) {
  if ((short)(ad - 0x4000) >= 0)
    abort();
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
sub    $0x4000,%eax
cwtl
cmp    $0x0,%eax
jl     1139 <f+0x29>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
add    $0xc000,%di
jns    1118 <f+0x8>
ret
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @f(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = sub nsw i32 %4, 16384
%6 = trunc i32 %5 to i16
%7 = sext i16 %6 to i32
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @f(i16 zeroext %0) {
%2 = add i16 %0, -16384
%3 = icmp sgt i16 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @abort()
unreachable
6: ; preds = %1
ret void
}
int lock_component_release() {}


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

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

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

LLVM IR (-O2):
define i32 @lock_component_release() {
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ __nr_to_section(unsigned long);
int present_section(int /*<<< orphan*/);
__attribute__((always_)) int pfn_present(unsigned long pfn) {
  if (((pfn) >> (27 - 12)) >= (1UL << (46 - 27)))
    return 0;
  return present_section(__nr_to_section(((pfn) >> (27 - 12))));
}


x86 assembly (clang, -O0):
<pfn_present>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shr    $0xf,%rax
cmp    $0x80000,%rax
jb     114c <pfn_present+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    1163 <pfn_present+0x43>
mov    -0x10(%rbp),%rdi
shr    $0xf,%rdi
call   1030 <__nr_to_section@plt>
mov    %eax,%edi
call   1040 <present_section@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pfn_present>:
mov    %rdi,%rax
shr    $0x22,%rax
je     112c <pfn_present+0xc>
xor    %eax,%eax
ret
push   %rax
shr    $0xf,%rdi
call   1030 <__nr_to_section@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <present_section@plt>

LLVM IR (-O0):
define i32 @pfn_present(i64 %0) {
%2 = alloca i32
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = lshr i64 %4, 15
%6 = icmp uge i64 %5, 524288
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %13
8: ; preds = %1
%9 = load i64, i64* %3
%10 = lshr i64 %9, 15
%11 = call i32 @__nr_to_section(i64 %10)
%12 = call i32 @present_section(i32 %11)
store i32 %12, i32* %2
br label %13
13: ; preds = %8, %7
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @pfn_present(i64 %0) {
%2 = icmp ugt i64 %0, 17179869183
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = lshr i64 %0, 15
%5 = tail call i32 @__nr_to_section(i64 %4)
%6 = tail call i32 @present_section(i32 %5)
br label %7
7: ; preds = %1, %3
%8 = phi i32 [ %6, %3 ], [ 0, %1 ]
ret i32 %8
}
int check_prime(int nb) {
  int i = nb - 1;
  if (nb == 0 || nb == 1 || nb < 0)
    return (0);
  while (i > 1) {
    if (nb % i == 0)
      return (0);
    i--;
  }
  return (1);
}


x86 assembly (clang, -O0):
<check_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112e <check_prime+0x2e>
cmpl   $0x1,-0x8(%rbp)
je     112e <check_prime+0x2e>
cmpl   $0x0,-0x8(%rbp)
jge    113a <check_prime+0x3a>
movl   $0x0,-0x4(%rbp)
jmp    117a <check_prime+0x7a>
jmp    113f <check_prime+0x3f>
cmpl   $0x1,-0xc(%rbp)
jle    1173 <check_prime+0x73>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1165 <check_prime+0x65>
movl   $0x0,-0x4(%rbp)
jmp    117a <check_prime+0x7a>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    113f <check_prime+0x3f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_prime>:
xor    %ecx,%ecx
cmp    $0x2,%edi
jl     1121 <check_prime+0x21>
mov    %edi,%esi
nopl   0x0(%rax)
cmp    $0x3,%esi
jl     1124 <check_prime+0x24>
add    $0xffffffff,%esi
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
jne    1110 <check_prime+0x10>
mov    %ecx,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @check_prime(i32 %0) {
%2 = icmp slt i32 %0, 2
br i1 %2, label %10, label %3
3: ; preds = %1, %7
%4 = phi i32 [ %5, %7 ], [ %0, %1 ]
%5 = add nsw i32 %4, -1
%6 = icmp sgt i32 %4, 2
br i1 %6, label %7, label %10
7: ; preds = %3
%8 = srem i32 %0, %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %3
10: ; preds = %3, %7, %1
%11 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 0, %7 ]
ret i32 %11
}
int revDigits(int data) {
  int k, rev = 0;
  while (data != 0) {
    k = data % 10;
    rev = rev * 10 + k;
    data /= 10;
  }
  return rev;
}


x86 assembly (clang, -O0):
<revDigits>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1143 <revDigits+0x43>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
imul   $0xa,-0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <revDigits+0xe>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<revDigits>:
xor    %eax,%eax
test   %edi,%edi
je     113f <revDigits+0x3f>
cs nopw 0x0(%rax,%rax,1)
lea    (%rax,%rax,4),%eax
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
lea    (%rsi,%rax,2),%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <revDigits+0x10>
ret

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

LLVM IR (-O2):
define i32 @revDigits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %12, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %9, %3 ], [ %0, %1 ]
%6 = srem i32 %5, 10
%7 = mul nsw i32 %4, 10
%8 = add nsw i32 %7, %6
%9 = sdiv i32 %5, 10
%10 = add i32 %5, 9
%11 = icmp ult i32 %10, 19
br i1 %11, label %12, label %3
12: ; preds = %3, %1
%13 = phi i32 [ 0, %1 ], [ %8, %3 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
int /*<<< orphan*/ h(int);
int /*<<< orphan*/ i(int);
int main() {
  f(1);
  h(2);
  i(2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1040 <f@plt>
mov    $0x2,%edi
call   1030 <h@plt>
mov    $0x2,%edi
call   1050 <i@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1040 <f@plt>
mov    $0x2,%edi
call   1030 <h@plt>
mov    $0x2,%edi
call   1050 <i@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @f(i32 1)
%2 = call i32 @h(i32 2)
%3 = call i32 @i(i32 2)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 1)
%2 = tail call i32 @h(i32 2)
%3 = tail call i32 @i(i32 2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fork();
int getpid();
int getppid();
int /*<<< orphan*/ printf(char *, int, int);
int main(void) {
  printf("pid = %d, ppid = %d\n", getpid(), getppid());
  fork();
  printf("pid = %d, ppid = %d\n", getpid(), getppid());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1050 <getppid@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xe94(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <fork@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <getppid@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xe6b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <getppid@plt>
lea    0xea5(%rip),%r14
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <fork@plt>
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <getppid@plt>
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [21 x i8] c"pid = %d, ppid = %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @getpid()
%3 = call i32 (...) @getppid()
%4 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
%5 = call i32 (...) @fork()
%6 = call i32 (...) @getpid()
%7 = call i32 (...) @getppid()
%8 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"pid = %d, ppid = %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 (...) @getppid()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
%4 = tail call i32 (...) @fork()
%5 = tail call i32 (...) @getpid()
%6 = tail call i32 (...) @getppid()
%7 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret i32 0
}
/* Variables and functions */
int __do_write(int, void *, int);
int __do_write_check(int fd, void *data, int size) {
  int ret;
  ret = __do_write(fd, data, size);
  if (ret < 0)
    return ret;
  if (ret != size)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<__do_write_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <__do_write@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1149 <__do_write_check+0x39>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1168 <__do_write_check+0x58>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1161 <__do_write_check+0x51>
movl   $0xffffffff,-0x4(%rbp)
jmp    1168 <__do_write_check+0x58>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__do_write_check>:
push   %rbx
mov    %edx,%ebx
call   1030 <__do_write@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
setne  %cl
neg    %ecx
test   %eax,%eax
cmovns %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @__do_write_check(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 @__do_write(i32 %0, i8* %1, i32 %2)
%5 = icmp slt i32 %4, 0
%6 = icmp ne i32 %4, %2
%7 = sext i1 %6 to i32
%8 = select i1 %5, i32 %4, i32 %7
ret i32 %8
}
int readNull(const char *begin, const char **next_token_begin) {
  (*next_token_begin) += 4;
}


x86 assembly (clang, -O0):
<readNull>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x4,%rcx
mov    %rcx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<readNull>:
addq   $0x4,(%rsi)
ret

LLVM IR (-O0):
define i32 @readNull(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*** %5
%7 = load i8*, i8** %6
%8 = getelementptr inbounds i8, i8* %7, i64 4
store i8* %8, i8** %6
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @readNull(i8* nocapture readnone %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = getelementptr inbounds i8, i8* %3, i64 4
store i8* %4, i8** %1
ret i32 undef
}
void copy(register char *dest, register char *src) {
  while ((*dest++ = *src++) != '\n')
    ;
}


x86 assembly (clang, -O0):
<copy>:
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    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
movsbl %al,%eax
cmp    $0xa,%eax
je     113f <copy+0x3f>
jmp    110c <copy+0xc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rsi,%rax,1),%ecx
mov    %cl,(%rdi,%rax,1)
add    $0x1,%rax
cmp    $0xa,%cl
jne    1110 <copy+0x10>
ret

LLVM IR (-O0):
define void @copy(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 = %13, %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
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %3
store i8 %8, i8* %9
%11 = sext i8 %8 to i32
%12 = icmp ne i32 %11, 10
br i1 %12, label %13, label %14
13: ; preds = %5
br label %5
14: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @copy(i8* nocapture writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = phi i8* [ %1, %2 ], [ %6, %3 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = getelementptr inbounds i8, i8* %4, i64 1
store i8 %7, i8* %4
%9 = icmp eq i8 %7, 10
br i1 %9, label %10, label %3
10: ; preds = %3
ret void
}
/* Type definitions */
typedef int ptrdiff_t;
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ inv_adst4_1d_internal_c(int /*<<< orphan*/ *const, int const,
                                           int const, int const,
                                           int /*<<< orphan*/ *, int const);
void dav1d_inv_flipadst4_1d_c(int32_t *const c, const ptrdiff_t stride,
                              const int min, const int max) {
  inv_adst4_1d_internal_c(c, stride, min, max, &c[(4 - 1) * stride], -stride);
}


x86 assembly (clang, -O0):
<dav1d_inv_flipadst4_1d_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%r8
imul   $0x3,-0xc(%rbp),%eax
cltq
shl    $0x2,%rax
add    %rax,%r8
xor    %r9d,%r9d
sub    -0xc(%rbp),%r9d
call   1030 <inv_adst4_1d_internal_c@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dav1d_inv_flipadst4_1d_c>:
lea    (%rsi,%rsi,2),%eax
cltq
lea    (%rdi,%rax,4),%r8
mov    %esi,%r9d
neg    %r9d
jmp    1030 <inv_adst4_1d_internal_c@plt>

LLVM IR (-O0):
define void @dav1d_inv_flipadst4_1d_c(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i32*, i32** %5
%10 = load i32, i32* %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = load i32*, i32** %5
%14 = load i32, i32* %6
%15 = mul nsw i32 3, %14
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %13, i64 %16
%18 = load i32, i32* %6
%19 = sub nsw i32 0, %18
%20 = call i32 @inv_adst4_1d_internal_c(i32* %9, i32 %10, i32 %11, i32 %12, i32* %17, i32 %19)
ret void
}

LLVM IR (-O2):
define void @dav1d_inv_flipadst4_1d_c(i32* %0, i32 %1, i32 %2, i32 %3) {
%5 = mul nsw i32 %1, 3
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i32, i32* %0, i64 %6
%8 = sub nsw i32 0, %1
%9 = tail call i32 @inv_adst4_1d_internal_c(i32* %0, i32 %1, i32 %2, i32 %3, i32* %7, i32 %8)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(int);
int read(int, char *, int);
int is_connected(int socket) {
  char *buf = malloc(2);
  int readval = read(socket, buf, sizeof(buf) - 1);
  free(buf);
  if (readval == 0) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_connected>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x2,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    $0x7,%edx
call   1040 <read@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
cmpl   $0x0,-0x14(%rbp)
jne    117c <is_connected+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    1183 <is_connected+0x53>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_connected>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
mov    $0x2,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,%edi
mov    %rax,%rsi
mov    $0x7,%edx
call   1040 <read@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
test   %ebp,%ebp
setne  %al
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @is_connected(i32 %0) {
%2 = tail call dereferenceable_or_null(2) i8* @malloc(i32 2)
%3 = tail call i32 @read(i32 %0, i8* %2, i32 7)
%4 = tail call i32 @free(i8* %2)
%5 = icmp ne i32 %3, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ t;
typedef int /*<<< orphan*/ p;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void fun(char *t, unsigned int *p) {
  printf("Inside Function\n");
  printf("sizeof t, as in t[40] is :%ld\n", sizeof(t));
  printf("sizeof p, as in p[10] is :%ld\n", sizeof(p));
  printf("Exit Function\n");
}


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

x86 assembly (clang, -O2):
<fun>:
push   %rax
lea    0xf16(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed8(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef4(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"Inside Function\0A\00"
@.str.1 = [31 x i8] c"sizeof t, as in t[40] is :%ld\0A\00"
@.str.2 = [31 x i8] c"sizeof p, as in p[10] is :%ld\0A\00"
@.str.3 = [15 x i8] c"Exit Function\0A\00"
define void @fun(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i64 8)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i64 8)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [31 x i8] c"sizeof t, as in t[40] is :%ld\0A\00"
@.str.2 = [31 x i8] c"sizeof p, as in p[10] is :%ld\0A\00"
@str = [16 x i8] c"Inside Function\00"
@str.4 = [14 x i8] c"Exit Function\00"
define void @fun(i8* nocapture readnone %0, i32* nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i64 8)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i64 8)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
void h(void) {
  int a;
  f(a);
}


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

x86 assembly (clang, -O2):
<h>:
jmp    1030 <f@plt>

LLVM IR (-O0):
define void @h() {
%1 = alloca i32
%2 = load i32, i32* %1
%3 = call i32 @f(i32 %2)
ret void
}

LLVM IR (-O2):
define void @h() {
%1 = tail call i32 @f(i32 undef)
ret void
}
void alias2_OK() {
  int i, j, z;
  j = 1;
  z = 2;
  j = i;
  i = z;
}


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

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

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

LLVM IR (-O2):
define void @alias2_OK() {
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t get_toggle_ctrl(uint8_t state) {
  switch (state) {
  case 0x11:
  case 0x12:
    return 0x02;
  case 0x22:
  case 0x21:
    return 0x01;
  }
  return 0x04;
}


x86 assembly (clang, -O0):
<get_toggle_ctrl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0xffffffef,%eax
sub    $0x2,%eax
jb     1132 <get_toggle_ctrl+0x32>
jmp    111e <get_toggle_ctrl+0x1e>
mov    -0xc(%rbp),%eax
add    $0xffffffdf,%eax
sub    $0x2,%eax
jb     113e <get_toggle_ctrl+0x3e>
jmp    114a <get_toggle_ctrl+0x4a>
movl   $0x2,-0x4(%rbp)
jmp    1151 <get_toggle_ctrl+0x51>
movl   $0x1,-0x4(%rbp)
jmp    1151 <get_toggle_ctrl+0x51>
movl   $0x4,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_toggle_ctrl>:
mov    $0x2,%eax
lea    -0x11(%rdi),%ecx
cmp    $0x2,%ecx
jb     1120 <get_toggle_ctrl+0x20>
add    $0xffffffdf,%edi
cmp    $0x1,%edi
ja     111b <get_toggle_ctrl+0x1b>
mov    $0x1,%eax
ret
mov    $0x4,%eax
ret

LLVM IR (-O0):
define i32 @get_toggle_ctrl(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 17, label %5
i32 18, label %5
i32 34, label %6
i32 33, label %6
]
5: ; preds = %1, %1
store i32 2, i32* %2
br label %8
6: ; preds = %1, %1
store i32 1, i32* %2
br label %8
7: ; preds = %1
store i32 4, i32* %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @get_toggle_ctrl(i32 %0) {
switch i32 %0, label %3 [
i32 17, label %4
i32 18, label %4
i32 34, label %2
i32 33, label %2
]
2: ; preds = %1, %1
br label %4
3: ; preds = %1
br label %4
4: ; preds = %1, %1, %3, %2
%5 = phi i32 [ 4, %3 ], [ 1, %2 ], [ 2, %1 ], [ 2, %1 ]
ret i32 %5
}