xunge/DecIR huggingface dataset:
int _is_prime(unsigned a) {
  if (a != 2 && a % 2 == 0)
    return 0;
  for (unsigned d = 3; d * d <= a; d += 2)
    if (a % d == 0)
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<_is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     112c <_is_prime+0x2c>
mov    -0x8(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    112c <_is_prime+0x2c>
movl   $0x0,-0x4(%rbp)
jmp    117a <_is_prime+0x7a>
movl   $0x3,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     1173 <_is_prime+0x73>
mov    -0x8(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
cmp    $0x0,%edx
jne    1160 <_is_prime+0x60>
movl   $0x0,-0x4(%rbp)
jmp    117a <_is_prime+0x7a>
jmp    1165 <_is_prime+0x65>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <_is_prime+0x33>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_is_prime>:
cmp    $0x2,%edi
je     110f <_is_prime+0xf>
xor    %eax,%eax
mov    %edi,%ecx
and    $0x1,%ecx
jne    110f <_is_prime+0xf>
ret
mov    $0x1,%eax
cmp    $0x9,%edi
jb     110e <_is_prime+0xe>
mov    $0x3,%ecx
xchg   %ax,%ax
mov    %edi,%eax
xor    %edx,%edx
div    %ecx
test   %edx,%edx
je     1136 <_is_prime+0x36>
add    $0x2,%ecx
mov    %ecx,%eax
imul   %ecx,%eax
cmp    %edi,%eax
jbe    1120 <_is_prime+0x20>
xor    %eax,%eax
test   %edx,%edx
setne  %al
ret

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

LLVM IR (-O2):
define i32 @_is_prime(i32 %0) {
%2 = icmp ne i32 %0, 2
%3 = and i32 %0, 1
%4 = icmp eq i32 %3, 0
%5 = and i1 %2, %4
br i1 %5, label %19, label %6
6: ; preds = %1
%7 = icmp ult i32 %0, 9
br i1 %7, label %19, label %8
8: ; preds = %6, %8
%9 = phi i32 [ %12, %8 ], [ 3, %6 ]
%10 = urem i32 %0, %9
%11 = icmp eq i32 %10, 0
%12 = add i32 %9, 2
%13 = mul i32 %12, %12
%14 = icmp ugt i32 %13, %0
%15 = select i1 %11, i1 true, i1 %14
br i1 %15, label %16, label %8
16: ; preds = %8
%17 = xor i1 %11, true
%18 = zext i1 %17 to i32
br label %19
19: ; preds = %6, %16, %1
%20 = phi i32 [ 0, %1 ], [ 1, %6 ], [ %18, %16 ]
ret i32 %20
}
/* Variables and functions */
int /*<<< orphan*/ do_cpuid(int);
int main(int argc, char **argv) {
  if (argc == 1)
    do_cpuid(0xaaaaaaaa);
  else if (argc == 2)
    do_cpuid(0xfa11dead);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    113f <main+0x2f>
mov    $0xaaaaaaaa,%edi
call   1030 <do_cpuid@plt>
jmp    1158 <main+0x48>
cmpl   $0x2,-0x8(%rbp)
jne    1153 <main+0x43>
mov    $0xfa11dead,%edi
call   1030 <do_cpuid@plt>
jmp    1158 <main+0x48>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x1,%edi
je     1121 <main+0x11>
cmp    $0x2,%edi
jne    1130 <main+0x20>
mov    $0xfa11dead,%edi
jmp    1126 <main+0x16>
mov    $0xaaaaaaaa,%edi
push   %rax
call   1030 <do_cpuid@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 @do_cpuid(i32 -1431655766)
br label %16
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 @do_cpuid(i32 -99492179)
br label %15
15: ; preds = %13, %10
br label %16
16: ; preds = %15, %8
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
switch i32 %0, label %7 [
i32 1, label %4
i32 2, label %3
]
3: ; preds = %2
br label %4
4: ; preds = %2, %3
%5 = phi i32 [ -99492179, %3 ], [ -1431655766, %2 ]
%6 = tail call i32 @do_cpuid(i32 %5)
br label %7
7: ; preds = %4, %2
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cudaThreadExit();
void dxShutdownDevice() { cudaThreadExit(); }


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

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

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

LLVM IR (-O2):
define void @dxShutdownDevice() {
%1 = tail call i32 (...) @cudaThreadExit()
ret void
}
unsigned short XP5RGBA_0(unsigned short BGR) {
  if (!BGR)
    return 0;
  return ((((BGR << 11)) | ((BGR >> 9) & 0x3e) | ((BGR << 1) & 0x7c0))) | 1;
}


x86 assembly (clang, -O0):
<XP5RGBA_0>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x4(%rbp)
cmpw   $0x0,-0x4(%rbp)
jne    1121 <XP5RGBA_0+0x21>
movw   $0x0,-0x2(%rbp)
jmp    114a <XP5RGBA_0+0x4a>
movzwl -0x4(%rbp),%eax
shl    $0xb,%eax
movzwl -0x4(%rbp),%ecx
sar    $0x9,%ecx
and    $0x3e,%ecx
or     %ecx,%eax
movzwl -0x4(%rbp),%ecx
shl    $0x1,%ecx
and    $0x7c0,%ecx
or     %ecx,%eax
or     $0x1,%eax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<XP5RGBA_0>:
test   %edi,%edi
je     1120 <XP5RGBA_0+0x20>
mov    %edi,%eax
shl    $0xb,%eax
mov    %edi,%ecx
shr    $0x9,%ecx
and    $0x3e,%ecx
or     %eax,%ecx
and    $0x3e0,%edi
lea    (%rcx,%rdi,2),%eax
add    $0x1,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define zeroext i16 @XP5RGBA_0(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %3
%4 = load i16, i16* %3
%5 = icmp ne i16 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %1
store i16 0, i16* %2
br label %23
7: ; preds = %1
%8 = load i16, i16* %3
%9 = zext i16 %8 to i32
%10 = shl i32 %9, 11
%11 = load i16, i16* %3
%12 = zext i16 %11 to i32
%13 = ashr i32 %12, 9
%14 = and i32 %13, 62
%15 = or i32 %10, %14
%16 = load i16, i16* %3
%17 = zext i16 %16 to i32
%18 = shl i32 %17, 1
%19 = and i32 %18, 1984
%20 = or i32 %15, %19
%21 = or i32 %20, 1
%22 = trunc i32 %21 to i16
store i16 %22, i16* %2
br label %23
23: ; preds = %7, %6
%24 = load i16, i16* %2
ret i16 %24
}

LLVM IR (-O2):
define zeroext i16 @XP5RGBA_0(i16 zeroext %0) {
%2 = icmp eq i16 %0, 0
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = shl i16 %0, 11
%5 = lshr i16 %0, 9
%6 = and i16 %5, 62
%7 = or i16 %6, %4
%8 = shl i16 %0, 1
%9 = and i16 %8, 1984
%10 = or i16 %7, %9
%11 = or i16 %10, 1
br label %12
12: ; preds = %1, %3
%13 = phi i16 [ %11, %3 ], [ 0, %1 ]
ret i16 %13
}
/* Variables and functions */
int /*<<< orphan*/ SendInterrupt(int, int, int, int);
void ScuSendTimer1(void) { SendInterrupt(0x44, 0xB, 0x0010, 0x00000010); }


x86 assembly (clang, -O0):
<ScuSendTimer1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x44,%edi
mov    $0xb,%esi
mov    $0x10,%ecx
mov    %ecx,%edx
call   1030 <SendInterrupt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ScuSendTimer1>:
mov    $0x44,%edi
mov    $0xb,%esi
mov    $0x10,%edx
mov    $0x10,%ecx
jmp    1030 <SendInterrupt@plt>

LLVM IR (-O0):
define void @ScuSendTimer1() {
%1 = call i32 @SendInterrupt(i32 68, i32 11, i32 16, i32 16)
ret void
}

LLVM IR (-O2):
define void @ScuSendTimer1() {
%1 = tail call i32 @SendInterrupt(i32 68, i32 11, i32 16, i32 16)
ret void
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int UP3D_GetParameter(int);
int32_t UP3D_GetHeaterTargetTemp(int heater) {
  if ((heater < 1) || (heater > 4))
    return -1;
  return UP3D_GetParameter(0x2D + heater - 1);
}


x86 assembly (clang, -O0):
<UP3D_GetHeaterTargetTemp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     112f <UP3D_GetHeaterTargetTemp+0x1f>
cmpl   $0x4,-0x8(%rbp)
jle    113b <UP3D_GetHeaterTargetTemp+0x2b>
movl   $0xffffffff,-0x4(%rbp)
jmp    114c <UP3D_GetHeaterTargetTemp+0x3c>
mov    -0x8(%rbp),%edi
add    $0x2d,%edi
sub    $0x1,%edi
call   1030 <UP3D_GetParameter@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UP3D_GetHeaterTargetTemp>:
lea    -0x5(%rdi),%eax
cmp    $0xfffffffc,%eax
jae    111e <UP3D_GetHeaterTargetTemp+0xe>
mov    $0xffffffff,%eax
ret
add    $0x2c,%edi
jmp    1030 <UP3D_GetParameter@plt>

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

LLVM IR (-O2):
define i32 @UP3D_GetHeaterTargetTemp(i32 %0) {
%2 = add i32 %0, -5
%3 = icmp ult i32 %2, -4
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = add nuw nsw i32 %0, 44
%6 = tail call i32 @UP3D_GetParameter(i32 %5)
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ %6, %4 ], [ -1, %1 ]
ret i32 %8
}
int id3_is_only_space(char *str, int strlen) {
  int i = 0;
  while (i < strlen) {
    if (str[i] != 0x20)
      return 0;
    i++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<id3_is_only_space>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    114d <id3_is_only_space+0x4d>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     113f <id3_is_only_space+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    1154 <id3_is_only_space+0x54>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <id3_is_only_space+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<id3_is_only_space>:
mov    $0x1,%eax
test   %esi,%esi
jle    111f <id3_is_only_space+0x1f>
mov    %esi,%ecx
xor    %edx,%edx
nopl   (%rax)
cmpb   $0x20,(%rdi,%rdx,1)
jne    1120 <id3_is_only_space+0x20>
add    $0x1,%rdx
cmp    %rdx,%rcx
jne    1110 <id3_is_only_space+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @id3_is_only_space(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8
%7 = icmp eq i64 %13, %5
br i1 %7, label %14, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 0, %4 ], [ %13, %6 ]
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 32
%13 = add nuw nsw i64 %9, 1
br i1 %12, label %6, label %14
14: ; preds = %8, %6, %2
%15 = phi i32 [ 1, %2 ], [ 1, %6 ], [ 0, %8 ]
ret i32 %15
}
int count_digits(long n) {
  int count = 1;
  while (n /= 10) {
    count++;
  }
  return count;
}


x86 assembly (clang, -O0):
<count_digits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     1139 <count_digits+0x39>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <count_digits+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_digits>:
lea    0x9(%rdi),%rdx
mov    $0x1,%ecx
cmp    $0x13,%rdx
jb     1152 <count_digits+0x52>
mov    %rdi,%rax
mov    $0x1,%ecx
movabs $0x6666666666666667,%rsi
66 66 66
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
imul   %rsi
mov    %rdx,%rdi
shr    $0x3f,%rdi
sar    $0x2,%rdx
lea    (%rdx,%rdi,1),%rax
add    $0x1,%ecx
add    %rdi,%rdx
add    $0x9,%rdx
cmp    $0x12,%rdx
ja     1130 <count_digits+0x30>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @count_digits(i64 %0) {
%2 = add i64 %0, 9
%3 = icmp ult i64 %2, 19
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 1, %1 ]
%6 = phi i64 [ %7, %4 ], [ %0, %1 ]
%7 = sdiv i64 %6, 10
%8 = add nuw nsw i32 %5, 1
%9 = add nsw i64 %7, 9
%10 = icmp ult i64 %9, 19
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 1, %1 ], [ %8, %4 ]
ret i32 %12
}
char *str_rev(char *str, int len) {
  char *p1 = str;
  char *p2 = str + len - 1;
  while (p1 < p2) {
    char tmp = *p1;
    *p1++ = *p2;
    *p2-- = tmp;
  }
  return str;
}


x86 assembly (clang, -O0):
<str_rev>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    116d <str_rev+0x6d>
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x21(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x21(%rbp),%cl
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x20(%rbp)
mov    %cl,(%rax)
jmp    1126 <str_rev+0x26>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_rev>:
mov    %rdi,%rax
movslq %esi,%rcx
add    %rdi,%rcx
add    $0xffffffffffffffff,%rcx
cmp    %rdi,%rcx
jbe    113d <str_rev+0x3d>
lea    0x1(%rax),%rdi
cs nopw 0x0(%rax,%rax,1)
movzbl -0x1(%rdi),%esi
movzbl (%rcx),%edx
mov    %dl,-0x1(%rdi)
mov    %sil,(%rcx)
add    $0xffffffffffffffff,%rcx
lea    0x1(%rdi),%rdx
cmp    %rcx,%rdi
mov    %rdx,%rdi
jb     1120 <str_rev+0x20>
ret

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

LLVM IR (-O2):
define i8* @str_rev(i8* returned %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = getelementptr inbounds i8, i8* %4, i64 -1
%6 = icmp ugt i8* %5, %0
br i1 %6, label %7, label %15
7: ; preds = %2, %7
%8 = phi i8* [ %13, %7 ], [ %5, %2 ]
%9 = phi i8* [ %12, %7 ], [ %0, %2 ]
%10 = load i8, i8* %9
%11 = load i8, i8* %8
%12 = getelementptr inbounds i8, i8* %9, i64 1
store i8 %11, i8* %9
store i8 %10, i8* %8
%13 = getelementptr inbounds i8, i8* %8, i64 -1
%14 = icmp ult i8* %12, %13
br i1 %14, label %7, label %15
15: ; preds = %7, %2
ret i8* %0
}
void initsb(char dadigistat, char damusistat, long dasamplerate,
            char danumspeakers, char dabytespersample, char daintspersec,
            char daquality) {}


x86 assembly (clang, -O0):
<initsb>:
push   %rbp
mov    %rsp,%rbp
mov    %r8d,-0x28(%rbp)
mov    %ecx,%eax
mov    -0x28(%rbp),%ecx
mov    %eax,-0x24(%rbp)
mov    %rdx,%rax
mov    -0x24(%rbp),%edx
mov    %rax,-0x20(%rbp)
mov    %esi,%eax
mov    -0x20(%rbp),%rsi
mov    %eax,-0x18(%rbp)
mov    %edi,%r8d
mov    -0x18(%rbp),%edi
mov    %r9b,%al
mov    0x10(%rbp),%r9b
mov    %r8b,-0x1(%rbp)
mov    %dil,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %dl,-0x11(%rbp)
mov    %cl,-0x12(%rbp)
mov    %al,-0x13(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @initsb(i8 signext %0, i8 signext %1, i64 %2, i8 signext %3, i8 signext %4, i8 signext %5, i8 signext %6) {
%8 = alloca i8
%9 = alloca i8
%10 = alloca i64
%11 = alloca i8
%12 = alloca i8
%13 = alloca i8
%14 = alloca i8
store i8 %0, i8* %8
store i8 %1, i8* %9
store i64 %2, i64* %10
store i8 %3, i8* %11
store i8 %4, i8* %12
store i8 %5, i8* %13
store i8 %6, i8* %14
ret void
}

LLVM IR (-O2):
define void @initsb(i8 signext %0, i8 signext %1, i64 %2, i8 signext %3, i8 signext %4, i8 signext %5, i8 signext %6) {
ret void
}
int perform_benchmark(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @perform_benchmark() {
ret i32 0
}
/* Variables and functions */
void *ObjectNew();
int main() {
  void *obj = ObjectNew();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i8* (...) @ObjectNew()
ret i32 0
}
int compare_floats(const void *a, const void *b) {
  float *pa = (float *)a;
  float *pb = (float *)b;
  if ((*pa - *pb) > 0) {
    return 1;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<compare_floats>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x28(%rbp),%rax
subss  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    1144 <compare_floats+0x44>
movl   $0x1,-0x4(%rbp)
jmp    114b <compare_floats+0x4b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_floats>:
movss  (%rdi),%xmm0
subss  (%rsi),%xmm0
xorps  %xmm1,%xmm1
xor    %eax,%eax
ucomiss %xmm1,%xmm0
seta   %al
add    %eax,%eax
add    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @compare_floats(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca float*
%7 = alloca float*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to float*
store float* %9, float** %6
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to float*
store float* %11, float** %7
%12 = load float*, float** %6
%13 = load float, float* %12
%14 = load float*, float** %7
%15 = load float, float* %14
%16 = fsub float %13, %15
%17 = fcmp ogt float %16, 0.000000e+00
br i1 %17, label %18, label %19
18: ; preds = %2
store i32 1, i32* %3
br label %20
19: ; preds = %2
store i32 -1, i32* %3
br label %20
20: ; preds = %19, %18
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @compare_floats(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to float*
%4 = bitcast i8* %1 to float*
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fsub float %5, %6
%8 = fcmp ogt float %7, 0.000000e+00
%9 = select i1 %8, i32 1, i32 -1
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned long);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void MMout_of_memory(long size) {
  (void)fflush(stdout);
  (void)fprintf(stderr, "\nout of memory allocating %lu bytes\n",
                (unsigned long)size);
  exit(1);
}


x86 assembly (clang, -O0):
<MMout_of_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xea2(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<MMout_of_memory>:
push   %rbx
mov    %rdi,%rbx
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@stderr = global i32 0
@.str = [37 x i8] c"\0Aout of memory allocating %lu bytes\0A\00"
define void @MMout_of_memory(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i32, i32* @stdout
%4 = call i32 @fflush(i32 %3)
%5 = load i32, i32* @stderr
%6 = load i64, i64* %2
%7 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %6)
%8 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@stderr = global i32 0
@.str = [37 x i8] c"\0Aout of memory allocating %lu bytes\0A\00"
define void @MMout_of_memory(i64 %0) {
%2 = load i32, i32* @stdout
%3 = tail call i32 @fflush(i32 %2)
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i64 %0)
%6 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
struct timeval {
  long long tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long long current_timestamp(void) {
  struct timeval te;
  gettimeofday(&te, NULL);
  long long milliseconds = te.tv_sec * 1000LL + te.tv_usec / 1000;
  return milliseconds;
}


x86 assembly (clang, -O0):
<current_timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,-0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<current_timestamp>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0x3e8,0x8(%rsp),%rcx
movslq 0x10(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
cltq
add    %rcx,%rax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
%struct.timeval = type { i64, i32 }
define i64 @current_timestamp() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i64, i64* %4
%6 = mul nsw i64 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = sext i32 %9 to i64
%11 = add nsw i64 %6, %10
ret i64 %11
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
void ADCComparatorIntDisable(uint32_t ui32Base, uint32_t ui32SequenceNum) {
  ASSERT((ui32Base == 0x40038000) || (ui32Base == 0x40039000));
  ASSERT(ui32SequenceNum < 4);
  (*((volatile uint32_t *)(ui32Base + 0x00000008))) &=
      ~(0x10000 << ui32SequenceNum);
}


x86 assembly (clang, -O0):
<ADCComparatorIntDisable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x40038000,-0x4(%rbp)
mov    %al,-0x9(%rbp)
je     113d <ADCComparatorIntDisable+0x2d>
cmpl   $0x40039000,-0x4(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
cmpl   $0x4,-0x8(%rbp)
setl   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <ASSERT@plt>
mov    -0x8(%rbp),%ecx
mov    $0x10000,%edx
shl    %cl,%edx
xor    $0xffffffff,%edx
mov    -0x4(%rbp),%eax
add    $0x8,%eax
cltq
mov    (%rax),%ecx
and    %edx,%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ADCComparatorIntDisable>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    %edi,%eax
and    $0xffffefff,%eax
xor    %edi,%edi
cmp    $0x40038000,%eax
sete   %dil
call   1030 <ASSERT@plt>
xor    %edi,%edi
cmp    $0x4,%ebx
setl   %dil
call   1030 <ASSERT@plt>
mov    $0x10000,%eax
mov    %ebx,%ecx
shl    %cl,%eax
not    %eax
movslq %ebp,%rcx
and    %eax,0x8(%rcx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @ADCComparatorIntDisable(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 = icmp eq i32 %5, 1073971200
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 1073975296
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ true, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @ASSERT(i32 %12)
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 4
%16 = zext i1 %15 to i32
%17 = call i32 @ASSERT(i32 %16)
%18 = load i32, i32* %4
%19 = shl i32 65536, %18
%20 = xor i32 %19, -1
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 8
%23 = sext i32 %22 to i64
%24 = inttoptr i64 %23 to i32*
%25 = load volatile i32, i32* %24
%26 = and i32 %25, %20
store volatile i32 %26, i32* %24
ret void
}

LLVM IR (-O2):
define void @ADCComparatorIntDisable(i32 %0, i32 %1) {
%3 = and i32 %0, -4097
%4 = icmp eq i32 %3, 1073971200
%5 = zext i1 %4 to i32
%6 = tail call i32 @ASSERT(i32 %5)
%7 = icmp slt i32 %1, 4
%8 = zext i1 %7 to i32
%9 = tail call i32 @ASSERT(i32 %8)
%10 = shl i32 65536, %1
%11 = xor i32 %10, -1
%12 = add nsw i32 %0, 8
%13 = sext i32 %12 to i64
%14 = inttoptr i64 %13 to i32*
%15 = load volatile i32, i32* %14
%16 = and i32 %15, %11
store volatile i32 %16, i32* %14
ret void
}
void freetrix(float **m_a, int size) {
  for (int i = 0; i < size; i++) {
    free(m_a[i]);
  }
  m_a = 0;
  free(m_a);
}


x86 assembly (clang, -O0):
<freetrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <freetrix+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <freetrix+0x16>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freetrix>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1142 <freetrix+0x32>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <freetrix+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @freetrix(float** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds float*, float** %0, i64 %8
%10 = bitcast float** %9 to i8**
%11 = load i8*, i8** %10
tail call void @free(i8* %11)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
/* Variables and functions */
int /*<<< orphan*/ back_to_prom();
void dec_machine_restart(char *command) { back_to_prom(); }


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

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

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

LLVM IR (-O2):
define void @dec_machine_restart(i8* nocapture readnone %0) {
%2 = tail call i32 (...) @back_to_prom()
ret void
}
/* Variables and functions */
char *U_WMRCORENONE_set(char *);
char *U_WMR47_set(void) { return U_WMRCORENONE_set("U_WMR47"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"U_WMR47\00"
define i8* @U_WMR47_set() {
%1 = call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [8 x i8] c"U_WMR47\00"
define i8* @U_WMR47_set() {
%1 = tail call i8* @U_WMRCORENONE_set(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
/* Variables and functions */
int /*<<< orphan*/ cgincglob(char *, char *, int);
void cgdecgb(char *s) { cgincglob("sub", s, 1); }


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

x86 assembly (clang, -O2):
<cgdecgb>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
mov    $0x1,%edx
jmp    1030 <cgincglob@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"sub\00"
define void @cgdecgb(i8* %0) {
%2 = tail call i32 @cgincglob(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0, i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int, char *);
void report(char *file, int ccount, int wcount, int lcount) {
  printf(" %d %d %d %s\n", lcount, wcount, ccount, file);
}


x86 assembly (clang, -O0):
<report>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%r8
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report>:
mov    %esi,%eax
mov    %rdi,%r8
lea    0xee4(%rip),%rdi
mov    %ecx,%esi
mov    %eax,%ecx
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [14 x i8] c" %d %d %d %s\0A\00"
define void @report(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %2, i32 %1, i8* %0)
ret void
}
unsigned long ret32word(workspace)
unsigned char *workspace;
{
  unsigned long foo;
  unsigned char *bleh;
  foo = 0L;
  bleh = (unsigned char *)&foo;
  bleh[3] = workspace[0];
  bleh[2] = workspace[1];
  bleh[1] = workspace[2];
  bleh[0] = workspace[3];
  return (foo);
}


x86 assembly (clang, -O0):
<ret32word>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x8(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x8(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ret32word>:
mov    (%rdi),%eax
shl    $0x20,%rax
bswap  %rax
ret

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

LLVM IR (-O2):
define i64 @ret32word(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %3
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %0, i64 3
%8 = load i8, i8* %7
%9 = zext i8 %2 to i64
%10 = shl nuw nsw i64 %9, 24
%11 = zext i8 %4 to i64
%12 = shl nuw nsw i64 %11, 16
%13 = or i64 %12, %10
%14 = zext i8 %6 to i64
%15 = shl nuw nsw i64 %14, 8
%16 = or i64 %13, %15
%17 = zext i8 %8 to i64
%18 = or i64 %16, %17
ret i64 %18
}
void uart_putchar(int value) {
  while (((*(volatile unsigned int *)(0x20000020)) & 0x02) == 0)
    ;
  (*(volatile unsigned int *)(0x20000000) = (value));
}


x86 assembly (clang, -O0):
<uart_putchar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0x20000020,%eax
mov    (%rax),%eax
and    $0x2,%eax
cmp    $0x0,%eax
jne    111f <uart_putchar+0x1f>
jmp    1107 <uart_putchar+0x7>
mov    -0x4(%rbp),%ecx
mov    $0x20000000,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_putchar>:
testl  $0x2,0x20000020
je     1100 <uart_putchar>
mov    %edi,0x20000000
ret

LLVM IR (-O0):
define void @uart_putchar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load volatile i32, i32* inttoptr (i64 536870944 to i32*)
%5 = and i32 %4, 2
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
%9 = load i32, i32* %2
store volatile i32 %9, i32* inttoptr (i64 536870912 to i32*)
ret void
}

LLVM IR (-O2):
define void @uart_putchar(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i32, i32* inttoptr (i64 536870944 to i32*)
%4 = and i32 %3, 2
%5 = icmp eq i32 %4, 0
br i1 %5, label %2, label %6
6: ; preds = %2
store volatile i32 %0, i32* inttoptr (i64 536870912 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char const *);
void internaloutput(const char *str) { printf(str); }


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

x86 assembly (clang, -O2):
<internaloutput>:
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
define void @internaloutput(i8* nocapture %0) {
%2 = tail call i32 @printf(i8* dereferenceable(1) %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printString(char str[], int length) {
  int i;
  for (i = 0; i < length; i++) {
    printf("%c", str[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<printString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    115a <printString+0x4a>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printString+0x16>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printString>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
jle    1143 <printString+0x33>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <printString+0x20>
mov    $0xa,%edi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @printString(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = tail call i32 @putchar(i32 %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
%15 = tail call i32 @putchar(i32 10)
ret void
}
/* Type definitions */
union i2c_smbus_data {
  int word;
};
typedef int /*<<< orphan*/ __u8;
typedef int __u16;
typedef int __s32;

/* Variables and functions */
scalar_t__ i2c_smbus_access(int, int /*<<< orphan*/, int /*<<< orphan*/, int,
                            union i2c_smbus_data *);
__s32 i2c_smbus_process_call(int file, __u8 command, __u16 value) {
  union i2c_smbus_data data;
  data.word = value;
  if (i2c_smbus_access(file, 0, command, 4, &data))
    return -1;
  else
    return 0x0FFFF & data.word;
}


x86 assembly (clang, -O0):
<i2c_smbus_process_call>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
mov    $0x4,%ecx
lea    -0x18(%rbp),%r8
call   1030 <i2c_smbus_access@plt>
cmp    $0x0,%rax
je     1153 <i2c_smbus_process_call+0x43>
movl   $0xffffffff,-0x4(%rbp)
jmp    115e <i2c_smbus_process_call+0x4e>
mov    -0x18(%rbp),%eax
and    $0xffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<i2c_smbus_process_call>:
push   %rax
mov    %esi,%eax
mov    %edx,(%rsp)
mov    %rsp,%r8
xor    %esi,%esi
mov    %eax,%edx
mov    $0x4,%ecx
call   1030 <i2c_smbus_access@plt>
movzwl (%rsp),%ecx
neg    %rax
sbb    %eax,%eax
or     %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%union.i2c_smbus_data = type { i32 }
define i32 @i2c_smbus_process_call(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %union.i2c_smbus_data
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%9 = load i32, i32* %7
%10 = bitcast %union.i2c_smbus_data* %8 to i32*
store i32 %9, i32* %10
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = call i64 @i2c_smbus_access(i32 %11, i32 0, i32 %12, i32 4, %union.i2c_smbus_data* %8)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %3
store i32 -1, i32* %4
br label %20
16: ; preds = %3
%17 = bitcast %union.i2c_smbus_data* %8 to i32*
%18 = load i32, i32* %17
%19 = and i32 65535, %18
store i32 %19, i32* %4
br label %20
20: ; preds = %16, %15
%21 = load i32, i32* %4
ret i32 %21
}

LLVM IR (-O2):
%union.i2c_smbus_data = type { i32 }
define i32 @i2c_smbus_process_call(i32 %0, i32 %1, i32 %2) {
%4 = alloca %union.i2c_smbus_data
%5 = bitcast %union.i2c_smbus_data* %4 to i8*
%6 = getelementptr inbounds %union.i2c_smbus_data, %union.i2c_smbus_data* %4, i64 0, i32 0
store i32 %2, i32* %6
%7 = call i64 @i2c_smbus_access(i32 %0, i32 0, i32 %1, i32 4, %union.i2c_smbus_data* %4)
%8 = icmp eq i64 %7, 0
%9 = load i32, i32* %6
%10 = and i32 %9, 65535
%11 = select i1 %8, i32 %10, i32 -1
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ EX_USAGE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void emit_help(void) {
  fputs("Usage: fdsplit [-0] [-d delim] root|ext filename\n", stderr);
  exit(EX_USAGE);
}


x86 assembly (clang, -O0):
<emit_help>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ead(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2ea8(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<emit_help>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1030 <fputs@plt>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"Usage: fdsplit [-0] [-d delim] root|ext filename\0A\00"
@stderr = global i32 0
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EX_USAGE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@.str = [50 x i8] c"Usage: fdsplit [-0] [-d delim] root|ext filename\0A\00"
@stderr = global i32 0
@EX_USAGE = global i32 0
define void @emit_help() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = load i32, i32* @EX_USAGE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ emit_core(int, int);
void emit_test(int op) { emit_core(op, 2); }


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

x86 assembly (clang, -O2):
<emit_test>:
mov    $0x2,%esi
jmp    1030 <emit_core@plt>

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

LLVM IR (-O2):
define void @emit_test(i32 %0) {
%2 = tail call i32 @emit_core(i32 %0, i32 2)
ret void
}
/* Type definitions */
struct shmid_ds {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ StubBug(char *);
int shmctl(int shmid, int cmd, struct shmid_ds *buf) {
  StubBug("STUB:"
          "shmctl");
  return -1;
}


x86 assembly (clang, -O0):
<shmctl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
lea    0xed7(%rip),%rdi
call   1030 <StubBug@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shmctl>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <StubBug@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.shmid_ds = type { i32 }
@.str = [12 x i8] c"STUB:shmctl\00"
define i32 @shmctl(i32 %0, i32 %1, %struct.shmid_ds* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.shmid_ds*
store i32 %0, i32* %4
store i32 %1, i32* %5
store %struct.shmid_ds* %2, %struct.shmid_ds** %6
%7 = call i32 @StubBug(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
%struct.shmid_ds = type { i32 }
@.str = [12 x i8] c"STUB:shmctl\00"
define i32 @shmctl(i32 %0, i32 %1, %struct.shmid_ds* nocapture readnone %2) {
%4 = tail call i32 @StubBug(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void atexit1(void) { printf("atexit1\n"); }


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

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

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

LLVM IR (-O2):
@str = [8 x i8] c"atexit1\00"
define void @atexit1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret void
}