#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ CheckASCIITest(char *, int);
int /*<<< orphan*/ Error(char *);
scalar_t__ WriteASCIITest(char *, int);
int main() {
  int i;
  for (i = 0; i < 256; i++) {
    if (WriteASCIITest("io.test", 256 * 1024))
      Error("exiting\n");
    if (CheckASCIITest("io.test", 256 * 1024))
      Error("input error\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jge    11b4 <main+0x84>
lea    0xea6(%rip),%rdi
mov    $0x40000,%esi
call   1040 <WriteASCIITest@plt>
cmp    $0x0,%rax
je     117a <main+0x4a>
lea    0xe93(%rip),%rdi
call   1030 <Error@plt>
lea    0xe7f(%rip),%rdi
mov    $0x40000,%esi
call   1050 <CheckASCIITest@plt>
cmp    $0x0,%rax
je     11a1 <main+0x71>
lea    0xe75(%rip),%rdi
call   1030 <Error@plt>
jmp    11a6 <main+0x76>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x100,%ebp
lea    0xebd(%rip),%rbx
lea    0xec7(%rip),%r14
lea    0xeb7(%rip),%r15
jmp    1165 <main+0x35>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0xffffffff,%ebp
je     119b <main+0x6b>
mov    %rbx,%rdi
mov    $0x40000,%esi
call   1040 <WriteASCIITest@plt>
test   %rax,%rax
je     117f <main+0x4f>
mov    %r15,%rdi
call   1030 <Error@plt>
mov    %rbx,%rdi
mov    $0x40000,%esi
call   1050 <CheckASCIITest@plt>
test   %rax,%rax
je     1160 <main+0x30>
mov    %r14,%rdi
call   1030 <Error@plt>
jmp    1160 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"io.test\00"
@.str.1 = [9 x i8] c"exiting\0A\00"
@.str.2 = [13 x i8] c"input error\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %17, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 256
br i1 %5, label %6, label %20
6: ; preds = %3
%7 = call i64 @WriteASCIITest(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 262144)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @Error(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
%12 = call i64 @CheckASCIITest(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 262144)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @Error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
br label %17
17: ; preds = %16
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %3
20: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"io.test\00"
@.str.1 = [9 x i8] c"exiting\0A\00"
@.str.2 = [13 x i8] c"input error\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %12
%2 = phi i32 [ 0, %0 ], [ %13, %12 ]
%3 = tail call i64 @WriteASCIITest(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 262144)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @Error(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = tail call i64 @CheckASCIITest(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 262144)
%9 = icmp eq i64 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = tail call i32 @Error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %12
12: ; preds = %7, %10
%13 = add nuw nsw i32 %2, 1
%14 = icmp eq i32 %13, 256
br i1 %14, label %15, label %1
15: ; preds = %12
ret i32 0
}