xunge/DecIR huggingface dataset:
int getWinner(int playerChoice, int AIChoice) {
  int difference = (5 + playerChoice - AIChoice);
  int remainder = difference % 5;
  switch (remainder) {
  case 1:
  case 3:
    return 1;
  case 2:
  case 4:
    return 2;
  default:
    return 0;
  }
}


x86 assembly (clang, -O0):
<getWinner>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    %ecx,%eax
add    $0x5,%eax
mov    %eax,-0x10(%rbp)
movslq -0x10(%rbp),%rcx
mov    %ecx,%eax
imul   $0x66666667,%rcx,%rdx
mov    %rdx,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rdx
add    %ecx,%edx
mov    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     117d <getWinner+0x7d>
mov    -0x20(%rbp),%rax
lea    0xea4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    1184 <getWinner+0x84>
movl   $0x2,-0x4(%rbp)
jmp    1184 <getWinner+0x84>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getWinner>:
sub    %esi,%edi
lea    0x5(%rdi),%eax
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%eax
not    %eax
lea    (%rax,%rdi,1),%ecx
add    $0x5,%ecx
xor    %eax,%eax
cmp    $0x3,%ecx
ja     113a <getWinner+0x3a>
movslq %ecx,%rax
lea    0xec9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @getWinner(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%8 = load i32, i32* %4
%9 = add nsw i32 5, %8
%10 = load i32, i32* %5
%11 = sub nsw i32 %9, %10
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = srem i32 %12, 5
store i32 %13, i32* %7
%14 = load i32, i32* %7
switch i32 %14, label %17 [
i32 1, label %15
i32 3, label %15
i32 2, label %16
i32 4, label %16
]
15: ; preds = %2, %2
store i32 1, i32* %3
br label %18
16: ; preds = %2, %2
store i32 2, i32* %3
br label %18
17: ; preds = %2
store i32 0, i32* %3
br label %18
18: ; preds = %17, %16, %15
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@switch.table.getWinner = [4 x i32] [i32 1, i32 2, i32 1, i32 2]
define i32 @getWinner(i32 %0, i32 %1) {
%3 = add nsw i32 %0, 5
%4 = sub i32 %3, %1
%5 = srem i32 %4, 5
%6 = add nsw i32 %5, -1
%7 = icmp ult i32 %6, 4
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = sext i32 %6 to i64
%10 = getelementptr inbounds [4 x i32], [4 x i32]* @switch.table.getWinner, i64 0, i64 %9
%11 = load i32, i32* %10
br label %12
12: ; preds = %2, %8
%13 = phi i32 [ %11, %8 ], [ 0, %2 ]
ret i32 %13
}
/* Variables and functions */
int S_IRUSR;
int S_IWUSR;
int S_IXUSR;
int /*<<< orphan*/ mkdir(char *, int);
void mktempdir(char *path) { mkdir(path, S_IRUSR | S_IWUSR | S_IXUSR); }


x86 assembly (clang, -O0):
<mktempdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea9(%rip),%rax
mov    (%rax),%esi
mov    0x2eb0(%rip),%rax
or     (%rax),%esi
mov    0x2eaf(%rip),%rax
or     (%rax),%esi
call   1030 <mkdir@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mktempdir>:
mov    0x2eb9(%rip),%rax
mov    0x2ec2(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2ebf(%rip),%rax
or     (%rax),%esi
jmp    1030 <mkdir@plt>

LLVM IR (-O0):
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
define void @mktempdir(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @S_IRUSR
%5 = load i32, i32* @S_IWUSR
%6 = or i32 %4, %5
%7 = load i32, i32* @S_IXUSR
%8 = or i32 %6, %7
%9 = call i32 @mkdir(i8* %3, i32 %8)
ret void
}

LLVM IR (-O2):
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IXUSR = global i32 0
define void @mktempdir(i8* nocapture %0) {
%2 = load i32, i32* @S_IRUSR
%3 = load i32, i32* @S_IWUSR
%4 = or i32 %3, %2
%5 = load i32, i32* @S_IXUSR
%6 = or i32 %4, %5
%7 = tail call i32 @mkdir(i8* %0, i32 %6)
ret void
}
extern int init_scribe(struct task_struct *p, struct scribe_context *ctx,
                       struct scribe_ps *parent) {
  return 0;
}


x86 assembly (clang, -O0):
<init_scribe>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.task_struct = type opaque
%struct.scribe_context = type opaque
%struct.scribe_ps = type opaque
define i32 @init_scribe(%struct.task_struct* %0, %struct.scribe_context* %1, %struct.scribe_ps* %2) {
%4 = alloca %struct.task_struct*
%5 = alloca %struct.scribe_context*
%6 = alloca %struct.scribe_ps*
store %struct.task_struct* %0, %struct.task_struct** %4
store %struct.scribe_context* %1, %struct.scribe_context** %5
store %struct.scribe_ps* %2, %struct.scribe_ps** %6
ret i32 0
}

LLVM IR (-O2):
%struct.task_struct = type opaque
%struct.scribe_context = type opaque
%struct.scribe_ps = type opaque
define i32 @init_scribe(%struct.task_struct* nocapture readnone %0, %struct.scribe_context* nocapture readnone %1, %struct.scribe_ps* nocapture readnone %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
void smash(char *p, int n) { memset(p, 0, n); }


x86 assembly (clang, -O0):
<smash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smash>:
mov    %esi,%edx
xor    %esi,%esi
jmp    1030 <memset@plt>

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

LLVM IR (-O2):
define void @smash(i8* %0, i32 %1) {
%3 = tail call i32 @memset(i8* %0, i32 0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SCIprintf(char *, ...);
double tcnt_get_in_ms();
void tcnt_show(char *s, int cr_sw) {
  double t;
  t = tcnt_get_in_ms();
  SCIprintf("%s: elapsed = %8.3lf[ms]", s, t);
  if (cr_sw == 1) {
    SCIprintf("\n");
  }
}


x86 assembly (clang, -O0):
<tcnt_show>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <tcnt_get_in_ms@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
movsd  -0x18(%rbp),%xmm0
lea    0xeb5(%rip),%rdi
mov    $0x1,%al
call   1040 <SCIprintf@plt>
cmpl   $0x1,-0xc(%rbp)
jne    116a <tcnt_show+0x4a>
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1040 <SCIprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcnt_show>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <tcnt_get_in_ms@plt>
lea    0xeca(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%al
call   1040 <SCIprintf@plt>
cmp    $0x1,%ebp
jne    1159 <tcnt_show+0x39>
lea    0xecd(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <SCIprintf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"%s: elapsed = %8.3lf[ms]\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @tcnt_show(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca double
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = call double (...) @tcnt_get_in_ms()
store double %6, double* %5
%7 = load i8*, i8** %3
%8 = load double, double* %5
%9 = call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %7, double %8)
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %2
ret void
}

LLVM IR (-O2):
@.str = [25 x i8] c"%s: elapsed = %8.3lf[ms]\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @tcnt_show(i8* %0, i32 %1) {
%3 = tail call double (...) @tcnt_get_in_ms()
%4 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0, double %3)
%5 = icmp eq i32 %1, 1
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @SCIprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %6, %2
ret void
}
/* Variables and functions */
int comparef2(long const, long const);
int __gtsf2(float a, float b) {
  return comparef2((*(const long *)&a), (*(const long *)&b));
}


x86 assembly (clang, -O0):
<__gtsf2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    -0x4(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <comparef2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__gtsf2>:
movss  %xmm0,-0x8(%rsp)
movss  %xmm1,-0x10(%rsp)
mov    -0x8(%rsp),%rdi
mov    -0x10(%rsp),%rsi
jmp    1030 <comparef2@plt>

LLVM IR (-O0):
define i32 @__gtsf2(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = bitcast float* %3 to i64*
%6 = load i64, i64* %5
%7 = bitcast float* %4 to i64*
%8 = load i64, i64* %7
%9 = call i32 @comparef2(i64 %6, i64 %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @__gtsf2(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = bitcast float* %3 to i64*
%6 = load i64, i64* %5
%7 = bitcast float* %4 to i64*
%8 = load i64, i64* %7
%9 = tail call i32 @comparef2(i64 %6, i64 %8)
ret i32 %9
}
/* Variables and functions */
int tst_fs_fill_subdirs_(void (*)(), char const *);
int tst_fs_fill_subdirs(void (*cleanup)(void), const char *dir) {
  return tst_fs_fill_subdirs_(cleanup, dir);
}


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

x86 assembly (clang, -O2):
<tst_fs_fill_subdirs>:
jmp    1030 <tst_fs_fill_subdirs_@plt>

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

LLVM IR (-O2):
define i32 @tst_fs_fill_subdirs(void ()* %0, i8* %1) {
%3 = bitcast void ()* %0 to void (...)*
%4 = tail call i32 @tst_fs_fill_subdirs_(void (...)* %3, i8* %1)
ret i32 %4
}
int isPalindrome(int num) {
  int temp = num;
  int reversed = 0;
  while (temp > 0) {
    reversed = reversed * 10 + temp % 10;
    temp /= 10;
  }
  if (reversed == num) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<isPalindrome>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    114b <isPalindrome+0x4b>
imul   $0xa,-0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1114 <isPalindrome+0x14>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1163 <isPalindrome+0x63>
movl   $0x1,-0x4(%rbp)
jmp    116a <isPalindrome+0x6a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPalindrome>:
xor    %edx,%edx
test   %edi,%edi
jle    1133 <isPalindrome+0x33>
mov    $0xcccccccd,%r8d
mov    %edi,%ecx
xchg   %ax,%ax
lea    (%rdx,%rdx,4),%r9d
mov    %ecx,%esi
imul   %r8,%rsi
shr    $0x23,%rsi
lea    (%rsi,%rsi,1),%eax
lea    (%rax,%rax,4),%eax
mov    %ecx,%edx
sub    %eax,%edx
lea    (%rdx,%r9,2),%edx
cmp    $0x9,%ecx
mov    %esi,%ecx
ja     1110 <isPalindrome+0x10>
xor    %eax,%eax
cmp    %edi,%edx
sete   %al
ret

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

LLVM IR (-O2):
define i32 @isPalindrome(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %11
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ 0, %1 ]
%5 = phi i32 [ %9, %3 ], [ %0, %1 ]
%6 = mul nsw i32 %4, 10
%7 = urem i32 %5, 10
%8 = add nsw i32 %6, %7
%9 = udiv i32 %5, 10
%10 = icmp ult i32 %5, 10
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %8, %3 ]
%13 = icmp eq i32 %12, %0
%14 = zext i1 %13 to i32
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ stdin;
int ungetc(int, int /*<<< orphan*/);
int ungetchar(int ch) { return ungetc(ch, stdin); }


x86 assembly (clang, -O0):
<ungetchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
call   1030 <ungetc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ungetchar>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
jmp    1030 <ungetc@plt>

LLVM IR (-O0):
@stdin = global i32 0
define i32 @ungetchar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @stdin
%5 = call i32 @ungetc(i32 %3, i32 %4)
ret i32 %5
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @ungetchar(i32 %0) {
%2 = load i32, i32* @stdin
%3 = tail call i32 @ungetc(i32 %0, i32 %2)
ret i32 %3
}
/* Variables and functions */
bool copy_bool(const bool _val) { return _val; }


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

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

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

LLVM IR (-O2):
define i32 @copy_bool(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
void main() { int64_t a, b; }


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

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

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32
ret void
}

LLVM IR (-O2):
define void @main() {
ret void
}
/* Type definitions */
typedef int uint32_t;
struct buffer {
  int dummy;
};

/* Variables and functions */
int buffer_read8(struct buffer *);
uint32_t buffer_read_be32(struct buffer *b) {
  return buffer_read8(b) << 24 | buffer_read8(b) << 16 | buffer_read8(b) << 8 |
         buffer_read8(b);
}


x86 assembly (clang, -O0):
<buffer_read_be32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <buffer_read8@plt>
shl    $0x18,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <buffer_read8@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
shl    $0x10,%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <buffer_read8@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
shl    $0x8,%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <buffer_read8@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
or     %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buffer_read_be32>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <buffer_read8@plt>
mov    %eax,%ebp
shl    $0x18,%ebp
mov    %r14,%rdi
call   1030 <buffer_read8@plt>
mov    %eax,%ebx
shl    $0x10,%ebx
or     %ebp,%ebx
mov    %r14,%rdi
call   1030 <buffer_read8@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
mov    %r14,%rdi
call   1030 <buffer_read8@plt>
or     %ebp,%eax
or     %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.buffer = type { i32 }
define i32 @buffer_read_be32(%struct.buffer* %0) {
%2 = alloca %struct.buffer*
store %struct.buffer* %0, %struct.buffer** %2
%3 = load %struct.buffer*, %struct.buffer** %2
%4 = call i32 @buffer_read8(%struct.buffer* %3)
%5 = shl i32 %4, 24
%6 = load %struct.buffer*, %struct.buffer** %2
%7 = call i32 @buffer_read8(%struct.buffer* %6)
%8 = shl i32 %7, 16
%9 = or i32 %5, %8
%10 = load %struct.buffer*, %struct.buffer** %2
%11 = call i32 @buffer_read8(%struct.buffer* %10)
%12 = shl i32 %11, 8
%13 = or i32 %9, %12
%14 = load %struct.buffer*, %struct.buffer** %2
%15 = call i32 @buffer_read8(%struct.buffer* %14)
%16 = or i32 %13, %15
ret i32 %16
}

LLVM IR (-O2):
%struct.buffer = type { i32 }
define i32 @buffer_read_be32(%struct.buffer* %0) {
%2 = tail call i32 @buffer_read8(%struct.buffer* %0)
%3 = shl i32 %2, 24
%4 = tail call i32 @buffer_read8(%struct.buffer* %0)
%5 = shl i32 %4, 16
%6 = or i32 %5, %3
%7 = tail call i32 @buffer_read8(%struct.buffer* %0)
%8 = shl i32 %7, 8
%9 = or i32 %6, %8
%10 = tail call i32 @buffer_read8(%struct.buffer* %0)
%11 = or i32 %9, %10
ret i32 %11
}
void integrator_ias15_part1(void) {}


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

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

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

LLVM IR (-O2):
define void @integrator_ias15_part1() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isgraph(int);
void t_isgraph_0xfd() {
  Assert_real((isgraph(253) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isgraph.c",
              1270, ("isgraph should be 0 for 0xfd"));
}


x86 assembly (clang, -O0):
<t_isgraph_0xfd>:
push   %rbp
mov    %rsp,%rbp
mov    $0xfd,%edi
call   1040 <isgraph@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x4f6,%edx
lea    0xf5b(%rip),%rcx
call   1030 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isgraph_0xfd>:
push   %rax
mov    $0xfd,%edi
call   1040 <isgraph@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x4f6,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0xfd\00"
define void @t_isgraph_0xfd() {
%1 = call i64 @isgraph(i32 253)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1270, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isgraph.c\00"
@.str.1 = [29 x i8] c"isgraph should be 0 for 0xfd\00"
define void @t_isgraph_0xfd() {
%1 = tail call i64 @isgraph(i32 253)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1270, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ngen(char *, char *, int);
void cginc2pi(int v) { ngen("%s\t$%d,(%%edx)", "addl", v); }


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

x86 assembly (clang, -O2):
<cginc2pi>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
lea    0xeef(%rip),%rsi
jmp    1030 <ngen@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"%s\09$%d,(%%edx)\00"
@.str.1 = [5 x i8] c"addl\00"
define void @cginc2pi(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @ngen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"%s\09$%d,(%%edx)\00"
@.str.1 = [5 x i8] c"addl\00"
define void @cginc2pi(i32 %0) {
%2 = tail call i32 @ngen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ UINT8_MAX;
int rat_mod_generic_set_val_max8(const char *argv, uint8_t *data,
                                 uint16_t len) {
  do {
  } while (0);
  if (!argv || !data || len < sizeof(uint8_t))
    return -1;
  *((uint8_t *)data) = UINT8_MAX;
  return 0;
}


x86 assembly (clang, -O0):
<rat_mod_generic_set_val_max8>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
jmp    1114 <rat_mod_generic_set_val_max8+0x14>
cmpq   $0x0,-0x10(%rbp)
je     1138 <rat_mod_generic_set_val_max8+0x38>
cmpq   $0x0,-0x18(%rbp)
je     1138 <rat_mod_generic_set_val_max8+0x38>
movslq -0x1c(%rbp),%rax
cmp    $0x4,%rax
jae    1144 <rat_mod_generic_set_val_max8+0x44>
movl   $0xffffffff,-0x4(%rbp)
jmp    115a <rat_mod_generic_set_val_max8+0x5a>
mov    0x2e95(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rat_mod_generic_set_val_max8>:
mov    $0xffffffff,%eax
test   %rdi,%rdi
je     1121 <rat_mod_generic_set_val_max8+0x21>
test   %rsi,%rsi
je     1121 <rat_mod_generic_set_val_max8+0x21>
cmp    $0x4,%edx
jb     1121 <rat_mod_generic_set_val_max8+0x21>
mov    0x2ec5(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsi)
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@UINT8_MAX = global i32 0
define i32 @rat_mod_generic_set_val_max8(i8* readnone %0, i32* writeonly %1, i32 %2) {
%4 = icmp eq i8* %0, null
%5 = icmp eq i32* %1, null
%6 = or i1 %4, %5
%7 = icmp ult i32 %2, 4
%8 = or i1 %6, %7
br i1 %8, label %11, label %9
9: ; preds = %3
%10 = load i32, i32* @UINT8_MAX
store i32 %10, i32* %1
br label %11
11: ; preds = %3, %9
%12 = phi i32 [ 0, %9 ], [ -1, %3 ]
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int determine_header_version(FILE *dmg) { return (2); }


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

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

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

LLVM IR (-O2):
define i32 @determine_header_version(i32* nocapture readnone %0) {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ CrcUpdateByte(unsigned int *, unsigned char);
void CrcUpdateUInt16(unsigned int *crc, unsigned short v) {
  CrcUpdateByte(crc, (unsigned char)v);
  CrcUpdateByte(crc, (unsigned char)(v >> 8));
}


x86 assembly (clang, -O0):
<CrcUpdateUInt16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xa(%rbp),%ax
movzbl %al,%esi
call   1030 <CrcUpdateByte@plt>
mov    -0x8(%rbp),%rdi
movzwl -0xa(%rbp),%eax
sar    $0x8,%eax
movzbl %al,%esi
call   1030 <CrcUpdateByte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CrcUpdateUInt16>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
movzbl %bl,%esi
call   1030 <CrcUpdateByte@plt>
shr    $0x8,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <CrcUpdateByte@plt>

LLVM IR (-O0):
define void @CrcUpdateUInt16(i32* %0, i16 zeroext %1) {
%3 = alloca i32*
%4 = alloca i16
store i32* %0, i32** %3
store i16 %1, i16* %4
%5 = load i32*, i32** %3
%6 = load i16, i16* %4
%7 = trunc i16 %6 to i8
%8 = call i32 @CrcUpdateByte(i32* %5, i8 zeroext %7)
%9 = load i32*, i32** %3
%10 = load i16, i16* %4
%11 = zext i16 %10 to i32
%12 = ashr i32 %11, 8
%13 = trunc i32 %12 to i8
%14 = call i32 @CrcUpdateByte(i32* %9, i8 zeroext %13)
ret void
}

LLVM IR (-O2):
define void @CrcUpdateUInt16(i32* %0, i16 zeroext %1) {
%3 = trunc i16 %1 to i8
%4 = tail call i32 @CrcUpdateByte(i32* %0, i8 zeroext %3)
%5 = lshr i16 %1, 8
%6 = trunc i16 %5 to i8
%7 = tail call i32 @CrcUpdateByte(i32* %0, i8 zeroext %6)
ret void
}
void av_bsf_list_finalize() {}


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

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

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

LLVM IR (-O2):
define void @av_bsf_list_finalize() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ArgText();
void Act_Comment(void) { ArgText(); }


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

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

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

LLVM IR (-O2):
define void @Act_Comment() {
%1 = tail call i32 (...) @ArgText()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ foo(void *);
void bar(void) {
  void *vp;
  foo(vp);
}


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

x86 assembly (clang, -O2):
<bar>:
jmp    1030 <foo@plt>

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

LLVM IR (-O2):
define void @bar() {
%1 = tail call i32 @foo(i8* undef)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ critical_leave();
void __critical_leave(void *data) { critical_leave(); }


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

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

LLVM IR (-O0):
define void @__critical_leave(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @critical_leave()
ret void
}

LLVM IR (-O2):
define void @__critical_leave(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @critical_leave()
ret void
}
/* Variables and functions */
float ANTweenTimingFunctionQuintInOut(float, int /*<<< orphan*/, int, float);
float ANTweenProgressTimingFunctionQuintInOut(float time, float duration) {
  return ANTweenTimingFunctionQuintInOut(time, 0, 1, duration);
}


x86 assembly (clang, -O0):
<ANTweenProgressTimingFunctionQuintInOut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <ANTweenTimingFunctionQuintInOut@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ANTweenProgressTimingFunctionQuintInOut>:
xor    %edi,%edi
mov    $0x1,%esi
jmp    1030 <ANTweenTimingFunctionQuintInOut@plt>

LLVM IR (-O0):
define float @ANTweenProgressTimingFunctionQuintInOut(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 = call float @ANTweenTimingFunctionQuintInOut(float %5, i32 0, i32 1, float %6)
ret float %7
}

LLVM IR (-O2):
define float @ANTweenProgressTimingFunctionQuintInOut(float %0, float %1) {
%3 = tail call float @ANTweenTimingFunctionQuintInOut(float %0, i32 0, i32 1, float %1)
ret float %3
}
/* Variables and functions */
double cos(double);
double cosd_(double x) { return cos(x); }


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

x86 assembly (clang, -O2):
<cosd_>:
jmp    1030 <cos@plt>

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

LLVM IR (-O2):
define double @cosd_(double %0) {
%2 = tail call double @cos(double %0)
ret double %2
}
/* Variables and functions */
scalar_t__ serial_txnotfull(unsigned int);
void serial_waittxnotfull(unsigned dev) {
  volatile unsigned u;
  for (u = 0U; u < 1000U; u++) {
    if (serial_txnotfull(dev))
      break;
  }
}


x86 assembly (clang, -O0):
<serial_waittxnotfull>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    $0x3e8,%eax
jae    115a <serial_waittxnotfull+0x4a>
mov    -0x4(%rbp),%edi
call   1030 <serial_txnotfull@plt>
cmp    $0x0,%rax
je     1147 <serial_waittxnotfull+0x37>
jmp    115a <serial_waittxnotfull+0x4a>
jmp    114c <serial_waittxnotfull+0x3c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <serial_waittxnotfull+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serial_waittxnotfull>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0xc(%rsp)
mov    0xc(%rsp),%eax
cmp    $0x3e7,%eax
ja     114c <serial_waittxnotfull+0x3c>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <serial_txnotfull@plt>
test   %rax,%rax
jne    114c <serial_waittxnotfull+0x3c>
addl   $0x1,0xc(%rsp)
mov    0xc(%rsp),%eax
cmp    $0x3e8,%eax
jb     1130 <serial_waittxnotfull+0x20>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @serial_waittxnotfull(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store volatile i32 0, i32* %3
br label %4
4: ; preds = %13, %1
%5 = load volatile i32, i32* %3
%6 = icmp ult i32 %5, 1000
br i1 %6, label %7, label %16
7: ; preds = %4
%8 = load i32, i32* %2
%9 = call i64 @serial_txnotfull(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %7
br label %16
12: ; preds = %7
br label %13
13: ; preds = %12
%14 = load volatile i32, i32* %3
%15 = add i32 %14, 1
store volatile i32 %15, i32* %3
br label %4
16: ; preds = %11, %4
ret void
}

LLVM IR (-O2):
define void @serial_waittxnotfull(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
store volatile i32 0, i32* %2
%4 = load volatile i32, i32* %2
%5 = icmp ult i32 %4, 1000
br i1 %5, label %6, label %14
6: ; preds = %1, %9
%7 = tail call i64 @serial_txnotfull(i32 %0)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = load volatile i32, i32* %2
%11 = add i32 %10, 1
store volatile i32 %11, i32* %2
%12 = load volatile i32, i32* %2
%13 = icmp ult i32 %12, 1000
br i1 %13, label %6, label %14
14: ; preds = %9, %6, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ swap_array(int, int, unsigned int *, unsigned int *);
void swap_ints(int nmemb, unsigned int *x, unsigned int *y) {
  swap_array(nmemb, sizeof(int), x, y);
}


x86 assembly (clang, -O0):
<swap_ints>:
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),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x4,%esi
call   1030 <swap_array@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_ints>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    $0x4,%esi
jmp    1030 <swap_array@plt>

LLVM IR (-O0):
define void @swap_ints(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = load i32*, i32** %5
%9 = load i32*, i32** %6
%10 = call i32 @swap_array(i32 %7, i32 4, i32* %8, i32* %9)
ret void
}

LLVM IR (-O2):
define void @swap_ints(i32 %0, i32* %1, i32* %2) {
%4 = tail call i32 @swap_array(i32 %0, i32 4, i32* %1, i32* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int n, triangularNumber;
  triangularNumber = 0;
  for (n = 1; n <= 200; n = n + 1)
    triangularNumber = triangularNumber + n;
  printf("The 200th triangular number is %i\n", triangularNumber);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0xc8,-0x8(%rbp)
jg     1151 <main+0x41>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    -0xc(%rbp),%esi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [35 x i8] c"The 200th triangular number is %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 1, i32* %2
br label %4
4: ; preds = %11, %0
%5 = load i32, i32* %2
%6 = icmp sle i32 %5, 200
br i1 %6, label %7, label %14
7: ; preds = %4
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = add nsw i32 %8, %9
store i32 %10, i32* %3
br label %11
11: ; preds = %7
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
br label %4
14: ; preds = %4
%15 = load i32, i32* %3
%16 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"The 200th triangular number is %i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i32 20100)
ret i32 0
}
/* Variables and functions */
double Temtrans(float);
int /*<<< orphan*/ printf(char *, float, double);
main() {
  float f;
  int max = 300, min = 0, step = 20;
  while (f <= max) {
    printf("%3.1f\t%3.1f\n", f, Temtrans(f));
    f = f + step;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x12c,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x14,-0x14(%rbp)
movss  -0x8(%rbp),%xmm1
cvtsi2ssl -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     1197 <main+0x77>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <Temtrans@plt>
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    1144 <main+0x24>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [13 x i8] c"%3.1f\09%3.1f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 300, i32* %3
store i32 0, i32* %4
store i32 20, i32* %5
br label %6
6: ; preds = %11, %0
%7 = load float, float* %2
%8 = load i32, i32* %3
%9 = sitofp i32 %8 to float
%10 = fcmp ole float %7, %9
br i1 %10, label %11, label %20
11: ; preds = %6
%12 = load float, float* %2
%13 = load float, float* %2
%14 = call double @Temtrans(float %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), float %12, double %14)
%16 = load float, float* %2
%17 = load i32, i32* %5
%18 = sitofp i32 %17 to float
%19 = fadd float %16, %18
store float %19, float* %2
br label %6
20: ; preds = %6
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int isspace(int ch) {
  return (ch == '\t' || ch == '\n' || ch == '\v' || ch == '\f' || ch == '\r' ||
          ch == ' ');
}


x86 assembly (clang, -O0):
<isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x9,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115c <isspace+0x5c>
mov    $0x1,%al
cmpl   $0xa,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115c <isspace+0x5c>
mov    $0x1,%al
cmpl   $0xb,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115c <isspace+0x5c>
mov    $0x1,%al
cmpl   $0xc,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115c <isspace+0x5c>
mov    $0x1,%al
cmpl   $0xd,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115c <isspace+0x5c>
cmpl   $0x20,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isspace>:
lea    -0x9(%rdi),%eax
cmp    $0x5,%eax
setb   %al
cmp    $0x20,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isspace(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 9
br i1 %4, label %20, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 10
br i1 %7, label %20, label %8
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 11
br i1 %10, label %20, label %11
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 12
br i1 %13, label %20, label %14
14: ; preds = %11
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 13
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 32
br label %20
20: ; preds = %17, %14, %11, %8, %5, %1
%21 = phi i1 [ true, %14 ], [ true, %11 ], [ true, %8 ], [ true, %5 ], [ true, %1 ], [ %19, %17 ]
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @isspace(i32 %0) {
%2 = add i32 %0, -9
%3 = icmp ult i32 %2, 5
%4 = icmp eq i32 %0, 32
%5 = or i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ mfunc();
int main() {
  mfunc();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @mfunc()
ret i32 0
}
void gpio_uart_inactive(int port, int no_irda) {}


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

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

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

LLVM IR (-O2):
define void @gpio_uart_inactive(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
double exp(double);
double pow(double, int);
double py_gauss2d(double x, double y) {
  double r_squared = pow(x - 0.2, 2) + pow(y - 0.5, 2);
  return exp(-r_squared / pow(0.1, 2));
}


x86 assembly (clang, -O0):
<py_gauss2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed1(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xea9(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe59(%rip),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<py_gauss2d>:
sub    $0x18,%rsp
movsd  %xmm1,(%rsp)
addsd  0xecf(%rip),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
addsd  0xeba(%rip),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
addsd  0x10(%rsp),%xmm0
xorpd  0xeba(%rip),%xmm0
movapd %xmm0,(%rsp)
movsd  0xe9d(%rip),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movapd (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
jmp    1030 <exp@plt>

LLVM IR (-O0):
define double @py_gauss2d(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = fsub double %6, 2.000000e-01
%8 = call double @pow(double %7, i32 2)
%9 = load double, double* %4
%10 = fsub double %9, 5.000000e-01
%11 = call double @pow(double %10, i32 2)
%12 = fadd double %8, %11
store double %12, double* %5
%13 = load double, double* %5
%14 = fneg double %13
%15 = call double @pow(double 1.000000e-01, i32 2)
%16 = fdiv double %14, %15
%17 = call double @exp(double %16)
ret double %17
}

LLVM IR (-O2):
define double @py_gauss2d(double %0, double %1) {
%3 = fadd double %0, -2.000000e-01
%4 = tail call double @pow(double %3, i32 2)
%5 = fadd double %1, -5.000000e-01
%6 = tail call double @pow(double %5, i32 2)
%7 = fadd double %4, %6
%8 = fneg double %7
%9 = tail call double @pow(double 1.000000e-01, i32 2)
%10 = fdiv double %8, %9
%11 = tail call double @exp(double %10)
ret double %11
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ perror(char *);
void *wr_calloc(size_t nmemb, size_t size) {
  void *alloc = calloc(nmemb, size);
  if (!alloc) {
    perror("in calloc()");
    return NULL;
  }
  return alloc;
}


x86 assembly (clang, -O0):
<wr_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1165 <wr_calloc+0x45>
lea    0xead(%rip),%rdi
call   1040 <perror@plt>
movq   $0x0,-0x8(%rbp)
jmp    116d <wr_calloc+0x4d>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wr_calloc>:
push   %rbx
call   1030 <calloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1133 <wr_calloc+0x13>
mov    %rbx,%rax
pop    %rbx
ret
lea    0xec6(%rip),%rdi
call   1040 <perror@plt>
jmp    112e <wr_calloc+0xe>

LLVM IR (-O0):
@.str = [12 x i8] c"in calloc()\00"
define i8* @wr_calloc(i64 %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8*
store i64 %0, i64* %4
store i64 %1, i64* %5
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = call i8* @calloc(i64 %7, i64 %8)
store i8* %9, i8** %6
%10 = load i8*, i8** %6
%11 = icmp ne i8* %10, null
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8* null, i8** %3
br label %16
14: ; preds = %2
%15 = load i8*, i8** %6
store i8* %15, i8** %3
br label %16
16: ; preds = %14, %12
%17 = load i8*, i8** %3
ret i8* %17
}

LLVM IR (-O2):
@.str = [12 x i8] c"in calloc()\00"
define noalias i8* @wr_calloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %2, %5
ret i8* %3
}
/* Type definitions */
typedef int fe_code_rate_t;

/* Variables and functions */
#define FEC_1_2 134
#define FEC_2_3 133
#define FEC_3_4 132
#define FEC_5_6 131
#define FEC_7_8 130
#define FEC_AUTO 129
#define FEC_NONE 128
int check_fec(fe_code_rate_t *fec) {
  switch (*fec) {
  case FEC_NONE:
    *fec = FEC_AUTO;
  case FEC_AUTO:
  case FEC_1_2:
  case FEC_2_3:
  case FEC_3_4:
  case FEC_5_6:
  case FEC_7_8:
    return 0;
  default:;
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_fec>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
sub    $0x80,%eax
je     1137 <check_fec+0x37>
jmp    1121 <check_fec+0x21>
mov    -0x14(%rbp),%eax
add    $0xffffff7f,%eax
sub    $0x6,%eax
jb     1141 <check_fec+0x41>
jmp    114d <check_fec+0x4d>
mov    -0x10(%rbp),%rax
movl   $0x81,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    1159 <check_fec+0x59>
jmp    1152 <check_fec+0x52>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_fec>:
mov    (%rdi),%ecx
xor    %eax,%eax
lea    -0x81(%rcx),%edx
cmp    $0x6,%edx
jae    1110 <check_fec+0x10>
ret
cmp    $0x80,%ecx
jne    111f <check_fec+0x1f>
movl   $0x81,(%rdi)
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @check_fec(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = load i32, i32* %4
switch i32 %5, label %9 [
i32 128, label %6
i32 129, label %8
i32 134, label %8
i32 133, label %8
i32 132, label %8
i32 131, label %8
i32 130, label %8
]
6: ; preds = %1
%7 = load i32*, i32** %3
store i32 129, i32* %7
br label %8
8: ; preds = %1, %1, %1, %1, %1, %1, %6
store i32 0, i32* %2
br label %11
9: ; preds = %1
br label %10
10: ; preds = %9
store i32 1, i32* %2
br label %11
11: ; preds = %10, %8
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @check_fec(i32* nocapture %0) {
%2 = load i32, i32* %0
switch i32 %2, label %4 [
i32 128, label %3
i32 129, label %5
i32 134, label %5
i32 133, label %5
i32 132, label %5
i32 131, label %5
i32 130, label %5
]
3: ; preds = %1
store i32 129, i32* %0
br label %5
4: ; preds = %1
br label %5
5: ; preds = %3, %1, %1, %1, %1, %1, %1, %4
%6 = phi i32 [ 1, %4 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %3 ]
ret i32 %6
}
void omap443x_temp_sensor_idle(int idle_state) {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @emergency_console_msg() {
ret void
}