xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ __libc_read(int, void *, size_t);
int /*<<< orphan*/ pthread_testcancel();
ssize_t read(int fd, void *buf, size_t count) {
  pthread_testcancel();
  return __libc_read(fd, buf, count);
}


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

x86 assembly (clang, -O2):
<read>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1040 <pthread_testcancel@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <__libc_read@plt>

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

LLVM IR (-O2):
define i32 @read(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 (...) @pthread_testcancel()
%5 = tail call i32 @__libc_read(i32 %0, i8* %1, i64 %2)
ret i32 %5
}
/* Variables and functions */
unsigned int _mm_getcsr();
unsigned int ssp_getcsr_SSE(void) { return _mm_getcsr(); }


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

x86 assembly (clang, -O2):
<ssp_getcsr_SSE>:
stmxcsr -0x4(%rsp)
mov    -0x4(%rsp),%eax
ret

LLVM IR (-O0):
define i32 @ssp_getcsr_SSE() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @ssp_getcsr_SSE() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* %1
ret i32 %3
}
void RTDbgAsModuleCount(void) {}


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

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

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

LLVM IR (-O2):
define void @RTDbgAsModuleCount() {
ret void
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  unsigned long window;
};
typedef TYPE_1__ XFocusInEvent;

/* Variables and functions */
void set_XFocusInEvent_window(void *_p, unsigned long _v) {
  ((XFocusInEvent *)_p)->window = (unsigned long)_v;
}


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

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

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

LLVM IR (-O2):
define void @set_XFocusInEvent_window(i8* nocapture writeonly %0, i64 %1) {
%3 = bitcast i8* %0 to i64*
store i64 %1, i64* %3
ret void
}
unsigned long ffs(unsigned long value) {
  if (!value)
    return 0;
  __asm__("bsf %1, %0" : "=r"(value) : "rm"(value) : "cc");
  return value + 1;
}


x86 assembly (clang, -O0):
<ffs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1120 <ffs+0x20>
movq   $0x0,-0x8(%rbp)
jmp    113d <ffs+0x3d>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
bsf    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ffs>:
test   %rdi,%rdi
je     1115 <ffs+0x15>
mov    %rdi,-0x8(%rsp)
bsf    -0x8(%rsp),%rax
add    $0x1,%rax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i64 @ffs(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = icmp ne i64 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %1
store i64 0, i64* %2
br label %12
7: ; preds = %1
%8 = load i64, i64* %3
%9 = call i64 asm "bsf $1, $0", "=r,rm,~{cc},~{dirflag},~{fpsr},~{flags}"(i64 %8)
store i64 %9, i64* %3
%10 = load i64, i64* %3
%11 = add i64 %10, 1
store i64 %11, i64* %2
br label %12
12: ; preds = %7, %6
%13 = load i64, i64* %2
ret i64 %13
}

LLVM IR (-O2):
define i64 @ffs(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i64 asm "bsf $1, $0", "=r,rm,~{cc},~{dirflag},~{fpsr},~{flags}"(i64 %0)
%5 = add i64 %4, 1
br label %6
6: ; preds = %1, %3
%7 = phi i64 [ %5, %3 ], [ 0, %1 ]
ret i64 %7
}
/* Variables and functions */
int write(int, char *, int);
int /*<<< orphan*/ x_perror(char *);
void send_char(char c) {
  if (write(1, &c, 1) != 1)
    x_perror("send_char");
}


x86 assembly (clang, -O0):
<send_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1,%edx
lea    -0x1(%rbp),%rsi
mov    %edx,%edi
call   1040 <write@plt>
cmp    $0x1,%eax
je     1153 <send_char+0x33>
lea    0xeb2(%rip),%rdi
call   1030 <x_perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_char>:
push   %rax
mov    %dil,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edi
mov    $0x1,%edx
call   1040 <write@plt>
cmp    $0x1,%eax
jne    1141 <send_char+0x21>
pop    %rax
ret
lea    0xeb8(%rip),%rdi
pop    %rax
jmp    1030 <x_perror@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"send_char\00"
define void @send_char(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @write(i32 1, i8* %2, i32 1)
%4 = icmp ne i32 %3, 1
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @x_perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"send_char\00"
define void @send_char(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = call i32 @write(i32 1, i8* %2, i32 1)
%4 = icmp eq i32 %3, 1
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @x_perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ link_error();
void f2(unsigned int a) {
  if (4 / a == 5)
    link_error();
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x4,%eax
xor    %edx,%edx
divl   -0x4(%rbp)
cmp    $0x5,%eax
jne    1135 <f2+0x25>
mov    $0x0,%al
call   1030 <link_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @f2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = udiv i32 4, %3
%5 = icmp eq i32 %4, 5
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (...) @link_error()
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
define void @f2(i32 %0) {
ret void
}
/* Variables and functions */
double fabs(double);
double c_fabs(double arg0) { return fabs(arg0); }


x86 assembly (clang, -O0):
<c_fabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movaps 0xeeb(%rip),%xmm1
pand   %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_fabs>:
andps  0xef9(%rip),%xmm0
ret

LLVM IR (-O0):
define double @c_fabs(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.fabs.f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @c_fabs(double %0) {
%2 = tail call double @llvm.fabs.f64(double %0)
ret double %2
}
int maxYPixel(void) { return 64; }


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

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

LLVM IR (-O0):
define i32 @maxYPixel() {
ret i32 64
}

LLVM IR (-O2):
define i32 @maxYPixel() {
ret i32 64
}
/* Variables and functions */
int /*<<< orphan*/ formatd(char *);
void test_implicit() {
  int formats = 0;
  formatd("Hello, World!\n");
}


x86 assembly (clang, -O0):
<test_implicit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <formatd@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, World!\0A\00"
define void @test_implicit() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @formatd(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Hello, World!\0A\00"
define void @test_implicit() {
%1 = tail call i32 @formatd(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_OK;
int access(char *, int /*<<< orphan*/);
bool file_exists(char *filepath) { return access(filepath, F_OK) != -1; }


x86 assembly (clang, -O0):
<file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
cmp    $0xffffffff,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_exists>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@F_OK = global i32 0
define i32 @file_exists(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @F_OK
%5 = call i32 @access(i8* %3, i32 %4)
%6 = icmp ne i32 %5, -1
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
@F_OK = global i32 0
define i32 @file_exists(i8* nocapture %0) {
%2 = load i32, i32* @F_OK
%3 = tail call i32 @access(i8* %0, i32 %2)
%4 = icmp ne i32 %3, -1
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ test_run_benchmark();
void cmd_bench(void) { test_run_benchmark(); }


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

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

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

LLVM IR (-O2):
define void @cmd_bench() {
%1 = tail call i32 (...) @test_run_benchmark()
ret void
}
/* Type definitions */
struct ADrawTag {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned int,
                           unsigned int, unsigned int, unsigned int);
int /*<<< orphan*/ getPsFile(struct ADrawTag *);
void PsLine(struct ADrawTag *ctx, unsigned int x1, unsigned int y1,
            unsigned int x2, unsigned int y2) {
  fprintf(getPsFile(ctx), "newpath %d %d moveto %d %d lineto stroke\n", x1, -y1,
          x2, -y2);
}


x86 assembly (clang, -O0):
<PsLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <getPsFile@plt>
mov    %eax,%edi
mov    -0xc(%rbp),%edx
xor    %ecx,%ecx
sub    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
xor    %r9d,%r9d
sub    -0x18(%rbp),%r9d
lea    0xea2(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PsLine>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%ebx
mov    %ecx,%r14d
mov    %edx,%ebp
mov    %esi,%r15d
call   1040 <getPsFile@plt>
neg    %ebp
neg    %ebx
lea    0xebe(%rip),%rsi
mov    %eax,%edi
mov    %r15d,%edx
mov    %ebp,%ecx
mov    %r14d,%r8d
mov    %ebx,%r9d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
%struct.ADrawTag = type { i32 }
@.str = [42 x i8] c"newpath %d %d moveto %d %d lineto stroke\0A\00"
define void @PsLine(%struct.ADrawTag* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.ADrawTag*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.ADrawTag* %0, %struct.ADrawTag** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load %struct.ADrawTag*, %struct.ADrawTag** %6
%12 = call i32 @getPsFile(%struct.ADrawTag* %11)
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = sub i32 0, %14
%16 = load i32, i32* %9
%17 = load i32, i32* %10
%18 = sub i32 0, %17
%19 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %15, i32 %16, i32 %18)
ret void
}

LLVM IR (-O2):
%struct.ADrawTag = type { i32 }
@.str = [42 x i8] c"newpath %d %d moveto %d %d lineto stroke\0A\00"
define void @PsLine(%struct.ADrawTag* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @getPsFile(%struct.ADrawTag* %0)
%7 = sub i32 0, %2
%8 = sub i32 0, %4
%9 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %7, i32 %3, i32 %8)
ret void
}
int int_sum(int i1, int i2) { return i1 + i2; }


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

x86 assembly (clang, -O2):
<int_sum>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @int_sum(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @int_sum(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
scalar_t__ i386_get_cpuid(unsigned int *, unsigned int *);
unsigned int __attribute__((no)) i386_cpuid_edx(void) {
  unsigned int ecx, edx;
  if (i386_get_cpuid(&ecx, &edx))
    return edx;
  else
    return 0;
}


x86 assembly (clang, -O0):
<i386_cpuid_edx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
call   1030 <i386_get_cpuid@plt>
cmp    $0x0,%rax
je     113a <i386_cpuid_edx+0x2a>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1141 <i386_cpuid_edx+0x31>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i386_cpuid_edx>:
push   %rax
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <i386_get_cpuid@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     112b <i386_cpuid_edx+0x1b>
mov    (%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @i386_cpuid_edx() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i64 @i386_get_cpuid(i32* %1, i32* %2)
%6 = icmp eq i64 %5, 0
%7 = load i32, i32* %2
%8 = select i1 %6, i32 0, i32 %7
ret i32 %8
}
void clear_message() {}


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

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

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

LLVM IR (-O2):
define void @clear_message() {
ret void
}
void _swap(int *arr, int i, int j) {
  int t = arr[i];
  arr[i] = arr[j];
  arr[j] = t;
}


x86 assembly (clang, -O0):
<_swap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_swap>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%ecx
movslq %edx,%rdx
mov    (%rdi,%rdx,4),%esi
mov    %esi,(%rdi,%rax,4)
mov    %ecx,(%rdi,%rdx,4)
ret

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

LLVM IR (-O2):
define void @_swap(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %1 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
store i32 %9, i32* %5
store i32 %6, i32* %8
ret void
}
/* Type definitions */
typedef scalar_t__ int16_t;

/* Variables and functions */
char is_within_range(int16_t high, int16_t low, int16_t value) {
  char output;
  if (value >= low && value <= high)
    output = 1;
  else
    output = 0;
  return output;
}


x86 assembly (clang, -O0):
<is_within_range>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jl     1135 <is_within_range+0x35>
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jg     1135 <is_within_range+0x35>
movb   $0x1,-0x19(%rbp)
jmp    1139 <is_within_range+0x39>
movb   $0x0,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_within_range>:
cmp    %rsi,%rdx
setge  %cl
cmp    %rdi,%rdx
setle  %al
and    %cl,%al
ret

LLVM IR (-O0):
define signext i8 @is_within_range(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i64, i64* %6
%9 = load i64, i64* %5
%10 = icmp sge i64 %8, %9
br i1 %10, label %11, label %16
11: ; preds = %3
%12 = load i64, i64* %6
%13 = load i64, i64* %4
%14 = icmp sle i64 %12, %13
br i1 %14, label %15, label %16
15: ; preds = %11
store i8 1, i8* %7
br label %17
16: ; preds = %11, %3
store i8 0, i8* %7
br label %17
17: ; preds = %16, %15
%18 = load i8, i8* %7
ret i8 %18
}

LLVM IR (-O2):
define signext i8 @is_within_range(i64 %0, i64 %1, i64 %2) {
%4 = icmp sge i64 %2, %1
%5 = icmp sle i64 %2, %0
%6 = and i1 %4, %5
%7 = zext i1 %6 to i8
ret i8 %7
}
int transdata_needprivs(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @transdata_needprivs() {
ret i32 0
}
/* Variables and functions */
unsigned int csum_add(unsigned int, unsigned int);
unsigned int csum_block_add(unsigned int csum, unsigned int csum2, int offset) {
  if (offset & 1)
    csum2 = ((csum2 & 0xFF00FF) << 8) + ((csum2 >> 8) & 0xFF00FF);
  return csum_add(csum, csum2);
}


x86 assembly (clang, -O0):
<csum_block_add>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     114c <csum_block_add+0x3c>
mov    -0x8(%rbp),%eax
and    $0xff00ff,%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%ecx
shr    $0x8,%ecx
and    $0xff00ff,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <csum_add@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csum_block_add>:
test   $0x1,%dl
je     111a <csum_block_add+0xa>
bswap  %esi
ror    $0x10,%esi
jmp    1030 <csum_add@plt>

LLVM IR (-O0):
define i32 @csum_block_add(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = and i32 %7, 1
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %3
%11 = load i32, i32* %5
%12 = and i32 %11, 16711935
%13 = shl i32 %12, 8
%14 = load i32, i32* %5
%15 = lshr i32 %14, 8
%16 = and i32 %15, 16711935
%17 = add i32 %13, %16
store i32 %17, i32* %5
br label %18
18: ; preds = %10, %3
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = call i32 @csum_add(i32 %19, i32 %20)
ret i32 %21
}

LLVM IR (-O2):
define i32 @csum_block_add(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %2, 1
%5 = icmp eq i32 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %3
%7 = shl i32 %1, 8
%8 = and i32 %7, -16711936
%9 = lshr i32 %1, 8
%10 = and i32 %9, 16711935
%11 = or i32 %8, %10
br label %12
12: ; preds = %6, %3
%13 = phi i32 [ %11, %6 ], [ %1, %3 ]
%14 = tail call i32 @csum_add(i32 %0, i32 %13)
ret i32 %14
}
/* Variables and functions */
int uriFilenameToUriStringA(char const *, char *, int);
int uriUnixFilenameToUriStringA(const char *filename, char *uriString) {
  return uriFilenameToUriStringA(filename, uriString, 1);
}


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

x86 assembly (clang, -O2):
<uriUnixFilenameToUriStringA>:
mov    $0x1,%edx
jmp    1030 <uriFilenameToUriStringA@plt>

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

LLVM IR (-O2):
define i32 @uriUnixFilenameToUriStringA(i8* %0, i8* %1) {
%3 = tail call i32 @uriFilenameToUriStringA(i8* %0, i8* %1, i32 1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ const uint8_t;

/* Variables and functions */
uint8_t hci_event_inquiry_result_get_reserved2(const uint8_t *event) {
  return event[11];
}


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

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

LLVM IR (-O0):
define i32 @hci_event_inquiry_result_get_reserved2(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 11
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @hci_event_inquiry_result_get_reserved2(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 11
%3 = load i32, i32* %2
ret i32 %3
}
void foo222(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo222(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ raise(int);
void uninitvar_raise(void) {
  int i;
  (void)raise(i);
}


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

x86 assembly (clang, -O2):
<uninitvar_raise>:
jmp    1030 <raise@plt>

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

LLVM IR (-O2):
define void @uninitvar_raise() {
%1 = tail call i32 @raise(i32 undef)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, short);
int main() {
  short num = 0;
  while (num >= 0)
    num++;
  printf("%hd ", num);
  num--;
  printf("%hd\n", num);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movw   $0x0,-0x6(%rbp)
movswl -0x6(%rbp),%eax
cmp    $0x0,%eax
jl     1143 <main+0x33>
mov    -0x6(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x6(%rbp)
jmp    1125 <main+0x15>
lea    0xeb6(%rip),%rdi
movswl -0x6(%rbp),%esi
call   1030 <printf@plt>
mov    -0x6(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x6(%rbp)
lea    0xe9f(%rip),%rdi
movswl -0x6(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [5 x i8] c"%hd \00"
@.str.1 = [5 x i8] c"%hd\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i16 signext -32768)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i16 signext 32767)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void _END(void) { exit(0); }


x86 assembly (clang, -O0):
<_END>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<_END>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @_END() {
%1 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @_END() {
%1 = tail call i32 @exit(i32 0)
unreachable
}
void break3() {}


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

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

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

LLVM IR (-O2):
define void @break3() {
ret void
}
int test_imm_7Fint64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x7F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_7Fint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 127
%7 = icmp ne i64 %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_7Fint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 8323072
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int ext4bf_acl_chmod(struct inode *inode) { return 0; }


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

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

LLVM IR (-O0):
%struct.inode = type opaque
define i32 @ext4bf_acl_chmod(%struct.inode* %0) {
%2 = alloca %struct.inode*
store %struct.inode* %0, %struct.inode** %2
ret i32 0
}

LLVM IR (-O2):
%struct.inode = type opaque
define i32 @ext4bf_acl_chmod(%struct.inode* nocapture readnone %0) {
ret i32 0
}
double calc_temp_penalty(temp, tempcrit)
double temp, tempcrit;
{
  double value = 0.0;
  if (temp > tempcrit) {
    value = (temp - tempcrit) * (temp - tempcrit) / (8);
  }
  return (value);
}


x86 assembly (clang, -O0):
<calc_temp_penalty>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    114f <calc_temp_penalty+0x4f>
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeba(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_temp_penalty>:
movapd %xmm0,%xmm2
subsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm2
mulsd  0xeec(%rip),%xmm2
cmpltsd %xmm0,%xmm1
andpd  %xmm1,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @calc_temp_penalty(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
store double 0.000000e+00, double* %5
%6 = load double, double* %3
%7 = load double, double* %4
%8 = fcmp ogt double %6, %7
br i1 %8, label %9, label %18
9: ; preds = %2
%10 = load double, double* %3
%11 = load double, double* %4
%12 = fsub double %10, %11
%13 = load double, double* %3
%14 = load double, double* %4
%15 = fsub double %13, %14
%16 = fmul double %12, %15
%17 = fdiv double %16, 8.000000e+00
store double %17, double* %5
br label %18
18: ; preds = %9, %2
%19 = load double, double* %5
ret double %19
}

LLVM IR (-O2):
define double @calc_temp_penalty(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = fsub double %0, %1
%5 = fmul double %4, %4
%6 = fmul double %5, 1.250000e-01
%7 = select i1 %3, double %6, double 0.000000e+00
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ get_part_result(int *, int *, int *, int *, int *, int *);
void GET_PART_RESULT(int *num_graph1, int *igraph1, int *num_graph2,
                     int *igraph2, int *num_separator, int *iseparator) {
  get_part_result(num_graph1, igraph1, num_graph2, igraph2, num_separator,
                  iseparator);
}


x86 assembly (clang, -O0):
<GET_PART_RESULT>:
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    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
call   1030 <get_part_result@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GET_PART_RESULT>:
jmp    1030 <get_part_result@plt>

LLVM IR (-O0):
define void @GET_PART_RESULT(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 = load i32*, i32** %9
%16 = load i32*, i32** %10
%17 = load i32*, i32** %11
%18 = load i32*, i32** %12
%19 = call i32 @get_part_result(i32* %13, i32* %14, i32* %15, i32* %16, i32* %17, i32* %18)
ret void
}

LLVM IR (-O2):
define void @GET_PART_RESULT(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5) {
%7 = tail call i32 @get_part_result(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5)
ret void
}
unsigned long MT_RdReg(unsigned long unit, unsigned long reg) {
  unsigned long data;
  data =
      (*((volatile unsigned long *)((unsigned long)unit | (unsigned long)reg)));
  return (data);
}


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

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

LLVM IR (-O0):
define i64 @MT_RdReg(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = or i64 %6, %7
%9 = inttoptr i64 %8 to i64*
%10 = load volatile i64, i64* %9
store i64 %10, i64* %5
%11 = load i64, i64* %5
ret i64 %11
}

LLVM IR (-O2):
define i64 @MT_RdReg(i64 %0, i64 %1) {
%3 = or i64 %1, %0
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
ret i64 %5
}
int grid_xpush_ispeer(int socktype) { return socktype == (5 * 16 + 1) ? 1 : 0; }


x86 assembly (clang, -O0):
<grid_xpush_ispeer>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x51,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<grid_xpush_ispeer>:
xor    %eax,%eax
cmp    $0x51,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @grid_xpush_ispeer(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 81
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 1, i32 0
ret i32 %6
}

LLVM IR (-O2):
define i32 @grid_xpush_ispeer(i32 %0) {
%2 = icmp eq i32 %0, 81
%3 = zext i1 %2 to i32
ret i32 %3
}
void foo714(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo714(i32 %0) {
ret void
}
void buserr_except() {}


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

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

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

LLVM IR (-O2):
define void @buserr_except() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DecodeEaD_xxxxdddxssmmmrrr();
int /*<<< orphan*/ DoBinOpSub(int /*<<< orphan*/);
void DoCodeSubEaR(void) { DoBinOpSub(DecodeEaD_xxxxdddxssmmmrrr()); }


x86 assembly (clang, -O0):
<DoCodeSubEaR>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <DecodeEaD_xxxxdddxssmmmrrr@plt>
mov    %eax,%edi
call   1030 <DoBinOpSub@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoCodeSubEaR>:
push   %rax
xor    %eax,%eax
call   1040 <DecodeEaD_xxxxdddxssmmmrrr@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <DoBinOpSub@plt>

LLVM IR (-O0):
define void @DoCodeSubEaR() {
%1 = call i32 (...) @DecodeEaD_xxxxdddxssmmmrrr()
%2 = call i32 @DoBinOpSub(i32 %1)
ret void
}

LLVM IR (-O2):
define void @DoCodeSubEaR() {
%1 = tail call i32 (...) @DecodeEaD_xxxxdddxssmmmrrr()
%2 = tail call i32 @DoBinOpSub(i32 %1)
ret void
}
/* Variables and functions */
int sleep(int);
int thread_sleep(int seconds) { return sleep(seconds); }


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

x86 assembly (clang, -O2):
<thread_sleep>:
jmp    1030 <sleep@plt>

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

LLVM IR (-O2):
define i32 @thread_sleep(i32 %0) {
%2 = tail call i32 @sleep(i32 %0)
ret i32 %2
}
_rw_write_held() { printf("proc-stub:%s\n", __func__); }


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

x86 assembly (clang, -O2):
<_rw_write_held>:
lea    0xee9(%rip),%rdi
lea    0xef0(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"proc-stub:%s\0A\00"
@__func__._rw_write_held = [15 x i8] c"_rw_write_held\00"
define i32 @_rw_write_held() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__._rw_write_held, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [14 x i8] c"proc-stub:%s\0A\00"
@__func__._rw_write_held = [15 x i8] c"_rw_write_held\00"
define i32 @_rw_write_held() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @__func__._rw_write_held, i64 0, i64 0))
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ unlink(char const *);
void death(const char *msg, FILE *fdesc, const char *fname) {
  fprintf(stderr, "ERROR: %s", msg);
  fclose(fdesc);
  unlink(fname);
  exit(1);
}


x86 assembly (clang, -O0):
<death>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xe98(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x18(%rbp),%rdi
call   1030 <unlink@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<death>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%rdx
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
lea    0xea3(%rip),%rsi
call   1050 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
mov    %r14,%rdi
call   1030 <unlink@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [10 x i8] c"ERROR: %s\00"
define void @death(i8* %0, i32* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %4
%9 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32*, i32** %5
%11 = call i32 @fclose(i32* %10)
%12 = load i8*, i8** %6
%13 = call i32 @unlink(i8* %12)
%14 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [10 x i8] c"ERROR: %s\00"
define void @death(i8* %0, i32* nocapture %1, i8* nocapture %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
%6 = tail call i32 @fclose(i32* %1)
%7 = tail call i32 @unlink(i8* %2)
%8 = tail call i32 @exit(i32 1)
unreachable
}
int test_imm_08uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x08 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_08uint64_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, 8
%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_08uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 524288
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int SoundDriver_CD_IsPlaying();
int CD_IsPlaying(void) { return SoundDriver_CD_IsPlaying(); }


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

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

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

LLVM IR (-O2):
define i32 @CD_IsPlaying() {
%1 = tail call i32 (...) @SoundDriver_CD_IsPlaying()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void swap(int x, int y) {
  int z = x;
  printf("debut swap %d %d\n", x, y);
  x = y;
  y = z;
  printf("fin swap %d %d\n", x, y);
}


x86 assembly (clang, -O0):
<swap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xee2(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"debut swap %d %d\0A\00"
@.str.1 = [16 x i8] c"fin swap %d %d\0A\00"
define void @swap(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
store i32 %6, i32* %5
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %8)
%10 = load i32, i32* %4
store i32 %10, i32* %3
%11 = load i32, i32* %5
store i32 %11, i32* %4
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"debut swap %d %d\0A\00"
@.str.1 = [16 x i8] c"fin swap %d %d\0A\00"
define void @swap(i32 %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %1, i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *thread_run(void *d) {
  int (*fn)(void *);
  void *data;
  fn = (int (*)(void *))((void **)d)[0];
  data = ((void **)d)[1];
  free(d);
  fn(data);
  pthread_exit(NULL);
  return NULL;
}


x86 assembly (clang, -O0):
<thread_run>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rdi
call   *%rax
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread_run>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%r14
mov    0x8(%rdi),%rbx
call   1030 <free@plt>
mov    %rbx,%rdi
call   *%r14
xor    %edi,%edi
call   1040 <pthread_exit@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @thread_run(i8* %0) {
%2 = alloca i8*
%3 = alloca i32 (i8*)*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to i8**
%7 = getelementptr inbounds i8*, i8** %6, i64 0
%8 = load i8*, i8** %7
%9 = bitcast i8* %8 to i32 (i8*)*
store i32 (i8*)* %9, i32 (i8*)** %3
%10 = load i8*, i8** %2
%11 = bitcast i8* %10 to i8**
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
store i8* %13, i8** %4
%14 = load i8*, i8** %2
%15 = call i32 @free(i8* %14)
%16 = load i32 (i8*)*, i32 (i8*)** %3
%17 = load i8*, i8** %4
%18 = call i32 %16(i8* %17)
%19 = call i32 @pthread_exit(i32* null)
ret i8* null
}

LLVM IR (-O2):
define i8* @thread_run(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32 (i8*)**
%3 = load i32 (i8*)*, i32 (i8*)** %2
%4 = getelementptr inbounds i8, i8* %0, i64 8
%5 = bitcast i8* %4 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @free(i8* %0)
%8 = tail call i32 %3(i8* %6)
%9 = tail call i32 @pthread_exit(i32* null)
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ set_io_bit(int, int);
void TOSH_SET_GREEN_LED_PIN() { set_io_bit(0x37, 6); }


x86 assembly (clang, -O0):
<TOSH_SET_GREEN_LED_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x37,%edi
mov    $0x6,%esi
call   1030 <set_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_SET_GREEN_LED_PIN>:
mov    $0x37,%edi
mov    $0x6,%esi
jmp    1030 <set_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_SET_GREEN_LED_PIN() {
%1 = call i32 @set_io_bit(i32 55, i32 6)
ret void
}

LLVM IR (-O2):
define void @TOSH_SET_GREEN_LED_PIN() {
%1 = tail call i32 @set_io_bit(i32 55, i32 6)
ret void
}
long int cast_uint_long_fast(unsigned int x) { return (long int)x; }


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

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

LLVM IR (-O0):
define i64 @cast_uint_long_fast(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
ret i64 %4
}

LLVM IR (-O2):
define i64 @cast_uint_long_fast(i32 %0) {
%2 = zext i32 %0 to i64
ret i64 %2
}