xunge/DecIR huggingface dataset:
/* Variables and functions */
double _tancot(double, int /*<<< orphan*/);
double tan(double x) { return _tancot(x, 0); }


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

x86 assembly (clang, -O2):
<tan>:
xor    %edi,%edi
jmp    1030 <_tancot@plt>

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

LLVM IR (-O2):
define double @tan(double %0) {
%2 = tail call double @_tancot(double %0, i32 0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ core3_print(char *, char *, char const *);
void U_EMRSETARCDIRECTION_print(const char *contents) {
  core3_print("U_EMRSETARCDIRECTION", "arcDirection:", contents);
}


x86 assembly (clang, -O0):
<U_EMRSETARCDIRECTION_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xed9(%rip),%rdi
lea    0xee7(%rip),%rsi
call   1030 <core3_print@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<U_EMRSETARCDIRECTION_print>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xef4(%rip),%rsi
jmp    1030 <core3_print@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"U_EMRSETARCDIRECTION\00"
@.str.1 = [14 x i8] c"arcDirection:\00"
define void @U_EMRSETARCDIRECTION_print(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @core3_print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"U_EMRSETARCDIRECTION\00"
@.str.1 = [14 x i8] c"arcDirection:\00"
define void @U_EMRSETARCDIRECTION_print(i8* %0) {
%2 = tail call i32 @core3_print(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
void __attribute__((constructor)) set_fast_math(void) {
  unsigned int mxcsr = __builtin_ia32_stmxcsr();
  mxcsr |= (1 << 6) | (1 << 15);
  __builtin_ia32_ldmxcsr(mxcsr);
}


x86 assembly (clang, -O0):
<set_fast_math>:
push   %rbp
mov    %rsp,%rbp
lea    -0x8(%rbp),%rax
stmxcsr (%rax)
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
or     $0x8040,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    -0xc(%rbp),%rax
ldmxcsr (%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_fast_math>:
stmxcsr -0x4(%rsp)
mov    $0x8040,%eax
or     -0x4(%rsp),%eax
mov    %eax,-0x8(%rsp)
ldmxcsr -0x8(%rsp)
ret

LLVM IR (-O0):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @set_fast_math, i8* null }]
define void @set_fast_math() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = load i32, i32* %2
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = or i32 %6, 32832
store i32 %7, i32* %1
%8 = load i32, i32* %1
store i32 %8, i32* %3
%9 = bitcast i32* %3 to i8*
ret void
}

LLVM IR (-O2):
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @set_fast_math, i8* null }]
define void @set_fast_math() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = load i32, i32* %1
%5 = or i32 %4, 32832
store i32 %5, i32* %2
%6 = bitcast i32* %2 to i8*
ret void
}
char *strcpy(char *dest, const char *src) {
  while (*src != '\0') {
    *dest = *src;
    dest++;
    src++;
  }
  *dest = '\0';
  return dest;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1145 <strcpy+0x45>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110c <strcpy+0xc>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1121 <strcpy+0x21>
add    $0x1,%rsi
nopl   (%rax)
mov    %cl,(%rax)
add    $0x1,%rax
movzbl (%rsi),%ecx
add    $0x1,%rsi
test   %cl,%cl
jne    1110 <strcpy+0x10>
movb   $0x0,(%rax)
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %10, %5 ], [ %1, %2 ]
%8 = phi i8* [ %9, %5 ], [ %0, %2 ]
store i8 %6, i8* %8
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %9, %5 ]
store i8 0, i8* %14
ret i8* %14
}
/* Variables and functions */
int /*<<< orphan*/ assert(void *);
void *malloc(size_t);
void *MR_MALLOC(size_t size) {
  void *temp = malloc(size);
  assert(temp);
  return temp;
}


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

x86 assembly (clang, -O2):
<MR_MALLOC>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @MR_MALLOC(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @assert(i8* %6)
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
define i8* @MR_MALLOC(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = tail call i32 @assert(i8* %2)
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int safe_atoi(char const *, int *);
int safe_atoi32(const char *s, int32_t *ret_i) {

#pragma GCC diagnostic push
  ;
#pragma GCC diagnostic ignored "-Wdeclaration-after-statement"
  ;
  struct _assert_struct_1 {
    char x[(sizeof(int32_t) == sizeof(int)) ? 0 : -1];
  };
#pragma GCC diagnostic pop
  ;
  return safe_atoi(s, (int *)ret_i);
}


x86 assembly (clang, -O0):
<safe_atoi32>:
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 <safe_atoi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_atoi32>:
jmp    1030 <safe_atoi@plt>

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

LLVM IR (-O2):
define i32 @safe_atoi32(i8* %0, i32* %1) {
%3 = tail call i32 @safe_atoi(i8* %0, i32* %1)
ret i32 %3
}
/* Type definitions */
struct timeval {
  unsigned int tv_sec;
  unsigned int tv_usec;
};

/* Variables and functions */
int select(int /*<<< orphan*/, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, struct timeval *);
int test_select(unsigned int msec_len) {
  struct timeval tv_sel;
  tv_sel.tv_sec = msec_len / 1000;
  tv_sel.tv_usec = (msec_len % 1000) * 1000;
  return select(0, NULL, NULL, NULL, &tv_sel);
}


x86 assembly (clang, -O0):
<test_select>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
imul   $0x3e8,%edx,%eax
mov    %eax,-0xc(%rbp)
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x10(%rbp),%r8
mov    %rcx,%rsi
mov    %rcx,%rdx
call   1030 <select@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_select>:
push   %rax
mov    %edi,%eax
imul   $0x10624dd3,%rax,%rax
shr    $0x26,%rax
mov    %eax,(%rsp)
imul   $0x3e8,%eax,%eax
sub    %eax,%edi
imul   $0x3e8,%edi,%eax
mov    %eax,0x4(%rsp)
mov    %rsp,%r8
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <select@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @test_select(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timeval
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = udiv i32 %4, 1000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
store i32 %5, i32* %6
%7 = load i32, i32* %2
%8 = urem i32 %7, 1000
%9 = mul i32 %8, 1000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
store i32 %9, i32* %10
%11 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %3)
ret i32 %11
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i32 @test_select(i32 %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = udiv i32 %0, 1000
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
store i32 %4, i32* %5
%6 = urem i32 %0, 1000
%7 = mul nuw nsw i32 %6, 1000
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 1
store i32 %7, i32* %8
%9 = call i32 @select(i32 0, i32* null, i32* null, i32* null, %struct.timeval* %2)
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ bswap_16(int /*<<< orphan*/);
uint16_t cpu_to_le16(uint16_t native) { return bswap_16(native); }


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

x86 assembly (clang, -O2):
<cpu_to_le16>:
jmp    1030 <bswap_16@plt>

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

LLVM IR (-O2):
define i32 @cpu_to_le16(i32 %0) {
%2 = tail call i32 @bswap_16(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ syscall1(int, int);
void unhookKeyboard() { syscall1(12, 1); }


x86 assembly (clang, -O0):
<unhookKeyboard>:
push   %rbp
mov    %rsp,%rbp
mov    $0xc,%edi
mov    $0x1,%esi
call   1030 <syscall1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<unhookKeyboard>:
mov    $0xc,%edi
mov    $0x1,%esi
jmp    1030 <syscall1@plt>

LLVM IR (-O0):
define void @unhookKeyboard() {
%1 = call i32 @syscall1(i32 12, i32 1)
ret void
}

LLVM IR (-O2):
define void @unhookKeyboard() {
%1 = tail call i32 @syscall1(i32 12, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int getpgrp();
int getpid();
int getppid();
int /*<<< orphan*/ printf(char *, char *, int, int, int);
int /*<<< orphan*/ stdout;
void pr_ids(char *name) {
  printf("%s:pid= %d, ppid = %d ,pgrp = %d\n", name, getpid(), getppid(),
         getpgrp());
  fflush(stdout);
}


x86 assembly (clang, -O0):
<pr_ids>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1070 <getppid@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1060 <getpgrp@plt>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    %eax,%r8d
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
call   1050 <fflush@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_ids>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
xor    %eax,%eax
call   1030 <getpid@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1070 <getppid@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1060 <getpgrp@plt>
lea    0xe89(%rip),%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
mov    0x2e53(%rip),%rax
mov    (%rax),%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1050 <fflush@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"%s:pid= %d, ppid = %d ,pgrp = %d\0A\00"
@stdout = global i32 0
define void @pr_ids(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (...) @getpid()
%5 = call i32 (...) @getppid()
%6 = call i32 (...) @getpgrp()
%7 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %3, i32 %4, i32 %5, i32 %6)
%8 = load i32, i32* @stdout
%9 = call i32 @fflush(i32 %8)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"%s:pid= %d, ppid = %d ,pgrp = %d\0A\00"
@stdout = global i32 0
define void @pr_ids(i8* %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 (...) @getppid()
%4 = tail call i32 (...) @getpgrp()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %2, i32 %3, i32 %4)
%6 = load i32, i32* @stdout
%7 = tail call i32 @fflush(i32 %6)
ret void
}
unsigned long gcd(unsigned long a, unsigned long b) {
  unsigned long r;
  if (a < b) {
    r = a;
    a = b;
    b = r;
  }
  while ((r = a % b) != 0) {
    a = b;
    b = r;
  }
  return b;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1132 <gcd+0x32>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1137 <gcd+0x37>
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmp    $0x0,%rdx
je     1166 <gcd+0x66>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1137 <gcd+0x37>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %rsi,%rdx
cmp    %rsi,%rdi
mov    %rdi,%rax
cmovb  %rsi,%rax
cmovb  %rdi,%rdx
jmp    112d <gcd+0x2d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %edx,%edx
div    %rcx
mov    %rcx,%rax
test   %rdx,%rdx
je     1142 <gcd+0x42>
mov    %rdx,%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    1120 <gcd+0x20>
xor    %edx,%edx
div    %ecx
jmp    1125 <gcd+0x25>
mov    %rcx,%rax
ret

LLVM IR (-O0):
define i64 @gcd(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 = icmp ult i64 %6, %7
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i64, i64* %3
store i64 %10, i64* %5
%11 = load i64, i64* %4
store i64 %11, i64* %3
%12 = load i64, i64* %5
store i64 %12, i64* %4
br label %13
13: ; preds = %9, %2
br label %14
14: ; preds = %19, %13
%15 = load i64, i64* %3
%16 = load i64, i64* %4
%17 = urem i64 %15, %16
store i64 %17, i64* %5
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load i64, i64* %4
store i64 %20, i64* %3
%21 = load i64, i64* %5
store i64 %21, i64* %4
br label %14
22: ; preds = %14
%23 = load i64, i64* %4
ret i64 %23
}

LLVM IR (-O2):
define i64 @gcd(i64 %0, i64 %1) {
%3 = icmp ult i64 %0, %1
%4 = select i1 %3, i64 %1, i64 %0
%5 = select i1 %3, i64 %0, i64 %1
br label %6
6: ; preds = %6, %2
%7 = phi i64 [ %4, %2 ], [ %8, %6 ]
%8 = phi i64 [ %5, %2 ], [ %9, %6 ]
%9 = urem i64 %7, %8
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6
ret i64 %8
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
void report(const char *label) {
  fprintf(stderr, "rawspeed: %s: %s\n", label, strerror(errno));
}


x86 assembly (clang, -O0):
<report>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rdx
mov    %rax,%rcx
lea    0xea1(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb3(%rip),%rax
mov    (%rax),%ebp
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
lea    0xebc(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    %rax,%rcx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"rawspeed: %s: %s\0A\00"
@errno = global i32 0
define void @report(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = load i32, i32* @errno
%6 = call i8* @strerror(i32 %5)
%7 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %6)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"rawspeed: %s: %s\0A\00"
@errno = global i32 0
define void @report(i8* %0) {
%2 = load i32, i32* @stderr
%3 = load i32, i32* @errno
%4 = tail call i8* @strerror(i32 %3)
%5 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %4)
ret void
}
unsigned bits_rice_code(unsigned value, unsigned rice_k) {
  unsigned unary;
  unsigned bits = 0;
  for (unary = value >> rice_k; unary; unary--)
    bits++;
  bits += rice_k + 1;
  return bits;
}


x86 assembly (clang, -O0):
<bits_rice_code>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
shr    %cl,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     113d <bits_rice_code+0x3d>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    111c <bits_rice_code+0x1c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bits_rice_code>:
mov    %esi,%ecx
shr    %cl,%edi
lea    (%rdi,%rcx,1),%eax
add    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @bits_rice_code(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = add i32 %3, 1
%5 = add i32 %4, %1
ret i32 %5
}
unsigned int inl_p(unsigned short port) {
  unsigned int _v;
  asm volatile("in"
               "l"
               " %"
               "w"
               "1,%"
               ""
               "0"
               : "=a"(_v)
               : "Nd"(port));
  slow_down_io();
  return _v;
}


x86 assembly (clang, -O0):
<inl_p>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <slow_down_io@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inl_p>:
push   %rbx
mov    %edi,%edx
in     (%dx),%eax
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <slow_down_io@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @inl_p(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i32
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i32 asm sideeffect "inl ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i32 %5, i32* %3
%6 = call i32 (...) @slow_down_io()
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
define i32 @inl_p(i16 zeroext %0) {
%2 = tail call i32 asm sideeffect "inl ${1:w},$0", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
%3 = tail call i32 (...) @slow_down_io()
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void help(int argc, char *argv[]) {
  printf("This is helpful.\n");
  return;
}


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

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

LLVM IR (-O0):
@.str = [18 x i8] c"This is helpful.\0A\00"
define void @help(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [17 x i8] c"This is helpful.\00"
define void @help(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
ret void
}
short int shortint_ignoring_signedint(short int x, signed int y) { return x; }


x86 assembly (clang, -O0):
<shortint_ignoring_signedint>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %esi,-0x8(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i16 @shortint_ignoring_signedint(i16 signext %0, i32 %1) {
%3 = alloca i16
%4 = alloca i32
store i16 %0, i16* %3
store i32 %1, i32* %4
%5 = load i16, i16* %3
ret i16 %5
}

LLVM IR (-O2):
define signext i16 @shortint_ignoring_signedint(i16 returned signext %0, i32 %1) {
ret i16 %0
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ read(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ set_input_mode();
int main(void) {
  char c;
  set_input_mode();
  while (1) {
    read(STDIN_FILENO, &c, 1);
    if (c == '\004')
      break;
    else
      putchar(c);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <set_input_mode@plt>
mov    0x2e8b(%rip),%rax
mov    (%rax),%edi
lea    -0x5(%rbp),%rsi
mov    $0x1,%edx
call   1050 <read@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x4,%eax
jne    116f <main+0x3f>
jmp    117d <main+0x4d>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    1146 <main+0x16>
mov    0x2e5c(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <set_input_mode@plt>
mov    0x2e96(%rip),%r14
mov    (%r14),%edi
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1050 <read@plt>
mov    0x7(%rsp),%al
cmp    $0x4,%al
je     1191 <main+0x61>
lea    0x7(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <putchar@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1050 <read@plt>
movzbl 0x7(%rsp),%eax
cmp    $0x4,%al
jne    1170 <main+0x40>
mov    0x2e48(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@STDIN_FILENO = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call i32 (...) @set_input_mode()
br label %4
4: ; preds = %0, %14
%5 = load i32, i32* @STDIN_FILENO
%6 = call i32 @read(i32 %5, i8* %2, i32 1)
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 4
br i1 %9, label %10, label %11
10: ; preds = %4
br label %15
11: ; preds = %4
%12 = load i8, i8* %2
%13 = call i32 @putchar(i8 signext %12)
br label %14
14: ; preds = %11
br label %4
15: ; preds = %10
%16 = load i32, i32* @EXIT_SUCCESS
ret i32 %16
}

LLVM IR (-O2):
@STDIN_FILENO = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 (...) @set_input_mode()
%3 = load i32, i32* @STDIN_FILENO
%4 = call i32 @read(i32 %3, i8* %1, i32 1)
%5 = load i8, i8* %1
%6 = icmp eq i8 %5, 4
br i1 %6, label %14, label %7
7: ; preds = %0, %7
%8 = phi i8 [ %12, %7 ], [ %5, %0 ]
%9 = tail call i32 @putchar(i8 signext %8)
%10 = load i32, i32* @STDIN_FILENO
%11 = call i32 @read(i32 %10, i8* %1, i32 1)
%12 = load i8, i8* %1
%13 = icmp eq i8 %12, 4
br i1 %13, label %14, label %7
14: ; preds = %7, %0
%15 = load i32, i32* @EXIT_SUCCESS
ret i32 %15
}
/* Variables and functions */
int getint();
int getmax(int, int, int);
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main(void) {
  int x, y, z;
  x = getint();
  y = getint();
  z = getint();
  printf("The largest of %d, %d, and %d is %d\n", x, y, z, getmax(x, y, z));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1050 <getint@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1050 <getint@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <getint@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <getmax@plt>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    %eax,%r8d
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <getint@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1050 <getint@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1050 <getint@plt>
mov    %eax,%ebx
mov    %r14d,%edi
mov    %ebp,%esi
mov    %eax,%edx
call   1030 <getmax@plt>
lea    0xe9d(%rip),%rdi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %ebx,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [37 x i8] c"The largest of %d, %d, and %d is %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @getint()
%2 = tail call i32 (...) @getint()
%3 = tail call i32 (...) @getint()
%4 = tail call i32 @getmax(i32 %1, i32 %2, i32 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2, i32 %3, i32 %4)
ret i32 0
}
double dv2_dot(double *a, double *b) { return a[0] * b[0] + a[1] * b[1]; }


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

x86 assembly (clang, -O2):
<dv2_dot>:
movsd  0x8(%rdi),%xmm1
mulsd  0x8(%rsi),%xmm1
movsd  (%rdi),%xmm0
mulsd  (%rsi),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @dv2_dot(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %3
%6 = getelementptr inbounds double, double* %5, i64 0
%7 = load double, double* %6
%8 = load double*, double** %4
%9 = getelementptr inbounds double, double* %8, i64 0
%10 = load double, double* %9
%11 = load double*, double** %3
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
%14 = load double*, double** %4
%15 = getelementptr inbounds double, double* %14, i64 1
%16 = load double, double* %15
%17 = fmul double %13, %16
%18 = call double @llvm.fmuladd.f64(double %7, double %10, double %17)
ret double %18
}

LLVM IR (-O2):
define double @dv2_dot(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = load double, double* %1
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = fmul double %6, %8
%10 = tail call double @llvm.fmuladd.f64(double %3, double %4, double %9)
ret double %10
}
void f(void) {
  int a[100][100];
  int i;
  int j;
#pragma hlt block factors(10, 20)
  for (i = 0; i < 100; i++) {
    for (j = 0; j < 100; j++) {
      a[i][j] = i * j;
    }
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x9bd0,%rsp
movl   $0x0,-0x9c44(%rbp)
cmpl   $0x64,-0x9c44(%rbp)
jge    1195 <f+0x95>
movl   $0x0,-0x9c48(%rbp)
cmpl   $0x64,-0x9c48(%rbp)
jge    117c <f+0x7c>
mov    -0x9c44(%rbp),%edx
imul   -0x9c48(%rbp),%edx
movslq -0x9c44(%rbp),%rcx
lea    -0x9c40(%rbp),%rax
imul   $0x190,%rcx,%rcx
add    %rcx,%rax
movslq -0x9c48(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x9c48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c48(%rbp)
jmp    112c <f+0x2c>
jmp    1181 <f+0x81>
mov    -0x9c44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c44(%rbp)
jmp    1115 <f+0x15>
add    $0x9bd0,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @f() {
ret void
}
int utl_peg_eol(const char *str) {
  int ret;
  switch (*str) {
  case '\0':
    ret = 0;
    break;
  case '\n':
    ret = 1;
    break;
  case '\r':
    ret = (str[1] == '\n') ? 2 : 1;
  default:
    ret = -1;
  }
  return ret;
}


x86 assembly (clang, -O0):
<utl_peg_eol>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     1141 <utl_peg_eol+0x41>
jmp    111f <utl_peg_eol+0x1f>
mov    -0x10(%rbp),%eax
sub    $0xa,%eax
je     114d <utl_peg_eol+0x4d>
jmp    1130 <utl_peg_eol+0x30>
mov    -0x10(%rbp),%eax
sub    $0xd,%eax
je     1159 <utl_peg_eol+0x59>
jmp    1174 <utl_peg_eol+0x74>
movl   $0x0,-0xc(%rbp)
jmp    117b <utl_peg_eol+0x7b>
movl   $0x1,-0xc(%rbp)
jmp    117b <utl_peg_eol+0x7b>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%edx
mov    $0x1,%eax
mov    $0x2,%ecx
cmp    $0xa,%edx
cmove  %ecx,%eax
mov    %eax,-0xc(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<utl_peg_eol>:
mov    (%rdi),%cl
xor    %eax,%eax
cmp    $0xa,%cl
sete   %al
lea    (%rax,%rax,1),%edx
add    $0xffffffff,%edx
xor    %eax,%eax
test   %cl,%cl
cmovne %edx,%eax
ret

LLVM IR (-O0):
define i32 @utl_peg_eol(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
switch i32 %6, label %17 [
i32 0, label %7
i32 10, label %8
i32 13, label %9
]
7: ; preds = %1
store i32 0, i32* %3
br label %18
8: ; preds = %1
store i32 1, i32* %3
br label %18
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 10
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 2, i32 1
store i32 %16, i32* %3
br label %17
17: ; preds = %1, %9
store i32 -1, i32* %3
br label %18
18: ; preds = %17, %8, %7
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @utl_peg_eol(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 10
%4 = select i1 %3, i32 1, i32 -1
%5 = icmp eq i8 %2, 0
%6 = select i1 %5, i32 0, i32 %4
ret i32 %6
}
int decide_dtx_mode(int activity, int *nb_no_activity_frames) {
  if (!activity) {
    (*nb_no_activity_frames)++;
    if (*nb_no_activity_frames > 10) {
      if (*nb_no_activity_frames <= (10 + 20))
        return 1;
      else
        (*nb_no_activity_frames) = 10;
    }
  } else
    (*nb_no_activity_frames) = 0;
  return 0;
}


x86 assembly (clang, -O0):
<decide_dtx_mode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    115a <decide_dtx_mode+0x5a>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cmpl   $0xa,(%rax)
jle    1155 <decide_dtx_mode+0x55>
mov    -0x10(%rbp),%rax
cmpl   $0x1e,(%rax)
jg     1146 <decide_dtx_mode+0x46>
movl   $0x1,-0x4(%rbp)
jmp    116b <decide_dtx_mode+0x6b>
mov    -0x10(%rbp),%rax
movl   $0xa,(%rax)
jmp    1155 <decide_dtx_mode+0x55>
jmp    1164 <decide_dtx_mode+0x64>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decide_dtx_mode>:
xor    %ecx,%ecx
test   %edi,%edi
je     110a <decide_dtx_mode+0xa>
mov    %ecx,(%rsi)
jmp    1126 <decide_dtx_mode+0x26>
mov    (%rsi),%edx
lea    0x1(%rdx),%eax
mov    %eax,(%rsi)
cmp    $0xa,%edx
jl     1126 <decide_dtx_mode+0x26>
mov    $0xa,%ecx
mov    $0x1,%eax
cmp    $0x1e,%edx
jae    1106 <decide_dtx_mode+0x6>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @decide_dtx_mode(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* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %24, label %8
8: ; preds = %2
%9 = load i32*, i32** %5
%10 = load i32, i32* %9
%11 = add nsw i32 %10, 1
store i32 %11, i32* %9
%12 = load i32*, i32** %5
%13 = load i32, i32* %12
%14 = icmp sgt i32 %13, 10
br i1 %14, label %15, label %23
15: ; preds = %8
%16 = load i32*, i32** %5
%17 = load i32, i32* %16
%18 = icmp sle i32 %17, 30
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 1, i32* %3
br label %27
20: ; preds = %15
%21 = load i32*, i32** %5
store i32 10, i32* %21
br label %22
22: ; preds = %20
br label %23
23: ; preds = %22, %8
br label %26
24: ; preds = %2
%25 = load i32*, i32** %5
store i32 0, i32* %25
br label %26
26: ; preds = %24, %23
store i32 0, i32* %3
br label %27
27: ; preds = %26, %19
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
define i32 @decide_dtx_mode(i32 %0, i32* nocapture %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 1
store i32 %6, i32* %1
%7 = icmp sgt i32 %5, 9
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = icmp ult i32 %5, 30
br i1 %9, label %12, label %10
10: ; preds = %2, %8
%11 = phi i32 [ 10, %8 ], [ 0, %2 ]
store i32 %11, i32* %1
br label %12
12: ; preds = %10, %4, %8
%13 = phi i32 [ 1, %8 ], [ 0, %4 ], [ 0, %10 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ __console_tx_hex32(int /*<<< orphan*/, unsigned int);
void print_emerg_hex32(unsigned int value) { __console_tx_hex32(0, value); }


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

x86 assembly (clang, -O2):
<print_emerg_hex32>:
mov    %edi,%esi
xor    %edi,%edi
jmp    1030 <__console_tx_hex32@plt>

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

LLVM IR (-O2):
define void @print_emerg_hex32(i32 %0) {
%2 = tail call i32 @__console_tx_hex32(i32 0, i32 %0)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ chr2setBank3(int);
void m193setParams6002(uint16_t addr, uint8_t val) {
  (void)addr;
  chr2setBank3((val >> 1) << 11);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
sar    $0x1,%edi
shl    $0xb,%edi
call   1030 <chr2setBank3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    %esi,%edi
and    $0xfffffffe,%edi
shl    $0xa,%edi
jmp    1030 <chr2setBank3@plt>

LLVM IR (-O0):
define void @m193setParams6002(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 = ashr i32 %6, 1
%8 = shl i32 %7, 11
%9 = call i32 @chr2setBank3(i32 %8)
ret void
}

LLVM IR (-O2):
define void @m193setParams6002(i32 %0, i32 %1) {
%3 = shl i32 %1, 10
%4 = and i32 %3, -2048
%5 = tail call i32 @chr2setBank3(i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
scalar_t__ wait_child(int);
int wait_command(int pid) {
  if (wait_child(pid) < 0) {
    printf("Fatal error in process.\n");
    return (-1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<wait_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <wait_child@plt>
cmp    $0x0,%rax
jge    1155 <wait_command+0x35>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    115c <wait_command+0x3c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_command>:
push   %rax
call   1040 <wait_child@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
js     1132 <wait_command+0x12>
pop    %rcx
ret
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Fatal error in process.\0A\00"
define i32 @wait_command(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i64 @wait_child(i32 %4)
%6 = icmp slt i64 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %10
9: ; preds = %1
store i32 0, i32* %2
br label %10
10: ; preds = %9, %7
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@str = [24 x i8] c"Fatal error in process.\00"
define i32 @wait_command(i32 %0) {
%2 = tail call i64 @wait_child(i32 %0)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ -1, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("stern-brocot (<start> <limit>)\n");
  printf("             -h|--help\n");
}


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

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

LLVM IR (-O0):
@.str = [32 x i8] c"stern-brocot (<start> <limit>)\0A\00"
@.str.1 = [24 x i8] c" -h|--help\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [31 x i8] c"stern-brocot (<start> <limit>)\00"
@str.2 = [23 x i8] c" -h|--help\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ __NONDET__();
int main() {
  int a[5];
  int len = 0;
  int i;
  while (__NONDET__()) {
    if (len == 4)
      len = 0;
    a[len] = 0;
    len++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
mov    $0x0,%al
call   1030 <__NONDET__@plt>
cmp    $0x0,%rax
je     1162 <main+0x52>
cmpl   $0x4,-0x24(%rbp)
jne    1148 <main+0x38>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
movl   $0x0,-0x20(%rbp,%rax,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1126 <main+0x16>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <__NONDET__@plt>
test   %rax,%rax
jne    1120 <main+0x10>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %12, %0
%6 = call i64 (...) @__NONDET__()
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %18
8: ; preds = %5
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 4
br i1 %10, label %11, label %12
11: ; preds = %8
store i32 0, i32* %3
br label %12
12: ; preds = %11, %8
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %14
store i32 0, i32* %15
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %5
18: ; preds = %5
ret i32 1
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i64 (...) @__NONDET__()
%2 = icmp eq i64 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0, %3
%4 = tail call i64 (...) @__NONDET__()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %3
6: ; preds = %3, %0
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void problem(char *s) {
  fprintf(stderr, "Timing test failed.\n");
  fprintf(stderr, "%s\n", s);
  exit(1);
}


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

x86 assembly (clang, -O2):
<problem>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb2(%rip),%r14
mov    (%r14),%edi
lea    0xec8(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xecc(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"Timing test failed.\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @problem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %2
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"Timing test failed.\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @problem(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%6 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
void invertsmp(void *buf, size_t ss, size_t count) {
  unsigned int i;
  unsigned char *c;
  for (i = 0; i < ss * count; i++) {
    c = buf + i;
    *c = 255 - *c;
  }
}


x86 assembly (clang, -O0):
<invertsmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x10(%rbp),%rcx
imul   -0x18(%rbp),%rcx
cmp    %rcx,%rax
jae    115e <invertsmp+0x5e>
mov    -0x8(%rbp),%rax
mov    -0x1c(%rbp),%ecx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movzbl (%rax),%ecx
mov    $0xff,%eax
sub    %ecx,%eax
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    %cl,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1117 <invertsmp+0x17>
pop    %rbp
ret

x86 assembly (clang, -O2):
<invertsmp>:
imul   %rdx,%rsi
test   %rsi,%rsi
je     111b <invertsmp+0x1b>
xor    %eax,%eax
nopl   0x0(%rax,%rax,1)
notb   (%rdi,%rax,1)
add    $0x1,%eax
cmp    %rax,%rsi
ja     1110 <invertsmp+0x10>
ret

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

LLVM IR (-O2):
define void @invertsmp(i8* nocapture %0, i64 %1, i64 %2) {
%4 = mul i64 %2, %1
%5 = icmp eq i64 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %3, %6
%7 = phi i64 [ %12, %6 ], [ 0, %3 ]
%8 = getelementptr i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = xor i8 %9, -1
store i8 %10, i8* %8
%11 = add nuw nsw i64 %7, 1
%12 = and i64 %11, 4294967295
%13 = icmp ugt i64 %4, %12
br i1 %13, label %6, label %14
14: ; preds = %6, %3
ret void
}