xunge/DecIR huggingface dataset:
void html_disp_at(double n, double perct) {}


x86 assembly (clang, -O0):
<html_disp_at>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @html_disp_at(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
ret void
}

LLVM IR (-O2):
define void @html_disp_at(double %0, double %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void show_usage() {
  printf("traffic_source client <server-ip> [port <port>] [{<raw-config> | "
         "<bw-config> | burst-test <threshold>}]\n"
         "traffic_source server [port <port>] [{<raw-config> | <bw-config>}]\n"
         "\n"
         "RAW Configuration:\n"
         "\ttx-unit <size> (bytes)\n"
         "\tshot-duration <duration> (microseconds)\n"
         "\tshot-iterations <count>\n"
         "\n"
         "\tbandwidth (Bps) = 1.000.000 / shot-duration * tx-unit * "
         "shot-iterations\n"
         "\n"
         "Bandwidth Configuration:\n"
         "\ttx-rate <rate> (bps)\n"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [405 x i8] c"traffic_source client <server-ip> [port <port>] [{<raw-config> | <bw-config> | burst-test <threshold>}]\0Atraffic_source server [port <port>] [{<raw-config> | <bw-config>}]\0A\0ARAW Configuration:\0A\09tx-unit <size> (bytes)\0A\09shot-duration <duration> (microseconds)\0A\09shot-iterations <count>\0A\0A\09bandwidth (Bps) = 1.000.000 / shot-duration * tx-unit * shot-iterations\0A\0ABandwidth Configuration:\0A\09tx-rate <rate> (bps)\0A\0A\00"
define void @show_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([405 x i8], [405 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [404 x i8] c"traffic_source client <server-ip> [port <port>] [{<raw-config> | <bw-config> | burst-test <threshold>}]\0Atraffic_source server [port <port>] [{<raw-config> | <bw-config>}]\0A\0ARAW Configuration:\0A\09tx-unit <size> (bytes)\0A\09shot-duration <duration> (microseconds)\0A\09shot-iterations <count>\0A\0A\09bandwidth (Bps) = 1.000.000 / shot-duration * tx-unit * shot-iterations\0A\0ABandwidth Configuration:\0A\09tx-rate <rate> (bps)\0A\00"
define void @show_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([404 x i8], [404 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef double uint64_t;

/* Variables and functions */
scalar_t__ pow(double, int);
double fgen_bitstring_uint64_to_double(const unsigned char *bitstring,
                                       double domain_min, double domain_max) {
  uint64_t x_int;
  double x;
  x_int = *(uint64_t *)&bitstring[0];
  x = domain_min +
      (domain_max - domain_min) * x_int / (double)pow((double)2, 64);
  return x;
}


x86 assembly (clang, -O0):
<fgen_bitstring_uint64_to_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xea7(%rip),%xmm0
mov    $0x40,%edi
call   1030 <pow@plt>
movsd  -0x38(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsi2sd %rax,%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgen_bitstring_uint64_to_double>:
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
subsd  %xmm0,%xmm1
mulsd  (%rdi),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xed0(%rip),%xmm0
mov    $0x40,%edi
call   1030 <pow@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movsd  0x8(%rsp),%xmm0
divsd  %xmm1,%xmm0
addsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @fgen_bitstring_uint64_to_double(i8* %0, double %1, double %2) {
%4 = alloca i8*
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i8* %0, i8** %4
store double %1, double* %5
store double %2, double* %6
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = bitcast i8* %10 to double*
%12 = load double, double* %11
store double %12, double* %7
%13 = load double, double* %5
%14 = load double, double* %6
%15 = load double, double* %5
%16 = fsub double %14, %15
%17 = load double, double* %7
%18 = fmul double %16, %17
%19 = call i64 @pow(double 2.000000e+00, i32 64)
%20 = sitofp i64 %19 to double
%21 = fdiv double %18, %20
%22 = fadd double %13, %21
store double %22, double* %8
%23 = load double, double* %8
ret double %23
}

LLVM IR (-O2):
define double @fgen_bitstring_uint64_to_double(i8* nocapture %0, double %1, double %2) {
%4 = bitcast i8* %0 to double*
%5 = load double, double* %4
%6 = fsub double %2, %1
%7 = fmul double %6, %5
%8 = tail call i64 @pow(double 2.000000e+00, i32 64)
%9 = sitofp i64 %8 to double
%10 = fdiv double %7, %9
%11 = fadd double %10, %1
ret double %11
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *);
void document_output_stylesheet(FILE *output_stream, char *application_name,
                                char *stylesheet_filename) {
  fprintf(
      output_stream,
      "<link rel=stylesheet type=\"text/css\" href=\"/appaserver/%s/%s\">\n",
      application_name, stylesheet_filename);
}


x86 assembly (clang, -O0):
<document_output_stylesheet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<document_output_stylesheet>:
mov    %rdx,%rcx
mov    %rsi,%rdx
lea    0xee3(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [64 x i8] c"<link rel=stylesheet type=\22text/css\22 href=\22/appaserver/%s/%s\22>\0A\00"
define void @document_output_stylesheet(i32* %0, i8* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32*, i32** %4
%8 = load i8*, i8** %5
%9 = load i8*, i8** %6
%10 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [64 x i8] c"<link rel=stylesheet type=\22text/css\22 href=\22/appaserver/%s/%s\22>\0A\00"
define void @document_output_stylesheet(i32* nocapture %0, i8* %1, i8* %2) {
%4 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
ret void
}
/* Variables and functions */
scalar_t__ islower(int);
int toupper(int c) {
  if (islower(c))
    return c - 32;
  return c;
}


x86 assembly (clang, -O0):
<toupper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     113b <toupper+0x2b>
mov    -0x8(%rbp),%eax
sub    $0x20,%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <toupper+0x31>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toupper>:
push   %rbx
mov    %edi,%ebx
call   1030 <islower@plt>
lea    -0x20(%rbx),%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @toupper(i32 %0) {
%2 = tail call i64 @islower(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = add nsw i32 %0, -32
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
int test_imm_D6uint16_mem(unsigned short *val) {
  return ((*val) & (0xD6 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D6uint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
and    $0xd6,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_D6uint16_mem>:
testb  $0xd6,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_D6uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 214
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_context_set_source_port_by_name() {
  printf("NOT IMPLEMENTED:"
         "pa_context_set_source_port_by_name"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [51 x i8] c"NOT IMPLEMENTED:pa_context_set_source_port_by_name\00"
define i32 @pa_context_set_source_port_by_name() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
unsigned char rotate(unsigned char a, unsigned char b) {
  unsigned char v = a * b;
  return (v | (v >> 4)) & 0xf;
}


x86 assembly (clang, -O0):
<rotate>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
imul   %ecx,%eax
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
movzbl -0x3(%rbp),%ecx
sar    $0x4,%ecx
or     %ecx,%eax
and    $0xf,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rotate>:
mov    %esi,%eax
mul    %dil
mov    %eax,%ecx
shr    $0x4,%cl
and    $0xf,%al
or     %cl,%al
ret

LLVM IR (-O0):
define zeroext i8 @rotate(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
%8 = load i8, i8* %4
%9 = zext i8 %8 to i32
%10 = mul nsw i32 %7, %9
%11 = trunc i32 %10 to i8
store i8 %11, i8* %5
%12 = load i8, i8* %5
%13 = zext i8 %12 to i32
%14 = load i8, i8* %5
%15 = zext i8 %14 to i32
%16 = ashr i32 %15, 4
%17 = or i32 %13, %16
%18 = and i32 %17, 15
%19 = trunc i32 %18 to i8
ret i8 %19
}

LLVM IR (-O2):
define zeroext i8 @rotate(i8 zeroext %0, i8 zeroext %1) {
%3 = mul i8 %1, %0
%4 = lshr i8 %3, 4
%5 = and i8 %3, 15
%6 = or i8 %4, %5
ret i8 %6
}
void vectorSubtract(float dest[3], const float a[3], const float b[3]) {
  int i;
  for (i = 0; i < 3; i++)
    dest[i] = a[i] - b[i];
}


x86 assembly (clang, -O0):
<vectorSubtract>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1156 <vectorSubtract+0x56>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
subss  (%rax,%rcx,4),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <vectorSubtract+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vectorSubtract>:
movss  (%rsi),%xmm0
subss  (%rdx),%xmm0
movss  %xmm0,(%rdi)
movss  0x4(%rsi),%xmm0
subss  0x4(%rdx),%xmm0
movss  %xmm0,0x4(%rdi)
movss  0x8(%rsi),%xmm0
subss  0x8(%rdx),%xmm0
movss  %xmm0,0x8(%rdi)
ret

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

LLVM IR (-O2):
define void @vectorSubtract(float* nocapture writeonly %0, float* nocapture %1, float* nocapture %2) {
%4 = load float, float* %1
%5 = load float, float* %2
%6 = fsub float %4, %5
store float %6, float* %0
%7 = getelementptr inbounds float, float* %1, i64 1
%8 = load float, float* %7
%9 = getelementptr inbounds float, float* %2, i64 1
%10 = load float, float* %9
%11 = fsub float %8, %10
%12 = getelementptr inbounds float, float* %0, i64 1
store float %11, float* %12
%13 = getelementptr inbounds float, float* %1, i64 2
%14 = load float, float* %13
%15 = getelementptr inbounds float, float* %2, i64 2
%16 = load float, float* %15
%17 = fsub float %14, %16
%18 = getelementptr inbounds float, float* %0, i64 2
store float %17, float* %18
ret void
}
/* Type definitions */
typedef int useconds_t;
typedef scalar_t__ clock_t;

/* Variables and functions */
int CLOCKS_PER_SEC;
scalar_t__ _clock();
int __attribute__((weak)) usleep(useconds_t useconds) {
  clock_t t0 = _clock();
  clock_t dt = useconds / (1000000 / CLOCKS_PER_SEC);
  while (_clock() - t0 < dt)
    ;
  return 0;
}


x86 assembly (clang, -O0):
<usleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <_clock@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    $0xf4240,%eax
mov    0x2eb0(%rip),%rcx
cltd
idivl  (%rcx)
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
cltd
idiv   %ecx
cltq
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <_clock@plt>
sub    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1163 <usleep+0x53>
jmp    1149 <usleep+0x39>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usleep>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <_clock@plt>
mov    %rax,%rbx
mov    0x2ec2(%rip),%rcx
mov    $0xf4240,%eax
xor    %edx,%edx
idivl  (%rcx)
mov    %eax,%ecx
mov    %ebp,%eax
cltd
idiv   %ecx
movslq %eax,%rbp
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <_clock@plt>
sub    %rbx,%rax
cmp    %rbp,%rax
jl     1140 <usleep+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@CLOCKS_PER_SEC = global i32 0
define weak i32 @usleep(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i32 %0, i32* %2
%5 = call i64 (...) @_clock()
store i64 %5, i64* %3
%6 = load i32, i32* %2
%7 = load i32, i32* @CLOCKS_PER_SEC
%8 = sdiv i32 1000000, %7
%9 = sdiv i32 %6, %8
%10 = sext i32 %9 to i64
store i64 %10, i64* %4
br label %11
11: ; preds = %17, %1
%12 = call i64 (...) @_clock()
%13 = load i64, i64* %3
%14 = sub nsw i64 %12, %13
%15 = load i64, i64* %4
%16 = icmp slt i64 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %11
br label %11
18: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@CLOCKS_PER_SEC = global i32 0
define weak i32 @usleep(i32 %0) {
%2 = tail call i64 (...) @_clock()
%3 = load i32, i32* @CLOCKS_PER_SEC
%4 = sdiv i32 1000000, %3
%5 = sdiv i32 %0, %4
%6 = sext i32 %5 to i64
br label %7
7: ; preds = %7, %1
%8 = tail call i64 (...) @_clock()
%9 = sub nsw i64 %8, %2
%10 = icmp slt i64 %9, %6
br i1 %10, label %7, label %11
11: ; preds = %7
ret i32 0
}
/* Variables and functions */
int EOF;
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  printf("%d", EOF);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@EOF = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @EOF
%4 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int arg6(int a1, int a2, int a3, int a4, int a5, int a6) {
  printf("%d\n", a1 + a2 + a3 + a4 + a5 + a6);
  return a6;
}


x86 assembly (clang, -O0):
<arg6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%esi
add    -0x8(%rbp),%esi
add    -0xc(%rbp),%esi
add    -0x10(%rbp),%esi
add    -0x14(%rbp),%esi
add    -0x18(%rbp),%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg6>:
push   %rbx
mov    %r9d,%ebx
add    %edi,%esi
add    %edx,%esi
add    %ecx,%esi
add    %r8d,%esi
add    %r9d,%esi
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @arg6(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 returned %5) {
%7 = add nsw i32 %1, %0
%8 = add nsw i32 %7, %2
%9 = add nsw i32 %8, %3
%10 = add nsw i32 %9, %4
%11 = add nsw i32 %10, %5
%12 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 %5
}
long double atanl(long double x) {
  long double res;
  asm("fld1\n\t"
      "fpatan"
      : "=t"(res)
      : "0"(x));
  return res;
}


x86 assembly (clang, -O0):
<atanl>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fld1
fpatan
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<atanl>:
fldt   0x8(%rsp)
fld1
fpatan
ret

LLVM IR (-O0):
define x86_fp80 @atanl(x86_fp80 %0) {
%2 = alloca x86_fp80
%3 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%4 = load x86_fp80, x86_fp80* %2
%5 = call x86_fp80 asm "fld1\0A\09fpatan", "={st},0,~{dirflag},~{fpsr},~{flags}"(x86_fp80 %4)
store x86_fp80 %5, x86_fp80* %3
%6 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %6
}

LLVM IR (-O2):
define x86_fp80 @atanl(x86_fp80 %0) {
%2 = tail call x86_fp80 asm "fld1\0A\09fpatan", "={st},0,~{dirflag},~{fpsr},~{flags}"(x86_fp80 %0)
ret x86_fp80 %2
}
char *get_help(char *name) {
  return "Usage: %s [options]\n"
         "Options:\n"
         " -p          Will only print informations\n"
         " -s          Will actually split the image\n"
         " -f FILENAME The PPM file to read from\n";
}


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

x86 assembly (clang, -O2):
<get_help>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [154 x i8] c"Usage: %s [options]\0AOptions:\0A -p Will only print informations\0A -s Will actually split the image\0A -f FILENAME The PPM file to read from\0A\00"
define i8* @get_help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [154 x i8] c"Usage: %s [options]\0AOptions:\0A -p Will only print informations\0A -s Will actually split the image\0A -f FILENAME The PPM file to read from\0A\00"
define i8* @get_help(i8* nocapture readnone %0) {
ret i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str, i64 0, i64 0)
}
int do_695() { return 695; }


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

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

LLVM IR (-O0):
define i32 @do_695() {
ret i32 695
}

LLVM IR (-O2):
define i32 @do_695() {
ret i32 695
}
void read_littleEndian_ushort(unsigned short *dest, unsigned char *source) {
  *dest = *(unsigned short *)source;
}


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

x86 assembly (clang, -O2):
<read_littleEndian_ushort>:
movzwl (%rsi),%eax
mov    %ax,(%rdi)
ret

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

LLVM IR (-O2):
define void @read_littleEndian_ushort(i16* nocapture writeonly %0, i8* nocapture %1) {
%3 = bitcast i8* %1 to i16*
%4 = load i16, i16* %3
store i16 %4, i16* %0
ret void
}
void foo525() {}


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

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

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

LLVM IR (-O2):
define void @foo525() {
ret void
}
/* Variables and functions */
int arc4random();
int getRandInt(int low, int high) {
  high += 1;
  return low + arc4random() % (high - low);
}


x86 assembly (clang, -O0):
<getRandInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <arc4random@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
add    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getRandInt>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <arc4random@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getRandInt(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = add nsw i32 %5, 1
store i32 %6, i32* %4
%7 = load i32, i32* %3
%8 = call i32 (...) @arc4random()
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = sub nsw i32 %9, %10
%12 = srem i32 %8, %11
%13 = add nsw i32 %7, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @getRandInt(i32 %0, i32 %1) {
%3 = tail call i32 (...) @arc4random()
%4 = sub i32 1, %0
%5 = add i32 %4, %1
%6 = srem i32 %3, %5
%7 = add nsw i32 %6, %0
ret i32 %7
}
/* Type definitions */
typedef int uint64_t;
typedef scalar_t__ uint32_t;

/* Variables and functions */
scalar_t__ ntohl(scalar_t__);
uint64_t ntohll(uint64_t value) {
  int endian_test = 1;
  if (endian_test == *((char *)(&endian_test))) {
    uint32_t low = ntohl((uint32_t)(value & 0xFFFFFFFFLL));
    uint32_t high = ntohl((uint32_t)(value >> 32));
    value = ((uint64_t)(low) << 32) | (uint64_t)(high);
  }
  return value;
}


x86 assembly (clang, -O0):
<ntohll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
movsbl -0x8(%rbp),%ecx
cmp    %ecx,%eax
jne    1175 <ntohll+0x65>
movslq -0x4(%rbp),%rdi
movabs $0xffffffff,%rax
and    %rax,%rdi
call   1030 <ntohl@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x20,%ecx
sar    %cl,%eax
movslq %eax,%rdi
call   1030 <ntohl@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    $0x20,%ecx
shl    %cl,%eax
mov    -0x18(%rbp),%rcx
or     %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ntohll>:
push   %rbx
mov    %edi,%ebx
mov    %edi,%edi
call   1030 <ntohl@plt>
call   1030 <ntohl@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @ntohll(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
store i32 %0, i32* %2
store i32 1, i32* %3
%6 = load i32, i32* %3
%7 = bitcast i32* %3 to i8*
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %6, %9
br i1 %10, label %11, label %26
11: ; preds = %1
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = and i64 %13, 4294967295
%15 = call i64 @ntohl(i64 %14)
store i64 %15, i64* %4
%16 = load i32, i32* %2
%17 = ashr i32 %16, 32
%18 = sext i32 %17 to i64
%19 = call i64 @ntohl(i64 %18)
store i64 %19, i64* %5
%20 = load i64, i64* %4
%21 = trunc i64 %20 to i32
%22 = shl i32 %21, 32
%23 = load i64, i64* %5
%24 = trunc i64 %23 to i32
%25 = or i32 %22, %24
store i32 %25, i32* %2
br label %26
26: ; preds = %11, %1
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @ntohll(i32 returned %0) {
%2 = zext i32 %0 to i64
%3 = tail call i64 @ntohl(i64 %2)
%4 = tail call i64 @ntohl(i64 poison)
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void efree(void *p) {
  if (p)
    free(p);
}


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

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

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

LLVM IR (-O2):
define void @efree(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @free(i8* %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ select(int, int);
int main(void) {
  select(10, 20);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xa,%edi
mov    $0x14,%esi
call   1030 <select@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @select(i32 10, i32 20)
ret i32 0
}
int NextPosIdx(int pos) {
  if (pos == 100 - 1)
    return 0;
  else
    return pos + 1;
}


x86 assembly (clang, -O0):
<NextPosIdx>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x63,-0x8(%rbp)
jne    111d <NextPosIdx+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    1126 <NextPosIdx+0x26>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<NextPosIdx>:
lea    0x1(%rdi),%ecx
xor    %eax,%eax
cmp    $0x63,%edi
cmovne %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @NextPosIdx(i32 %0) {
%2 = icmp eq i32 %0, 99
%3 = add nsw i32 %0, 1
%4 = select i1 %2, i32 0, i32 %3
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ const int64_t;

/* Variables and functions */
int64_t compute_numbytes_with_off(const int64_t off, const int64_t start) {
  return off - start;
}


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

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

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

LLVM IR (-O2):
define i64 @compute_numbytes_with_off(i64 %0, i64 %1) {
%3 = sub nsw i64 %0, %1
ret i64 %3
}
/* Variables and functions */
int any(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  char s[] = "hello, world\n";
  printf("%d\n", any(s, "flag"));
  printf("%d\n", any(s, "mz"));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xec2(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0x12(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <any@plt>
mov    %eax,%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
lea    -0x12(%rbp),%rdi
lea    0xea0(%rip),%rsi
call   1040 <any@plt>
mov    %eax,%esi
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movabs $0xa646c726f7720,%rax
mov    %rax,0xe(%rsp)
movabs $0x77202c6f6c6c6568,%rax
2c 20 77
mov    %rax,0x8(%rsp)
lea    0xec6(%rip),%rsi
lea    0x8(%rsp),%r14
mov    %r14,%rdi
call   1040 <any@plt>
lea    0xeae(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0xea6(%rip),%rsi
mov    %r14,%rdi
call   1040 <any@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.s = [14 x i8] c"hello, world\0A\00"
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [5 x i8] c"flag\00"
@.str.2 = [3 x i8] c"mz\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [14 x i8]
store i32 0, i32* %1
%3 = bitcast [14 x i8]* %2 to i8*
%4 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%5 = call i32 @any(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%8 = call i32 @any(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [14 x i8] c"hello, world\0A\00"
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [5 x i8] c"flag\00"
@.str.2 = [3 x i8] c"mz\00"
define i32 @main() {
%1 = alloca [14 x i8]
%2 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 0
%3 = call i32 @any(i8* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 @any(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
void fn1(int p) {}


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

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

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

LLVM IR (-O2):
define void @fn1(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ compare_and_swap(long *, long, long);
void foo(long *address) {
  long he_address = *address & ~1;
  while (!compare_and_swap(address, he_address, he_address | 1))
    he_address = *address & ~1;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
and    $0xfffffffffffffffe,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x10(%rbp),%rdx
or     $0x1,%rdx
call   1030 <compare_and_swap@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1155 <foo+0x45>
jmp    1169 <foo+0x59>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
and    $0xfffffffffffffffe,%rax
mov    %rax,-0x10(%rbp)
jmp    112b <foo+0x1b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rbx),%rdx
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
or     $0x1,%rdx
mov    %rbx,%rdi
call   1030 <compare_and_swap@plt>
test   %eax,%eax
je     1120 <foo+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @foo(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
store i64* %0, i64** %2
%4 = load i64*, i64** %2
%5 = load i64, i64* %4
%6 = and i64 %5, -2
store i64 %6, i64* %3
br label %7
7: ; preds = %15, %1
%8 = load i64*, i64** %2
%9 = load i64, i64* %3
%10 = load i64, i64* %3
%11 = or i64 %10, 1
%12 = call i32 @compare_and_swap(i64* %8, i64 %9, i64 %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br i1 %14, label %15, label %19
15: ; preds = %7
%16 = load i64*, i64** %2
%17 = load i64, i64* %16
%18 = and i64 %17, -2
store i64 %18, i64* %3
br label %7
19: ; preds = %7
ret void
}

LLVM IR (-O2):
define void @foo(i64* %0) {
br label %2
2: ; preds = %2, %1
%3 = load i64, i64* %0
%4 = and i64 %3, -2
%5 = or i64 %3, 1
%6 = tail call i32 @compare_and_swap(i64* %0, i64 %4, i64 %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %2, label %8
8: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_num(int);
int main() {
  print_num(100);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x64,%edi
call   1030 <print_num@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @print_num(i32 100)
ret i32 0
}
void swap() {
  double x = pop(), y = pop();
  push(x), push(y);
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <pop@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    $0x0,%al
call   1030 <pop@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%al
call   1040 <push@plt>
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
call   1040 <push@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
sub    $0x18,%rsp
xor    %eax,%eax
call   1030 <pop@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1030 <pop@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1040 <push@plt>
movsd  0x8(%rsp),%xmm0
mov    $0x1,%al
add    $0x18,%rsp
jmp    1040 <push@plt>

LLVM IR (-O0):
define void @swap() {
%1 = alloca double
%2 = alloca double
%3 = call i32 (...) @pop()
%4 = sitofp i32 %3 to double
store double %4, double* %1
%5 = call i32 (...) @pop()
%6 = sitofp i32 %5 to double
store double %6, double* %2
%7 = load double, double* %1
%8 = call i32 (double, ...) bitcast (i32 (...)* @push to i32 (double, ...)*)(double %7)
%9 = load double, double* %2
%10 = call i32 (double, ...) bitcast (i32 (...)* @push to i32 (double, ...)*)(double %9)
ret void
}

LLVM IR (-O2):
define void @swap() {
%1 = tail call i32 (...) @pop()
%2 = sitofp i32 %1 to double
%3 = tail call i32 (...) @pop()
%4 = sitofp i32 %3 to double
%5 = tail call i32 (double, ...) bitcast (i32 (...)* @push to i32 (double, ...)*)(double %2)
%6 = tail call i32 (double, ...) bitcast (i32 (...)* @push to i32 (double, ...)*)(double %4)
ret void
}
void current_fs_time(void) { nsc_assert(0, __func__); }


x86 assembly (clang, -O0):
<current_fs_time>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
mov    $0x0,%al
call   1030 <nsc_assert@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<current_fs_time>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
xor    %eax,%eax
jmp    1030 <nsc_assert@plt>

LLVM IR (-O0):
@__func__.current_fs_time = [16 x i8] c"current_fs_time\00"
define void @current_fs_time() {
%1 = call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @__func__.current_fs_time, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.current_fs_time = [16 x i8] c"current_fs_time\00"
define void @current_fs_time() {
%1 = tail call i32 (i32, i8*, ...) bitcast (i32 (...)* @nsc_assert to i32 (i32, i8*, ...)*)(i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @__func__.current_fs_time, i64 0, i64 0))
ret void
}
void f75(void) {
  ({
    ({ 0; });
    ({ 0; });
    goto a;
  a:
    0;
  });
  ({
    ({ 0; });
    ({ 0; });
    0;
  });
  0;
}


x86 assembly (clang, -O0):
<f75>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f75() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = load i32, i32* %1
store i32 0, i32* %2
%8 = load i32, i32* %2
br label %9
9: ; preds = %0
store i32 0, i32* %3
%10 = load i32, i32* %3
store i32 0, i32* %4
%11 = load i32, i32* %4
store i32 0, i32* %5
%12 = load i32, i32* %5
store i32 0, i32* %6
%13 = load i32, i32* %6
ret void
}

LLVM IR (-O2):
define void @f75() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ reader_work(void *);
void *reader_one_off(void *data) {
  reader_work(data);
  return NULL;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @reader_one_off(i8* %0) {
%2 = tail call i32 @reader_work(i8* %0)
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main(void) {
  struct date {
    int month;
    int day;
    int year;
  };
  struct date today, *datePtr = &today;
  datePtr->month = 8;
  datePtr->day = 16;
  datePtr->year = 2017;
  printf("Today's date is %i/%i/%i\n", datePtr->month, datePtr->day,
         datePtr->year % 100);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x8,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x10,0x4(%rax)
mov    -0x18(%rbp),%rax
movl   $0x7e1,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x1c(%rbp),%edx
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x8,%esi
mov    $0x10,%edx
mov    $0x11,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.date = type { i32, i32, i32 }
@.str = [26 x i8] c"Today's date is %i/%i/%i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.date
%3 = alloca %struct.date*
store i32 0, i32* %1
store %struct.date* %2, %struct.date** %3
%4 = load %struct.date*, %struct.date** %3
%5 = getelementptr inbounds %struct.date, %struct.date* %4, i32 0, i32 0
store i32 8, i32* %5
%6 = load %struct.date*, %struct.date** %3
%7 = getelementptr inbounds %struct.date, %struct.date* %6, i32 0, i32 1
store i32 16, i32* %7
%8 = load %struct.date*, %struct.date** %3
%9 = getelementptr inbounds %struct.date, %struct.date* %8, i32 0, i32 2
store i32 2017, i32* %9
%10 = load %struct.date*, %struct.date** %3
%11 = getelementptr inbounds %struct.date, %struct.date* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = load %struct.date*, %struct.date** %3
%14 = getelementptr inbounds %struct.date, %struct.date* %13, i32 0, i32 1
%15 = load i32, i32* %14
%16 = load %struct.date*, %struct.date** %3
%17 = getelementptr inbounds %struct.date, %struct.date* %16, i32 0, i32 2
%18 = load i32, i32* %17
%19 = srem i32 %18, 100
%20 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %15, i32 %19)
ret i32 0
}

LLVM IR (-O2):
%struct.date = type { i32, i32, i32 }
@.str = [26 x i8] c"Today's date is %i/%i/%i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 8, i32 16, i32 17)
ret i32 0
}
/* Variables and functions */
double rol(double, int);
double dblRol(double a, int b) { return rol(a, b); }


x86 assembly (clang, -O0):
<dblRol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0xc(%rbp),%edi
call   1030 <rol@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dblRol>:
jmp    1030 <rol@plt>

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

LLVM IR (-O2):
define double @dblRol(double %0, i32 %1) {
%3 = tail call double @rol(double %0, i32 %1)
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int x, *a, **b;
  x = 10;
  a = &x;
  b = &a;
  printf("The value of x is %d\n", *a);
  printf("The value of x through b is  %d\n\n", **b);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"The value of x is %d\0A\00"
@.str.1 = [34 x i8] c"The value of x through b is %d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32**
store i32 0, i32* %1
store i32 10, i32* %2
store i32* %2, i32** %3
store i32** %3, i32*** %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%7 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32**, i32*** %4
%9 = load i32*, i32** %8
%10 = load i32, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"The value of x is %d\0A\00"
@.str.1 = [34 x i8] c"The value of x through b is %d\0A\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 10)
ret i32 0
}
void memory_barrier(void) { __sync_synchronize(); }


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

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

LLVM IR (-O0):
define void @memory_barrier() {
fence seq_cst
ret void
}

LLVM IR (-O2):
define void @memory_barrier() {
fence seq_cst
ret void
}
/* Variables and functions */
int crypto_secretbox_xsalsa20poly1305(unsigned char *, unsigned char const *,
                                      unsigned long long, unsigned char const *,
                                      unsigned char const *);
int crypto_box_curve25519xsalsa20poly1305_afternm(unsigned char *c,
                                                  const unsigned char *m,
                                                  unsigned long long mlen,
                                                  const unsigned char *n,
                                                  const unsigned char *k) {
  return crypto_secretbox_xsalsa20poly1305(c, m, mlen, n, k);
}


x86 assembly (clang, -O0):
<crypto_box_curve25519xsalsa20poly1305_afternm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <crypto_secretbox_xsalsa20poly1305@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypto_box_curve25519xsalsa20poly1305_afternm>:
jmp    1030 <crypto_secretbox_xsalsa20poly1305@plt>

LLVM IR (-O0):
define i32 @crypto_box_curve25519xsalsa20poly1305_afternm(i8* %0, i8* %1, i64 %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %6
store i8* %1, i8** %7
store i64 %2, i64* %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = load i64, i64* %8
%14 = load i8*, i8** %9
%15 = load i8*, i8** %10
%16 = call i32 @crypto_secretbox_xsalsa20poly1305(i8* %11, i8* %12, i64 %13, i8* %14, i8* %15)
ret i32 %16
}

LLVM IR (-O2):
define i32 @crypto_box_curve25519xsalsa20poly1305_afternm(i8* %0, i8* %1, i64 %2, i8* %3, i8* %4) {
%6 = tail call i32 @crypto_secretbox_xsalsa20poly1305(i8* %0, i8* %1, i64 %2, i8* %3, i8* %4)
ret i32 %6
}