xunge/DecIR huggingface dataset:
/* Variables and functions */
double scale_h2(double, double, double);
double scale_dLy(double x, double y, double z, double dx, double dy,
                 double dz) {
  return scale_h2(x, y, z) * dy;
}


x86 assembly (clang, -O0):
<scale_dLy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1030 <scale_h2@plt>
mulsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scale_dLy>:
push   %rax
movsd  %xmm4,(%rsp)
call   1030 <scale_h2@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @scale_dLy(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store double %5, double* %12
%13 = load double, double* %7
%14 = load double, double* %8
%15 = load double, double* %9
%16 = call double @scale_h2(double %13, double %14, double %15)
%17 = load double, double* %11
%18 = fmul double %16, %17
ret double %18
}

LLVM IR (-O2):
define double @scale_dLy(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = tail call double @scale_h2(double %0, double %1, double %2)
%8 = fmul double %7, %4
ret double %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_single_bar() {
  printf("\n-------------------------------------------------------------------"
         "-------------------------------------------------------");
}


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

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

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

LLVM IR (-O2):
@.str = [124 x i8] c"\0A--------------------------------------------------------------------------------------------------------------------------\00"
define void @print_single_bar() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([124 x i8], [124 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
char *str();
int main() {
  printf("%s\n", str());
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = tail call i8* (...) @str()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t swab16a(uint32_t value, const unsigned char *shifts) {
  return (((value >> 0) & 0xFF) << shifts[0] * 8) |
         (((value >> 8) & 0xFF) << shifts[1] * 8);
}


x86 assembly (clang, -O0):
<swab16a>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x0,%eax
and    $0xff,%eax
mov    -0x10(%rbp),%rcx
movzbl (%rcx),%ecx
shl    $0x3,%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
sar    $0x8,%edx
and    $0xff,%edx
mov    -0x10(%rbp),%rcx
movzbl 0x1(%rcx),%ecx
shl    $0x3,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<swab16a>:
mov    %edi,%eax
movzbl %al,%edx
mov    (%rsi),%cl
shl    $0x3,%cl
shl    %cl,%edx
mov    0x1(%rsi),%cl
movzbl %ah,%eax
shl    $0x3,%cl
shl    %cl,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @swab16a(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 = ashr i32 %5, 0
%7 = and i32 %6, 255
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = zext i8 %10 to i32
%12 = mul nsw i32 %11, 8
%13 = shl i32 %7, %12
%14 = load i32, i32* %3
%15 = ashr i32 %14, 8
%16 = and i32 %15, 255
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = load i8, i8* %18
%20 = zext i8 %19 to i32
%21 = mul nsw i32 %20, 8
%22 = shl i32 %16, %21
%23 = or i32 %13, %22
ret i32 %23
}

LLVM IR (-O2):
define i32 @swab16a(i32 %0, i8* nocapture %1) {
%3 = and i32 %0, 255
%4 = load i8, i8* %1
%5 = zext i8 %4 to i32
%6 = shl nuw nsw i32 %5, 3
%7 = shl i32 %3, %6
%8 = lshr i32 %0, 8
%9 = and i32 %8, 255
%10 = getelementptr inbounds i8, i8* %1, i64 1
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = shl nuw nsw i32 %12, 3
%14 = shl i32 %9, %13
%15 = or i32 %14, %7
ret i32 %15
}
/* Type definitions */
typedef int time_t;
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
time_t z_ms(const struct timeval *t) {
  return ((time_t)t->tv_sec) * 1000 + ((time_t)t->tv_usec) / 1000;
}


x86 assembly (clang, -O0):
<z_ms>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rax
imul   $0x3e8,%eax,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<z_ms>:
imul   $0x3e8,0x8(%rdi),%ecx
movslq (%rdi),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define i32 @z_ms(%struct.timeval* %0) {
%2 = alloca %struct.timeval*
store %struct.timeval* %0, %struct.timeval** %2
%3 = load %struct.timeval*, %struct.timeval** %2
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = mul nsw i32 %6, 1000
%8 = load %struct.timeval*, %struct.timeval** %2
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %8, i32 0, i32 0
%10 = load i64, i64* %9
%11 = trunc i64 %10 to i32
%12 = sdiv i32 %11, 1000
%13 = add nsw i32 %7, %12
ret i32 %13
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define i32 @z_ms(%struct.timeval* nocapture %0) {
%2 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 1
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = mul nsw i32 %4, 1000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %0, i64 0, i32 0
%7 = load i64, i64* %6
%8 = trunc i64 %7 to i32
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %9, %5
ret i32 %10
}
int TrioCalcThousandSeparatorLength(int digits) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @TrioCalcThousandSeparatorLength(i32 %0) {
ret i32 0
}
int get_unit_number() { return 2; }


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

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

LLVM IR (-O0):
define i32 @get_unit_number() {
ret i32 2
}

LLVM IR (-O2):
define i32 @get_unit_number() {
ret i32 2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
size_t minipack_sizeof_str(uint32_t length) {
  if (length <= 31) {
    return 1;
  } else if (length <= 255) {
    return 2;
  } else if (length <= 65535) {
    return 3;
  }
  return 5;
}


x86 assembly (clang, -O0):
<minipack_sizeof_str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x1f,-0xc(%rbp)
jg     111e <minipack_sizeof_str+0x1e>
movq   $0x1,-0x8(%rbp)
jmp    1164 <minipack_sizeof_str+0x64>
cmpl   $0xff,-0xc(%rbp)
jg     1138 <minipack_sizeof_str+0x38>
movq   $0x2,-0x8(%rbp)
jmp    1164 <minipack_sizeof_str+0x64>
cmpl   $0xffff,-0xc(%rbp)
jg     1152 <minipack_sizeof_str+0x52>
movq   $0x3,-0x8(%rbp)
jmp    1164 <minipack_sizeof_str+0x64>
jmp    1157 <minipack_sizeof_str+0x57>
jmp    115c <minipack_sizeof_str+0x5c>
movq   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<minipack_sizeof_str>:
mov    $0x1,%eax
cmp    $0x20,%edi
jl     1129 <minipack_sizeof_str+0x29>
mov    $0x2,%eax
cmp    $0x100,%edi
jb     1129 <minipack_sizeof_str+0x29>
xor    %eax,%eax
cmp    $0x10000,%edi
setae  %al
add    %rax,%rax
add    $0x3,%rax
ret

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

LLVM IR (-O2):
define i64 @minipack_sizeof_str(i32 %0) {
%2 = icmp slt i32 %0, 32
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 256
br i1 %4, label %8, label %5
5: ; preds = %3
%6 = icmp ult i32 %0, 65536
%7 = select i1 %6, i64 3, i64 5
br label %8
8: ; preds = %5, %3, %1
%9 = phi i64 [ 1, %1 ], [ 2, %3 ], [ %7, %5 ]
ret i64 %9
}
int test_29(int a, int b) { return ((a >> 31) ^ (b >= 0)) & 1; }


x86 assembly (clang, -O0):
<test_29>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1f,%eax
cmpl   $0x0,-0x8(%rbp)
setge  %cl
and    $0x1,%cl
movzbl %cl,%ecx
xor    %ecx,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_29>:
mov    %edi,%eax
xor    %esi,%eax
not    %eax
shr    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @test_29(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 = ashr i32 %5, 31
%7 = load i32, i32* %4
%8 = icmp sge i32 %7, 0
%9 = zext i1 %8 to i32
%10 = xor i32 %6, %9
%11 = and i32 %10, 1
ret i32 %11
}

LLVM IR (-O2):
define i32 @test_29(i32 %0, i32 %1) {
%3 = xor i32 %0, %1
%4 = xor i32 %3, -1
%5 = lshr i32 %4, 31
ret i32 %5
}
/* Variables and functions */
char getchar();
void readLine(char *buffer) {
  char character;
  do {
    character = getchar();
    *buffer++ = character;
  } while (character != '\n');
  *(buffer - 1) = '\0';
}


x86 assembly (clang, -O0):
<readLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %cl,(%rax)
movsbl -0x9(%rbp),%eax
cmp    $0xa,%eax
jne    111c <readLine+0xc>
mov    -0x8(%rbp),%rax
movb   $0x0,-0x1(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readLine>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %al,(%rbx)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1120 <readLine+0x10>
movb   $0x0,-0x1(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @readLine(i8* nocapture writeonly %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %5, %2 ]
%4 = tail call signext i8 (...) @getchar()
%5 = getelementptr inbounds i8, i8* %3, i64 1
store i8 %4, i8* %3
%6 = icmp eq i8 %4, 10
br i1 %6, label %7, label %2
7: ; preds = %2
store i8 0, i8* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int, char *);
int /*<<< orphan*/ quit_prog();
int /*<<< orphan*/ stderr;
void malloc_error(char *program, char *function, char *buffer,
                  int buffer_size) {
  fprintf(stderr, "%s:: Failed to allocate [%d] bytes for %s\n", function,
          buffer_size, buffer);
  quit_prog();
}


x86 assembly (clang, -O0):
<malloc_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%r8
lea    0xeae(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x0,%al
call   1040 <quit_prog@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<malloc_error>:
push   %rax
mov    %rdx,%r8
mov    %rsi,%rdx
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <quit_prog@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [43 x i8] c"%s:: Failed to allocate [%d] bytes for %s\0A\00"
define void @malloc_error(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %6
%11 = load i32, i32* %8
%12 = load i8*, i8** %7
%13 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %10, i32 %11, i8* %12)
%14 = call i32 (...) @quit_prog()
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [43 x i8] c"%s:: Failed to allocate [%d] bytes for %s\0A\00"
define void @malloc_error(i8* nocapture readnone %0, i8* %1, i8* %2, i32 %3) {
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %3, i8* %2)
%7 = tail call i32 (...) @quit_prog()
ret void
}
void wait_RnB() {
  while (!((*(volatile unsigned char *)0x4E000020) & (1 << 2)))
    ;
}


x86 assembly (clang, -O0):
<wait_RnB>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <wait_RnB+0x9>
mov    $0x4e000020,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0x4,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    112b <wait_RnB+0x2b>
jmp    1130 <wait_RnB+0x30>
jmp    1109 <wait_RnB+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_RnB>:
testb  $0x4,0x4e000020
04
je     1100 <wait_RnB>
ret

LLVM IR (-O0):
define void @wait_RnB() {
br label %1
1: ; preds = %7, %0
%2 = load volatile i8, i8* inttoptr (i64 1308622880 to i8*)
%3 = zext i8 %2 to i32
%4 = and i32 %3, 4
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
br i1 %6, label %7, label %8
7: ; preds = %1
br label %1
8: ; preds = %1
ret void
}

LLVM IR (-O2):
define void @wait_RnB() {
br label %1
1: ; preds = %1, %0
%2 = load volatile i8, i8* inttoptr (i64 1308622880 to i8*)
%3 = and i8 %2, 4
%4 = icmp eq i8 %3, 0
br i1 %4, label %1, label %5
5: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putstr(char *, int);
void term_right(void) { putstr("\x1b[C", 3); }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"\1B[C\00"
define void @term_right() {
%1 = call i32 @putstr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"\1B[C\00"
define void @term_right() {
%1 = tail call i32 @putstr(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ glRotatef(double, int, int /*<<< orphan*/, int);
int /*<<< orphan*/ glTranslatef(double, double, double);
void BendLeft(void) {
  glRotatef(-90.0, 0, 0, 1);
  glTranslatef(0.0, 1.0, 0.0);
  glRotatef(90.0, 1, 0, 0);
  glTranslatef(0.0, -1.0, 0.0);
}


x86 assembly (clang, -O0):
<BendLeft>:
push   %rbp
mov    %rsp,%rbp
movsd  0xeec(%rip),%xmm0
xor    %esi,%esi
mov    $0x1,%edx
mov    %esi,%edi
call   1040 <glRotatef@plt>
xorps  %xmm2,%xmm2
movsd  0xecb(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <glTranslatef@plt>
movsd  0xeb3(%rip),%xmm0
mov    $0x1,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <glRotatef@plt>
xorps  %xmm2,%xmm2
movsd  0xe92(%rip),%xmm1
movaps %xmm2,%xmm0
call   1030 <glTranslatef@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<BendLeft>:
push   %rax
movsd  0xed7(%rip),%xmm0
xor    %edi,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <glRotatef@plt>
movsd  0xec9(%rip),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
call   1030 <glTranslatef@plt>
movsd  0xebe(%rip),%xmm0
mov    $0x1,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <glRotatef@plt>
movsd  0xeb0(%rip),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
pop    %rax
jmp    1030 <glTranslatef@plt>

LLVM IR (-O0):
define void @BendLeft() {
%1 = call i32 @glRotatef(double -9.000000e+01, i32 0, i32 0, i32 1)
%2 = call i32 @glTranslatef(double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%3 = call i32 @glRotatef(double 9.000000e+01, i32 1, i32 0, i32 0)
%4 = call i32 @glTranslatef(double 0.000000e+00, double -1.000000e+00, double 0.000000e+00)
ret void
}

LLVM IR (-O2):
define void @BendLeft() {
%1 = tail call i32 @glRotatef(double -9.000000e+01, i32 0, i32 0, i32 1)
%2 = tail call i32 @glTranslatef(double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
%3 = tail call i32 @glRotatef(double 9.000000e+01, i32 1, i32 0, i32 0)
%4 = tail call i32 @glTranslatef(double 0.000000e+00, double -1.000000e+00, double 0.000000e+00)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ func_5(int, char *, unsigned long);
void func_4(int a, char *b, unsigned long c) { func_5(a, b, c); }


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

x86 assembly (clang, -O2):
<func_4>:
jmp    1030 <func_5@plt>

LLVM IR (-O0):
define void @func_4(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 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call i32 @func_5(i32 %7, i8* %8, i64 %9)
ret void
}

LLVM IR (-O2):
define void @func_4(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 @func_5(i32 %0, i8* %1, i64 %2)
ret void
}
int firstpreviousblank(char line[], int pos) {
  while (line[pos] != ' ' && line[pos] != '\t' && line[pos] != '\n')
    --pos;
  return pos;
}


x86 assembly (clang, -O0):
<firstpreviousblank>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0xd(%rbp)
je     1154 <firstpreviousblank+0x54>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0xd(%rbp)
je     1154 <firstpreviousblank+0x54>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1164 <firstpreviousblank+0x64>
jmp    1172 <firstpreviousblank+0x72>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    110b <firstpreviousblank+0xb>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<firstpreviousblank>:
mov    %esi,%eax
movslq %esi,%rcx
add    %rdi,%rcx
movabs $0x100000600,%rdx
jmp    1127 <firstpreviousblank+0x27>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0xffffffff,%eax
add    $0xffffffffffffffff,%rcx
movzbl (%rcx),%esi
cmp    $0x20,%rsi
ja     1120 <firstpreviousblank+0x20>
bt     %rsi,%rdx
jae    1120 <firstpreviousblank+0x20>
ret

LLVM IR (-O0):
define i32 @firstpreviousblank(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
br label %5
5: ; preds = %31, %2
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 32
br i1 %12, label %13, label %29
13: ; preds = %5
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 9
br i1 %20, label %21, label %29
21: ; preds = %13
%22 = load i8*, i8** %3
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 10
br label %29
29: ; preds = %21, %13, %5
%30 = phi i1 [ false, %13 ], [ false, %5 ], [ %28, %21 ]
br i1 %30, label %31, label %34
31: ; preds = %29
%32 = load i32, i32* %4
%33 = add nsw i32 %32, -1
store i32 %33, i32* %4
br label %5
34: ; preds = %29
%35 = load i32, i32* %4
ret i32 %35
}

LLVM IR (-O2):
define i32 @firstpreviousblank(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
br label %4
4: ; preds = %8, %2
%5 = phi i64 [ %9, %8 ], [ %3, %2 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
switch i8 %7, label %8 [
i8 32, label %10
i8 9, label %10
i8 10, label %10
]
8: ; preds = %4
%9 = add i64 %5, -1
br label %4
10: ; preds = %4, %4, %4
%11 = trunc i64 %5 to i32
ret i32 %11
}
/* Variables and functions */
#define KEY_DOWN 131
#define KEY_LEFT 130
#define KEY_RIGHT 129
#define KEY_UP 128
int getch();
int testArrowKey(void) {
  switch (getch()) {
  case KEY_UP:
    return (1);
  case KEY_LEFT:
    return (4);
  case KEY_RIGHT:
    return (3);
  case KEY_DOWN:
    return (2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<testArrowKey>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1030 <getch@plt>
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     1175 <testArrowKey+0x65>
mov    -0x10(%rbp),%rax
lea    0xec4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    117c <testArrowKey+0x6c>
movl   $0x4,-0x4(%rbp)
jmp    117c <testArrowKey+0x6c>
movl   $0x3,-0x4(%rbp)
jmp    117c <testArrowKey+0x6c>
movl   $0x2,-0x4(%rbp)
jmp    117c <testArrowKey+0x6c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testArrowKey>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <getch@plt>
add    $0xffffff80,%eax
cmp    $0x3,%eax
ja     112e <testArrowKey+0x1e>
cltq
lea    0xed5(%rip),%rcx
mov    (%rcx,%rax,4),%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @testArrowKey() {
%1 = alloca i32
%2 = call i32 (...) @getch()
switch i32 %2, label %7 [
i32 128, label %3
i32 130, label %4
i32 129, label %5
i32 131, label %6
]
3: ; preds = %0
store i32 1, i32* %1
br label %8
4: ; preds = %0
store i32 4, i32* %1
br label %8
5: ; preds = %0
store i32 3, i32* %1
br label %8
6: ; preds = %0
store i32 2, i32* %1
br label %8
7: ; preds = %0
store i32 0, i32* %1
br label %8
8: ; preds = %7, %6, %5, %4, %3
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@switch.table.testArrowKey = [4 x i32] [i32 1, i32 3, i32 4, i32 2]
define i32 @testArrowKey() {
%1 = tail call i32 (...) @getch()
%2 = add i32 %1, -128
%3 = icmp ult i32 %2, 4
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [4 x i32], [4 x i32]* @switch.table.testArrowKey, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %0, %4
%9 = phi i32 [ %7, %4 ], [ 0, %0 ]
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
median(int a[], int len) { printf("%d  %d", sizeof(a) / sizeof(a[0]), len); }


x86 assembly (clang, -O0):
<median>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%edx
lea    0xed7(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\00"
define i32 @median(i32* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 2, i32 %1)
ret i32 undef
}
int main() {
  unsigned long long int a, b;
  a = 0xAAAAAAAAAAAAAAAAULL;
  b = a | 0xF0F0F0F0F0F0F0F0ULL;
  b = 0;
  b = a & 0xF0F0F0F0F0F0F0F0ULL;
  b = 0;
  b = a ^ 0xF0F0F0F0F0F0F0F0ULL;
  b = 0;
  b = ~(a | 0xF0F0F0F0F0F0F0F0ULL);
  b = 0;
  b = ~(a & 0xF0F0F0F0F0F0F0F0ULL);
  b = 0;
  b = ~(a ^ 0xF0F0F0F0F0F0F0F0ULL);
  b = 0;
  b = ~0xF0F0F0F0F0F0F0F0ULL;
  b = 0;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movabs $0xaaaaaaaaaaaaaaaa,%rax
aa aa aa
mov    %rax,-0x10(%rbp)
movabs $0xf0f0f0f0f0f0f0f0,%rax
f0 f0 f0
or     -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x18(%rbp)
movabs $0xf0f0f0f0f0f0f0f0,%rax
f0 f0 f0
and    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x18(%rbp)
movabs $0xf0f0f0f0f0f0f0f0,%rax
f0 f0 f0
xor    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x18(%rbp)
movabs $0xf0f0f0f0f0f0f0f0,%rax
f0 f0 f0
or     -0x10(%rbp),%rax
xor    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x18(%rbp)
movabs $0xf0f0f0f0f0f0f0f0,%rax
f0 f0 f0
and    -0x10(%rbp),%rax
xor    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x18(%rbp)
movabs $0xf0f0f0f0f0f0f0f0,%rax
f0 f0 f0
xor    -0x10(%rbp),%rax
xor    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x18(%rbp)
movabs $0xf0f0f0f0f0f0f0f,%rax
0f 0f 0f
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
store i64 -6148914691236517206, i64* %2
%4 = load i64, i64* %2
%5 = or i64 %4, -1085102592571150096
store i64 %5, i64* %3
store i64 0, i64* %3
%6 = load i64, i64* %2
%7 = and i64 %6, -1085102592571150096
store i64 %7, i64* %3
store i64 0, i64* %3
%8 = load i64, i64* %2
%9 = xor i64 %8, -1085102592571150096
store i64 %9, i64* %3
store i64 0, i64* %3
%10 = load i64, i64* %2
%11 = or i64 %10, -1085102592571150096
%12 = xor i64 %11, -1
store i64 %12, i64* %3
store i64 0, i64* %3
%13 = load i64, i64* %2
%14 = and i64 %13, -1085102592571150096
%15 = xor i64 %14, -1
store i64 %15, i64* %3
store i64 0, i64* %3
%16 = load i64, i64* %2
%17 = xor i64 %16, -1085102592571150096
%18 = xor i64 %17, -1
store i64 %18, i64* %3
store i64 0, i64* %3
store i64 1085102592571150095, i64* %3
store i64 0, i64* %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
float fp_add(float a, float b) { return a + b; }


x86 assembly (clang, -O0):
<fp_add>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fp_add>:
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @fp_add(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fadd float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @fp_add(float %0, float %1) {
%3 = fadd float %0, %1
ret float %3
}
int device_write(void *file, const char *buffer, int length, int *offset) {
  return -1;
}


x86 assembly (clang, -O0):
<device_write>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @device_write(i8* %0, i8* %1, i32 %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32* %3, i32** %8
ret i32 -1
}

LLVM IR (-O2):
define i32 @device_write(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2, i32* nocapture readnone %3) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ fsemu_option_read_bool_default(char const *, int *, int);
bool fsemu_option_disabled(const char *name) {
  bool result;
  fsemu_option_read_bool_default(name, &result, true);
  return result == false;
}


x86 assembly (clang, -O0):
<fsemu_option_disabled>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x1,%edx
call   1030 <fsemu_option_read_bool_default@plt>
cmpl   $0x0,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsemu_option_disabled>:
push   %rax
lea    0x4(%rsp),%rsi
mov    $0x1,%edx
call   1030 <fsemu_option_read_bool_default@plt>
xor    %eax,%eax
cmpl   $0x0,0x4(%rsp)
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @fsemu_option_disabled(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @fsemu_option_read_bool_default(i8* %4, i32* %3, i32 1)
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @fsemu_option_disabled(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @fsemu_option_read_bool_default(i8* %0, i32* %2, i32 1)
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int __simc(int, int, int, int);
int simc_ioctl(int fd, int request, void *arg) {
  return __simc(31, fd, request, (int)arg);
}


x86 assembly (clang, -O0):
<simc_ioctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    $0x1f,%edi
call   1030 <__simc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simc_ioctl>:
mov    %rdx,%rcx
mov    %esi,%edx
mov    %edi,%esi
mov    $0x1f,%edi
jmp    1030 <__simc@plt>

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

LLVM IR (-O2):
define i32 @simc_ioctl(i32 %0, i32 %1, i8* %2) {
%4 = ptrtoint i8* %2 to i64
%5 = trunc i64 %4 to i32
%6 = tail call i32 @__simc(i32 31, i32 %0, i32 %1, i32 %5)
ret i32 %6
}
int byte_row_gbk1(int byte) {
  if (byte >= 0x81 && byte < 0xff)
    return byte - 0x81;
  else
    return -1;
}


x86 assembly (clang, -O0):
<byte_row_gbk1>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x81,-0x8(%rbp)
jl     1131 <byte_row_gbk1+0x31>
cmpl   $0xff,-0x8(%rbp)
jge    1131 <byte_row_gbk1+0x31>
mov    -0x8(%rbp),%eax
sub    $0x81,%eax
mov    %eax,-0x4(%rbp)
jmp    1138 <byte_row_gbk1+0x38>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<byte_row_gbk1>:
lea    -0x81(%rdi),%ecx
cmp    $0x7e,%ecx
mov    $0xffffffff,%eax
cmovb  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @byte_row_gbk1(i32 %0) {
%2 = add i32 %0, -129
%3 = icmp ult i32 %2, 126
%4 = select i1 %3, i32 %2, i32 -1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ rename(char *, char *);
void irename(char *namein, char *nameout) { rename(namein, nameout); }


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

x86 assembly (clang, -O2):
<irename>:
jmp    1030 <rename@plt>

LLVM IR (-O0):
define void @irename(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 @rename(i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
define void @irename(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @rename(i8* %0, i8* %1)
ret void
}
/* Variables and functions */
double RAND_MAX;
int rand();
int randomInt(int a, int b) {
  return a + (int)(b * 1.0 * rand() / (RAND_MAX + 1.0));
}


x86 assembly (clang, -O0):
<randomInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
cvtsi2sdl -0x8(%rbp),%xmm0
movsd  0xecf(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movsd  -0x18(%rbp),%xmm0
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
cvtsi2sd %ecx,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xea5(%rip),%xmm1
mov    0x2e86(%rip),%rcx
addsd  (%rcx),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomInt>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
cvtsi2sd %esi,%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x8(%rsp),%xmm0
mov    0x2eac(%rip),%rax
movsd  (%rax),%xmm1
addsd  0xeb8(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
add    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define i32 @randomInt(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 = sitofp i32 %6 to double
%8 = fmul double %7, 1.000000e+00
%9 = call i32 (...) @rand()
%10 = sitofp i32 %9 to double
%11 = fmul double %8, %10
%12 = load double, double* @RAND_MAX
%13 = fadd double %12, 1.000000e+00
%14 = fdiv double %11, %13
%15 = fptosi double %14 to i32
%16 = add nsw i32 %5, %15
ret i32 %16
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define i32 @randomInt(i32 %0, i32 %1) {
%3 = sitofp i32 %1 to double
%4 = tail call i32 (...) @rand()
%5 = sitofp i32 %4 to double
%6 = fmul double %3, %5
%7 = load double, double* @RAND_MAX
%8 = fadd double %7, 1.000000e+00
%9 = fdiv double %6, %8
%10 = fptosi double %9 to i32
%11 = add nsw i32 %10, %0
ret i32 %11
}
void write_fs(unsigned val) {
  asm volatile("mov %0, %%fs" : : "rm"(val) : "memory");
}


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

x86 assembly (clang, -O2):
<write_fs>:
mov    %edi,-0x4(%rsp)
mov    -0x4(%rsp),%fs
ret

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

LLVM IR (-O2):
define void @write_fs(i32 %0) {
tail call void asm sideeffect "mov $0, %fs", "rm,~{memory},~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret void
}
/* Variables and functions */
bool isDigit(char c) { return c >= '0' && c <= '9'; }


x86 assembly (clang, -O0):
<isDigit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <isDigit+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isDigit>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @isDigit(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 label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @isDigit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
int rotate(int N) {
  int a, b, c, x, i, temp;
  a = 1;
  b = 2;
  c = 3;
  x = 0;
  for (i = 0; i < N; i++) {
    temp = a;
    a = b;
    b = c;
    c = temp;
  }
}


x86 assembly (clang, -O0):
<rotate>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x2,-0x10(%rbp)
movl   $0x3,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    115c <rotate+0x5c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112a <rotate+0x2a>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @rotate(i32 %0) {
ret i32 undef
}
long to_sign_long(__float128 a) { return (long)a; }


x86 assembly (clang, -O0):
<to_sign_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movaps %xmm0,-0x10(%rbp)
movaps -0x10(%rbp),%xmm0
call   1120 <__fixtfdi>
add    $0x10,%rsp
pop    %rbp
ret
nopl   0x0(%rax,%rax,1)

x86 assembly (clang, -O2):
<to_sign_long>:
push   %rax
call   1110 <__fixtfdi>
pop    %rcx
ret
nopl   0x0(%rax,%rax,1)

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

LLVM IR (-O2):
define i64 @to_sign_long(fp128 %0) {
%2 = fptosi fp128 %0 to i64
ret i64 %2
}
/* Variables and functions */
int f141(int *);
int f142(int *p) { return f141(p); }


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

x86 assembly (clang, -O2):
<f142>:
jmp    1030 <f141@plt>

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

LLVM IR (-O2):
define i32 @f142(i32* %0) {
%2 = tail call i32 @f141(i32* %0)
ret i32 %2
}
void event_init(struct event *e) {}


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

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

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

LLVM IR (-O2):
%struct.event = type opaque
define void @event_init(%struct.event* nocapture %0) {
ret void
}
void scrollup() {
  unsigned short dx = (getnumrows() << 8) + getnumcols();
  asm volatile("movw $0x0601, %%ax;"
               "movb $0x07, %%bh;"
               "xor %%cx, %%cx;"
               "int $0x10"
               : "+d"(dx)
               :
               : "eax", "ebx", "ecx");
}


x86 assembly (clang, -O0):
<scrollup>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
push   %rax
mov    $0x0,%al
call   1030 <getnumrows@plt>
shl    $0x8,%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getnumcols@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
add    %ecx,%eax
mov    %ax,-0xa(%rbp)
mov    -0xa(%rbp),%dx
mov    $0x601,%ax
mov    $0x7,%bh
xor    %cx,%cx
int    $0x10
mov    %dx,-0xa(%rbp)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<scrollup>:
push   %rbx
xor    %eax,%eax
call   1030 <getnumrows@plt>
mov    %eax,%ebx
shl    $0x8,%ebx
xor    %eax,%eax
call   1040 <getnumcols@plt>
add    %eax,%ebx
mov    %ebx,%edx
mov    $0x601,%ax
mov    $0x7,%bh
xor    %cx,%cx
int    $0x10
pop    %rbx
ret

LLVM IR (-O0):
define void @scrollup() {
%1 = alloca i16
%2 = call i32 (...) @getnumrows()
%3 = shl i32 %2, 8
%4 = call i32 (...) @getnumcols()
%5 = add nsw i32 %3, %4
%6 = trunc i32 %5 to i16
store i16 %6, i16* %1
%7 = load i16, i16* %1
%8 = call i16 asm sideeffect "movw $$0x0601, %ax;movb $$0x07, %bh;xor %cx, %cx;int $$0x10", "={dx},0,~{eax},~{ebx},~{ecx},~{dirflag},~{fpsr},~{flags}"(i16 %7)
store i16 %8, i16* %1
ret void
}

LLVM IR (-O2):
define void @scrollup() {
%1 = tail call i32 (...) @getnumrows()
%2 = shl i32 %1, 8
%3 = tail call i32 (...) @getnumcols()
%4 = add nsw i32 %2, %3
%5 = trunc i32 %4 to i16
%6 = tail call i16 asm sideeffect "movw $$0x0601, %ax;movb $$0x07, %bh;xor %cx, %cx;int $$0x10", "={dx},0,~{eax},~{ebx},~{ecx},~{dirflag},~{fpsr},~{flags}"(i16 %5)
ret void
}
int quirk_zfmicro(struct ohci_hcd *ohci) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.ohci_hcd = type opaque
define i32 @quirk_zfmicro(%struct.ohci_hcd* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
typedef int wint_t;

/* Variables and functions */
int isxdigit(int);
int iswxdigit(wint_t c) { return c <= 255 ? isxdigit(c) : 0; }


x86 assembly (clang, -O0):
<iswxdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xff,-0x4(%rbp)
jg     1138 <iswxdigit+0x28>
mov    -0x4(%rbp),%edi
call   1030 <isxdigit@plt>
mov    %eax,-0x8(%rbp)
jmp    1142 <iswxdigit+0x32>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <iswxdigit+0x32>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iswxdigit>:
cmp    $0xff,%edi
jg     111d <iswxdigit+0xd>
jmp    1030 <isxdigit@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @iswxdigit(i32 %0) {
%2 = icmp slt i32 %0, 256
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @isxdigit(i32 %0)
br label %5
5: ; preds = %1, %3
%6 = phi i32 [ %4, %3 ], [ 0, %1 ]
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_one_array(int A[], int n) {
  int i;
  for (i = 0; i < n; i++)
    printf("%d\t", A[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<print_one_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <print_one_array+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_one_array+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_one_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <print_one_array+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_one_array+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\09\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_one_array(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\09\00"
define void @print_one_array(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}