xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ check_byte_array(unsigned char *, unsigned int,
                                    int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ get_addl_ops();
int /*<<< orphan*/ get_addl_ops_len();
int /*<<< orphan*/ output_add(unsigned char *, int, unsigned int *);
void test_output_add() {
  unsigned char buffer[128];
  unsigned int bytes_written = 0;
  output_add(buffer, 128, &bytes_written);
  check_byte_array(buffer, bytes_written, get_addl_ops(), get_addl_ops_len());
}


x86 assembly (clang, -O0):
<test_output_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x84(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x80,%esi
lea    -0x84(%rbp),%rdx
call   1040 <output_add@plt>
lea    -0x80(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x8c(%rbp)
mov    $0x0,%al
call   1030 <get_addl_ops@plt>
mov    %eax,-0x88(%rbp)
mov    $0x0,%al
call   1060 <get_addl_ops_len@plt>
mov    -0x98(%rbp),%rdi
mov    -0x8c(%rbp),%esi
mov    -0x88(%rbp),%edx
mov    %eax,%ecx
call   1050 <check_byte_array@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_output_add>:
push   %rbp
push   %r14
push   %rbx
sub    $0x90,%rsp
movl   $0x0,0xc(%rsp)
lea    0x10(%rsp),%r14
lea    0xc(%rsp),%rdx
mov    %r14,%rdi
mov    $0x80,%esi
call   1040 <output_add@plt>
mov    0xc(%rsp),%ebp
xor    %eax,%eax
call   1030 <get_addl_ops@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <get_addl_ops_len@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %eax,%ecx
call   1050 <check_byte_array@plt>
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @test_output_add() {
%1 = alloca [128 x i8]
%2 = alloca i32
store i32 0, i32* %2
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%4 = call i32 @output_add(i8* %3, i32 128, i32* %2)
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%6 = load i32, i32* %2
%7 = call i32 (...) @get_addl_ops()
%8 = call i32 (...) @get_addl_ops_len()
%9 = call i32 @check_byte_array(i8* %5, i32 %6, i32 %7, i32 %8)
ret void
}

LLVM IR (-O2):
define void @test_output_add() {
%1 = alloca [128 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [128 x i8], [128 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = call i32 @output_add(i8* %3, i32 128, i32* %2)
%6 = load i32, i32* %2
%7 = call i32 (...) @get_addl_ops()
%8 = call i32 (...) @get_addl_ops_len()
%9 = call i32 @check_byte_array(i8* %3, i32 %6, i32 %7, i32 %8)
ret void
}
unsigned int bswap_16(unsigned int __x) { return (__x >> 8) | (__x << 8); }


x86 assembly (clang, -O0):
<bswap_16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
mov    -0x4(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bswap_16>:
mov    %edi,%eax
shr    $0x8,%eax
shl    $0x8,%edi
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @bswap_16(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 8
%5 = load i32, i32* %2
%6 = shl i32 %5, 8
%7 = or i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @bswap_16(i32 %0) {
%2 = lshr i32 %0, 8
%3 = shl i32 %0, 8
%4 = or i32 %2, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void usage(const char *cmd) {
  fprintf(stderr, "Usage: %s [-b bits]\n", cmd);
  fprintf(stderr, "	-b bits: set registers count = 2^bits [default 16]\n");
  exit(255);
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rbx
mov    (%rbx),%edi
lea    0xecc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xed1(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0xff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"Usage: %s [-b bits]\0A\00"
@.str.1 = [53 x i8] c"\09-b bits: set registers count = 2^bits [default 16]\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stderr
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @exit(i32 255)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"Usage: %s [-b bits]\0A\00"
@.str.1 = [53 x i8] c"\09-b bits: set registers count = 2^bits [default 16]\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @exit(i32 255)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void *malloc(int);
void *zero(void) {
  if (malloc(1000) == NULL) {
    exit(-1);
  }
  return malloc(2000);
}


x86 assembly (clang, -O0):
<zero>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3e8,%edi
call   1030 <malloc@plt>
cmp    $0x0,%rax
jne    1142 <zero+0x22>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
mov    $0x7d0,%edi
call   1030 <malloc@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<zero>:
mov    $0x7d0,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @zero() {
%1 = call i8* @malloc(i32 1000)
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = call i32 @exit(i32 -1)
unreachable
5: ; preds = %0
%6 = call i8* @malloc(i32 2000)
ret i8* %6
}

LLVM IR (-O2):
define noalias i8* @zero() {
%1 = tail call dereferenceable_or_null(2000) i8* @malloc(i32 2000)
ret i8* %1
}
/* Type definitions */
struct consolefontdesc {
  int dummy;
};
typedef int /*<<< orphan*/ f;

/* Variables and functions */
int main(void) {
  struct consolefontdesc f;
  (void)f;
  return sizeof(f);
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 4
}
void *gethostbyname(const char *name) { return 0; }


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

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

LLVM IR (-O0):
define i8* @gethostbyname(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @gethostbyname(i8* nocapture readnone %0) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int f(int);
main() {
  if (f(2) != 1)
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x2,%edi
call   1040 <f@plt>
cmp    $0x1,%eax
je     1159 <main+0x29>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
call   1040 <f@plt>
cmp    $0x1,%eax
jne    1147 <main+0x17>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @f(i32 2)
%3 = icmp ne i32 %2, 1
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 2)
%2 = icmp eq i32 %1, 1
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
struct rudp {
  int dummy;
};

/* Variables and functions */
int rudpReceiveFrom(struct rudp *, void *, int, int /*<<< orphan*/ *);
int rudpReceive(struct rudp *ru, void *messageBuf, int bufSize) {
  return rudpReceiveFrom(ru, messageBuf, bufSize, NULL);
}


x86 assembly (clang, -O0):
<rudpReceive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <rudpReceiveFrom@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rudpReceive>:
xor    %ecx,%ecx
jmp    1030 <rudpReceiveFrom@plt>

LLVM IR (-O0):
%struct.rudp = type { i32 }
define i32 @rudpReceive(%struct.rudp* %0, i8* %1, i32 %2) {
%4 = alloca %struct.rudp*
%5 = alloca i8*
%6 = alloca i32
store %struct.rudp* %0, %struct.rudp** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load %struct.rudp*, %struct.rudp** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @rudpReceiveFrom(%struct.rudp* %7, i8* %8, i32 %9, i32* null)
ret i32 %10
}

LLVM IR (-O2):
%struct.rudp = type { i32 }
define i32 @rudpReceive(%struct.rudp* %0, i8* %1, i32 %2) {
%4 = tail call i32 @rudpReceiveFrom(%struct.rudp* %0, i8* %1, i32 %2, i32* null)
ret i32 %4
}
/* Variables and functions */
double fmod(double, int);
double range_radians(double r) {
  r = fmod(r, 2. * 3.14159265358979323846);
  if (r < 0.)
    r += 2. * 3.14159265358979323846;
  return r;
}


x86 assembly (clang, -O0):
<range_radians>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x6,%edi
call   1030 <fmod@plt>
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1151 <range_radians+0x41>
movsd  0xeb9(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<range_radians>:
push   %rax
mov    $0x6,%edi
call   1030 <fmod@plt>
movsd  0xedd(%rip),%xmm2
addsd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @range_radians(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @fmod(double %3, i32 6)
store double %4, double* %2
%5 = load double, double* %2
%6 = fcmp olt double %5, 0.000000e+00
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load double, double* %2
%9 = fadd double %8, 0x401921FB54442D18
store double %9, double* %2
br label %10
10: ; preds = %7, %1
%11 = load double, double* %2
ret double %11
}

LLVM IR (-O2):
define double @range_radians(double %0) {
%2 = tail call double @fmod(double %0, i32 6)
%3 = fcmp olt double %2, 0.000000e+00
%4 = fadd double %2, 0x401921FB54442D18
%5 = select i1 %3, double %4, double %2
ret double %5
}
void write_text__(str) char *str;
{
  setcolor_pixmap(15);
  outtextxy_pixmap(getmaxx() - 100, getmaxy() - 20, str);
}


x86 assembly (clang, -O0):
<write_text__>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xf,%edi
mov    $0x0,%al
call   1040 <setcolor_pixmap@plt>
mov    $0x0,%al
call   1050 <getmaxx@plt>
sub    $0x64,%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <getmaxy@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
sub    $0x14,%esi
mov    -0x8(%rbp),%rdx
mov    $0x0,%al
call   1060 <outtextxy_pixmap@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_text__>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0xf,%edi
xor    %eax,%eax
call   1040 <setcolor_pixmap@plt>
xor    %eax,%eax
call   1050 <getmaxx@plt>
lea    -0x64(%rax),%ebp
xor    %eax,%eax
call   1030 <getmaxy@plt>
lea    -0x14(%rax),%esi
mov    %ebp,%edi
mov    %rbx,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1060 <outtextxy_pixmap@plt>

LLVM IR (-O0):
define void @write_text__(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i32, ...) bitcast (i32 (...)* @setcolor_pixmap to i32 (i32, ...)*)(i32 15)
%4 = call i32 (...) @getmaxx()
%5 = sub nsw i32 %4, 100
%6 = call i32 (...) @getmaxy()
%7 = sub nsw i32 %6, 20
%8 = load i8*, i8** %2
%9 = call i32 (i32, i32, i8*, ...) bitcast (i32 (...)* @outtextxy_pixmap to i32 (i32, i32, i8*, ...)*)(i32 %5, i32 %7, i8* %8)
ret void
}

LLVM IR (-O2):
define void @write_text__(i8* %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @setcolor_pixmap to i32 (i32, ...)*)(i32 15)
%3 = tail call i32 (...) @getmaxx()
%4 = add nsw i32 %3, -100
%5 = tail call i32 (...) @getmaxy()
%6 = add nsw i32 %5, -20
%7 = tail call i32 (i32, i32, i8*, ...) bitcast (i32 (...)* @outtextxy_pixmap to i32 (i32, i32, i8*, ...)*)(i32 %4, i32 %6, i8* %0)
ret void
}
float dist(int i1, int j1, int i2, int j2) {
  return ((i1 - i2) * (i1 - i2) + (j1 - j2) * (j1 - j2));
}


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

x86 assembly (clang, -O2):
<dist>:
sub    %edx,%edi
imul   %edi,%edi
sub    %ecx,%esi
imul   %esi,%esi
add    %edi,%esi
cvtsi2ss %esi,%xmm0
ret

LLVM IR (-O0):
define float @dist(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* %7
%11 = sub nsw i32 %9, %10
%12 = load i32, i32* %5
%13 = load i32, i32* %7
%14 = sub nsw i32 %12, %13
%15 = mul nsw i32 %11, %14
%16 = load i32, i32* %6
%17 = load i32, i32* %8
%18 = sub nsw i32 %16, %17
%19 = load i32, i32* %6
%20 = load i32, i32* %8
%21 = sub nsw i32 %19, %20
%22 = mul nsw i32 %18, %21
%23 = add nsw i32 %15, %22
%24 = sitofp i32 %23 to float
ret float %24
}

LLVM IR (-O2):
define float @dist(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %0, %2
%6 = mul nsw i32 %5, %5
%7 = sub nsw i32 %1, %3
%8 = mul nsw i32 %7, %7
%9 = add nuw nsw i32 %8, %6
%10 = sitofp i32 %9 to float
ret float %10
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t precoding_bits_f2(uint32_t nof_ports) {
  if (nof_ports <= 2) {
    return 3;
  } else {
    return 6;
  }
}


x86 assembly (clang, -O0):
<precoding_bits_f2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jg     111d <precoding_bits_f2+0x1d>
movl   $0x3,-0x4(%rbp)
jmp    1124 <precoding_bits_f2+0x24>
movl   $0x6,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<precoding_bits_f2>:
xor    %eax,%eax
cmp    $0x3,%edi
setge  %al
lea    (%rax,%rax,2),%eax
add    $0x3,%eax
ret

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

LLVM IR (-O2):
define i32 @precoding_bits_f2(i32 %0) {
%2 = icmp slt i32 %0, 3
%3 = select i1 %2, i32 3, i32 6
ret i32 %3
}
void DefaultHandler(void) {
  while (1)
    ;
}


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

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

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

LLVM IR (-O2):
define void @DefaultHandler() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ send_repl_client_len(int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int send_repl_client(int send_sock, char *msg) {
  send_repl_client_len(send_sock, msg, strlen(msg));
  return 0;
}


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

x86 assembly (clang, -O2):
<send_repl_client>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <send_repl_client_len@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @send_repl_client(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @send_repl_client_len(i32 %0, i8* %1, i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ leaf();
__attribute__((optimize("omit-frame-pointer"))) void non_leaf_1(void) {
  leaf();
}


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

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

LLVM IR (-O0):
define void @non_leaf_1() {
%1 = call i32 (...) @leaf()
ret void
}

LLVM IR (-O2):
define void @non_leaf_1() {
%1 = tail call i32 (...) @leaf()
ret void
}
int test_imm_48uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x48 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_48uint64_midword_reg>:
test   $0x480000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_48uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 4718592
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ glutWireDodecahedron();
void drawWireDodecahedron(void) { glutWireDodecahedron(); }


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

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

LLVM IR (-O0):
define void @drawWireDodecahedron() {
%1 = call i32 (...) @glutWireDodecahedron()
ret void
}

LLVM IR (-O2):
define void @drawWireDodecahedron() {
%1 = tail call i32 (...) @glutWireDodecahedron()
ret void
}
void rek() { return; }


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

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

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

LLVM IR (-O2):
define void @rek() {
ret void
}
int tamAI(unsigned int ninodos) {
  int tamArrayInodos = (ninodos * 128) / 1024;
  int aux = (ninodos * 128) % 1024;
  if (aux != 0) {
    tamArrayInodos++;
  }
  return tamArrayInodos;
}


x86 assembly (clang, -O0):
<tamAI>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x7,%eax
shr    $0xa,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x7,%eax
and    $0x3ff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1134 <tamAI+0x34>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tamAI>:
mov    %edi,%eax
shr    $0x3,%eax
and    $0x3fffff,%eax
and    $0x7,%edi
cmp    $0x1,%edi
sbb    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @tamAI(i32 %0) {
%2 = lshr i32 %0, 3
%3 = and i32 %2, 4194303
%4 = and i32 %0, 7
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
%7 = add nuw nsw i32 %3, %6
ret i32 %7
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ major_code;
};
struct TYPE_4__ {
  TYPE_1__ xgraphicsexpose;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
int get_XEvent_xgraphicsexpose_major_code(void *_p) {
  return (int)((XEvent *)_p)->xgraphicsexpose.major_code;
}


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

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

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

LLVM IR (-O2):
define i32 @get_XEvent_xgraphicsexpose_major_code(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef unsigned long volatile uint32_t;

/* Variables and functions */
uint32_t HibernateRTCSSMatchGet(uint32_t ui32Match) {
  ;
  return ((*((volatile unsigned long *)(0x400FC028))) >> 16);
}


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

x86 assembly (clang, -O2):
<HibernateRTCSSMatchGet>:
mov    %rdi,-0x8(%rsp)
mov    0x400fc028,%rax
40
shr    $0x10,%rax
ret

LLVM IR (-O0):
define i64 @HibernateRTCSSMatchGet(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* inttoptr (i64 1074774056 to i64*)
%4 = lshr i64 %3, 16
ret i64 %4
}

LLVM IR (-O2):
define i64 @HibernateRTCSSMatchGet(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* inttoptr (i64 1074774056 to i64*)
%4 = lshr i64 %3, 16
ret i64 %4
}
void f3(void) {
#pragma omp ordered threads, simd
  ;
}


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

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

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

LLVM IR (-O2):
define void @f3() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ result;

/* Variables and functions */
int atoi(char const *);
int fib(int);
int /*<<< orphan*/ snprintf(char *, int, char *, int);
char const *strdup(char *);
const char *handler(const char *input) {
  int n = atoi(input);
  n = fib(n);
  char result[100];
  snprintf(result, sizeof(result) - 1, "%d", n);
  return strdup(result);
}


x86 assembly (clang, -O0):
<handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <fib@plt>
mov    %eax,-0xc(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    $0x63,%esi
lea    0xe8a(%rip),%rdx
call   1030 <snprintf@plt>
lea    -0x70(%rbp),%rdi
call   1060 <strdup@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<handler>:
push   %rbx
sub    $0x70,%rsp
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <fib@plt>
lea    0xea8(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x63,%esi
mov    %eax,%ecx
call   1030 <snprintf@plt>
mov    %rbx,%rdi
call   1060 <strdup@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i8* @handler(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [100 x i8]
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @atoi(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @fib(i32 %7)
store i32 %8, i32* %3
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%10 = load i32, i32* %3
%11 = call i32 @snprintf(i8* %9, i32 99, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%13 = call i8* @strdup(i8* %12)
ret i8* %13
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define noalias i8* @handler(i8* nocapture %0) {
%2 = alloca [100 x i8]
%3 = tail call i32 @atoi(i8* %0)
%4 = tail call i32 @fib(i32 %3)
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @snprintf(i8* %5, i32 99, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
%7 = call i8* @strdup(i8* %5)
ret i8* %7
}
unsigned int get32bit(unsigned char *p) {
  return (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
}


x86 assembly (clang, -O0):
<get32bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
shl    $0x18,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x2(%rcx),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%rcx
movzbl 0x3(%rcx),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get32bit>:
mov    (%rdi),%eax
bswap  %eax
ret

LLVM IR (-O0):
define i32 @get32bit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = shl i32 %6, 24
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 16
%13 = or i32 %7, %12
%14 = load i8*, i8** %2
%15 = getelementptr inbounds i8, i8* %14, i64 2
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = or i32 %13, %18
%20 = load i8*, i8** %2
%21 = getelementptr inbounds i8, i8* %20, i64 3
%22 = load i8, i8* %21
%23 = zext i8 %22 to i32
%24 = or i32 %19, %23
ret i32 %24
}

LLVM IR (-O2):
define i32 @get32bit(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i32
%4 = shl nuw i32 %3, 24
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = zext i8 %6 to i32
%8 = shl nuw nsw i32 %7, 16
%9 = or i32 %8, %4
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 8
%14 = or i32 %9, %13
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = load i8, i8* %15
%17 = zext i8 %16 to i32
%18 = or i32 %14, %17
ret i32 %18
}
/* Type definitions */
struct libavl_allocator {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
void *malloc(size_t);
void *rb_malloc(struct libavl_allocator *allocator, size_t size) {
  assert(allocator != NULL && size > 0);
  return malloc(size);
}


x86 assembly (clang, -O0):
<rb_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     114b <rb_malloc+0x2b>
cmpq   $0x0,-0x10(%rbp)
seta   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1040 <malloc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rb_malloc>:
push   %rbx
mov    %rsi,%rbx
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <malloc@plt>

LLVM IR (-O0):
%struct.libavl_allocator = type { i32 }
define i8* @rb_malloc(%struct.libavl_allocator* %0, i64 %1) {
%3 = alloca %struct.libavl_allocator*
%4 = alloca i64
store %struct.libavl_allocator* %0, %struct.libavl_allocator** %3
store i64 %1, i64* %4
%5 = load %struct.libavl_allocator*, %struct.libavl_allocator** %3
%6 = icmp ne %struct.libavl_allocator* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i64, i64* %4
%9 = icmp ugt i64 %8, 0
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ false, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i64, i64* %4
%15 = call i8* @malloc(i64 %14)
ret i8* %15
}

LLVM IR (-O2):
%struct.libavl_allocator = type { i32 }
define noalias i8* @rb_malloc(%struct.libavl_allocator* readnone %0, i64 %1) {
%3 = icmp ne %struct.libavl_allocator* %0, null
%4 = icmp ne i64 %1, 0
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i8* @malloc(i64 %1)
ret i8* %8
}
int isPrime(unsigned long number) {
  unsigned long i;
  if (number <= 1) {
    return 0;
  }
  for (i = 2; i * i <= number; i++) {
    if (number % i == 0) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<isPrime>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x1,-0x10(%rbp)
ja     111f <isPrime+0x1f>
movl   $0x0,-0x4(%rbp)
jmp    1179 <isPrime+0x79>
movq   $0x2,-0x18(%rbp)
mov    -0x18(%rbp),%rax
imul   -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     1172 <isPrime+0x72>
mov    -0x10(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x18(%rbp)
cmp    $0x0,%rdx
jne    115c <isPrime+0x5c>
movl   $0x0,-0x4(%rbp)
jmp    1179 <isPrime+0x79>
jmp    1161 <isPrime+0x61>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1127 <isPrime+0x27>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPrime>:
xor    %ecx,%ecx
cmp    $0x2,%rdi
jb     115b <isPrime+0x5b>
mov    $0x1,%ecx
cmp    $0x4,%rdi
jb     115b <isPrime+0x5b>
mov    $0x2,%esi
nopl   0x0(%rax,%rax,1)
mov    %rdi,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     1140 <isPrime+0x40>
mov    %rdi,%rax
xor    %edx,%edx
div    %rsi
test   %rdx,%rdx
jne    114b <isPrime+0x4b>
jmp    115e <isPrime+0x5e>
nopl   0x0(%rax,%rax,1)
mov    %edi,%eax
xor    %edx,%edx
div    %esi
test   %rdx,%rdx
je     115e <isPrime+0x5e>
add    $0x1,%rsi
mov    %rsi,%rax
imul   %rsi,%rax
cmp    %rdi,%rax
jbe    1120 <isPrime+0x20>
mov    %ecx,%eax
ret
xor    %ecx,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @isPrime(i64 %0) {
%2 = icmp ult i64 %0, 2
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = icmp ult i64 %0, 4
br i1 %4, label %13, label %8
5: ; preds = %8
%6 = mul i64 %12, %12
%7 = icmp ugt i64 %6, %0
br i1 %7, label %13, label %8
8: ; preds = %3, %5
%9 = phi i64 [ %12, %5 ], [ 2, %3 ]
%10 = urem i64 %0, %9
%11 = icmp eq i64 %10, 0
%12 = add i64 %9, 1
br i1 %11, label %13, label %5
13: ; preds = %8, %5, %3, %1
%14 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 0, %8 ], [ 1, %5 ]
ret i32 %14
}
/* Variables and functions */
int sum(int);
int main() {
  int n = 9;
  *(int *)0x07FC = sum(n);
  while (1) {
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x9,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <sum@plt>
mov    %eax,%ecx
mov    $0x7fc,%eax
mov    %ecx,(%rax)
jmp    1137 <main+0x27>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x9,%edi
call   1030 <sum@plt>
mov    %eax,0x7fc
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
jmp    1130 <main+0x20>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 9, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @sum(i32 %3)
store i32 %4, i32* inttoptr (i64 2044 to i32*)
br label %5
5: ; preds = %0, %5
br label %5
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @sum(i32 9)
store i32 %1, i32* inttoptr (i64 2044 to i32*)
br label %2
2: ; preds = %2, %0
br label %2
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
bool UARTCharsAvail(uint32_t ui32Base) {
  ;
  return (((*((volatile unsigned long *)(ui32Base + 0x00000018))) & 0x00000010)
              ? false
              : true);
}


x86 assembly (clang, -O0):
<UARTCharsAvail>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rdx
and    $0x10,%rdx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTCharsAvail>:
mov    0x18(%rdi),%rcx
xor    %eax,%eax
test   $0x10,%cl
sete   %al
ret

LLVM IR (-O0):
define i32 @UARTCharsAvail(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = add nsw i64 %3, 24
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, 16
%8 = icmp ne i64 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 0, i32 1
ret i32 %10
}

LLVM IR (-O2):
define i32 @UARTCharsAvail(i64 %0) {
%2 = add nsw i64 %0, 24
%3 = inttoptr i64 %2 to i64*
%4 = load volatile i64, i64* %3
%5 = trunc i64 %4 to i32
%6 = lshr i32 %5, 4
%7 = and i32 %6, 1
%8 = xor i32 %7, 1
ret i32 %8
}
int test_imm_E0uint16_reg(unsigned short val) {
  return ((val) & (-0xE0 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_E0uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xffffff20,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_E0uint16_reg>:
test   $0xff20,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_E0uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, -224
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main() {
  char *s = "i am chenzongzhi";
  char *s1 = malloc(100 * sizeof(char));
  strncpy(s1, s, 10);
  printf("%s\n", s1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    $0x64,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rsi
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x64,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
lea    0xebb(%rip),%rsi
mov    %rax,%rdi
mov    $0xa,%edx
call   1030 <strncpy@plt>
lea    0xeb8(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"i am chenzongzhi\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = call i8* @malloc(i32 100)
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = load i8*, i8** %2
%7 = call i32 @strncpy(i8* %5, i8* %6, i32 10)
%8 = load i8*, i8** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"i am chenzongzhi\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(100) i8* @malloc(i32 100)
%2 = tail call i32 @strncpy(i8* %1, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 10)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
ret i32 0
}
int ishexdigit(char ch) {
  return (ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f');
}


x86 assembly (clang, -O0):
<ishexdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x30,%eax
jl     1129 <ishexdigit+0x29>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x39,%ecx
mov    %al,-0x2(%rbp)
jle    114e <ishexdigit+0x4e>
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x61,%ecx
mov    %al,-0x3(%rbp)
jl     1148 <ishexdigit+0x48>
movsbl -0x1(%rbp),%eax
cmp    $0x66,%eax
setle  %al
mov    %al,-0x3(%rbp)
mov    -0x3(%rbp),%al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ishexdigit>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%al
setb   %al
add    $0x9f,%dil
cmp    $0x6,%dil
setb   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @ishexdigit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br i1 %9, label %20, label %10
10: ; preds = %6, %1
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sge i32 %12, 97
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp sle i32 %16, 102
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ false, %10 ], [ %17, %14 ]
br label %20
20: ; preds = %18, %6
%21 = phi i1 [ true, %6 ], [ %19, %18 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @ishexdigit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = add i8 %0, -97
%5 = icmp ult i8 %4, 6
%6 = or i1 %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ sin_sse(double const, double const, double *, double *);
double sin_sse_wrapper(const double x) {
  double result = -1.0;
  sin_sse(x, x, &result, &result);
  return result;
}


x86 assembly (clang, -O0):
<sin_sse_wrapper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xedb(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
lea    -0x10(%rbp),%rsi
mov    %rsi,%rdi
call   1030 <sin_sse@plt>
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sin_sse_wrapper>:
push   %rax
movabs $0xbff0000000000000,%rax
mov    %rax,(%rsp)
mov    %rsp,%rdi
movaps %xmm0,%xmm1
mov    %rdi,%rsi
call   1030 <sin_sse@plt>
movsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @sin_sse_wrapper(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
store double -1.000000e+00, double* %3
%4 = load double, double* %2
%5 = load double, double* %2
%6 = call i32 @sin_sse(double %4, double %5, double* %3, double* %3)
%7 = load double, double* %3
ret double %7
}

LLVM IR (-O2):
define double @sin_sse_wrapper(double %0) {
%2 = alloca double
%3 = bitcast double* %2 to i8*
store double -1.000000e+00, double* %2
%4 = call i32 @sin_sse(double %0, double %0, double* %2, double* %2)
%5 = load double, double* %2
ret double %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ bzero(char *, size_t);
scalar_t__ fgets(char *, size_t, int /*<<< orphan*/ *);
int read_row(FILE *fp, char *b, size_t l) {
  int res;
  bzero(b, l);
  if (fgets(b, l, fp))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<read_row>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <bzero@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1030 <fgets@plt>
cmp    $0x0,%rax
je     1168 <read_row+0x48>
movl   $0x1,-0x4(%rbp)
jmp    116f <read_row+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_row>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1040 <bzero@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <fgets@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
mov    %ecx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @read_row(i32* nocapture %0, i8* %1, i64 %2) {
%4 = tail call i32 @bzero(i8* %1, i64 %2)
%5 = tail call i64 @fgets(i8* %1, i64 %2, i32* %0)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
size_t strlen(const char *str) {
  const char *s;
  for (s = str; *s; ++s) {
    ;
  }
  return (s - str);
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1133 <strlen+0x33>
jmp    1122 <strlen+0x22>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
mov    $0xffffffffffffffff,%rax
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rax,1)
lea    0x1(%rax),%rax
jne    1110 <strlen+0x10>
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %6, %2 ]
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 0
%6 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %5, label %7, label %2
7: ; preds = %2
%8 = ptrtoint i8* %3 to i64
%9 = ptrtoint i8* %0 to i64
%10 = sub i64 %8, %9
ret i64 %10
}
int round_deg(int n) {
  int res = 1;
  while (res < n)
    res += res;
  return res;
}


x86 assembly (clang, -O0):
<round_deg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1128 <round_deg+0x28>
mov    -0x8(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    110e <round_deg+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<round_deg>:
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ecx,%eax
lea    (%rax,%rax,1),%ecx
cmp    %edi,%eax
jl     1110 <round_deg+0x10>
ret

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

LLVM IR (-O2):
define i32 @round_deg(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 1, %1 ], [ %5, %2 ]
%4 = icmp slt i32 %3, %0
%5 = shl nsw i32 %3, 1
br i1 %4, label %2, label %6
6: ; preds = %2
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ cpu_set_t;

/* Variables and functions */
int __cpu_isset(int cpu, cpu_set_t *set) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @__cpu_isset(i32 %0, i32* nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ tests_memory_end();
int /*<<< orphan*/ tests_rand_end();
void tests_end(void) {
  {
    tests_rand_end();
    tests_memory_end();
    return;
  }
}


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

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

LLVM IR (-O0):
define void @tests_end() {
%1 = call i32 (...) @tests_rand_end()
%2 = call i32 (...) @tests_memory_end()
ret void
}

LLVM IR (-O2):
define void @tests_end() {
%1 = tail call i32 (...) @tests_rand_end()
%2 = tail call i32 (...) @tests_memory_end()
ret void
}
/* Variables and functions */
double frexp(double, int *);
double octave_frexp_wrapper(double x, int *expptr) { return frexp(x, expptr); }


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

x86 assembly (clang, -O2):
<octave_frexp_wrapper>:
jmp    1030 <frexp@plt>

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

LLVM IR (-O2):
define double @octave_frexp_wrapper(double %0, i32* nocapture %1) {
%3 = tail call double @frexp(double %0, i32* %1)
ret double %3
}