#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 */
int atoi(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ putc(int, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  if (argc != 3) {
    fprintf(stderr, "Missing arguments.\nUsage: generate_binary_testfile "
                    "<start_byte_value> <end_byte_value>\n");
    exit(1);
  }
  int start = atoi(argv[1]);
  int end = atoi(argv[2]);
  if (start < 0 || start > end || end < 0) {
    fprintf(stderr, "Illegal start (%d) or end (%d) values.\n", start, end);
    exit(1);
  }
  for (int i = start; i <= end; ++i) {
    putc(i, stdout);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1181 <main+0x41>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11c1 <main+0x81>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11c1 <main+0x81>
cmpl   $0x0,-0x18(%rbp)
jge    11e8 <main+0xa8>
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
lea    0xe81(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1219 <main+0xd9>
mov    -0x1c(%rbp),%edi
mov    0x2dd4(%rip),%rax
mov    (%rax),%esi
call   1030 <putc@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ee <main+0xae>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x3,%edi
jne    11bd <main+0x7d>
mov    %rsi,%rbp
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
mov    0x10(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
test   %ebx,%ebx
js     1198 <main+0x58>
cmp    %ebp,%ebx
jg     1198 <main+0x58>
test   %ebp,%ebp
js     1198 <main+0x58>
add    $0x1,%ebp
mov    0x2e60(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r14),%esi
mov    %ebx,%edi
call   1030 <putc@plt>
add    $0x1,%ebx
cmp    %ebx,%ebp
jne    1180 <main+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %ebx,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
lea    0xe33(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [88 x i8] c"Missing arguments.\0AUsage: generate_binary_testfile <start_byte_value> <end_byte_value>\0A\00"
@.str.1 = [40 x i8] c"Illegal start (%d) or end (%d) values.\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
%19 = call i32 @atoi(i8* %18)
store i32 %19, i32* %6
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 2
%22 = load i8*, i8** %21
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %7
%24 = load i32, i32* %6
%25 = icmp slt i32 %24, 0
br i1 %25, label %33, label %26
26: ; preds = %15
%27 = load i32, i32* %6
%28 = load i32, i32* %7
%29 = icmp sgt i32 %27, %28
br i1 %29, label %33, label %30
30: ; preds = %26
%31 = load i32, i32* %7
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %39
33: ; preds = %30, %26, %15
%34 = load i32, i32* @stderr
%35 = load i32, i32* %6
%36 = load i32, i32* %7
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %35, i32 %36)
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %30
%40 = load i32, i32* %6
store i32 %40, i32* %8
br label %41
41: ; preds = %49, %39
%42 = load i32, i32* %8
%43 = load i32, i32* %7
%44 = icmp sle i32 %42, %43
br i1 %44, label %45, label %52
45: ; preds = %41
%46 = load i32, i32* %8
%47 = load i32, i32* @stdout
%48 = call i32 @putc(i32 %46, i32 %47)
br label %49
49: ; preds = %45
%50 = load i32, i32* %8
%51 = add nsw i32 %50, 1
store i32 %51, i32* %8
br label %41
52: ; preds = %41
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [88 x i8] c"Missing arguments.\0AUsage: generate_binary_testfile <start_byte_value> <end_byte_value>\0A\00"
@.str.1 = [40 x i8] c"Illegal start (%d) or end (%d) values.\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([88 x i8], [88 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @atoi(i8* %13)
%15 = icmp slt i32 %11, 0
br i1 %15, label %20, label %16
16: ; preds = %8
%17 = icmp sgt i32 %11, %14
%18 = icmp slt i32 %14, 0
%19 = or i1 %17, %18
br i1 %19, label %20, label %25
20: ; preds = %16, %8
%21 = load i32, i32* @stderr
%22 = tail call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %14)
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %25
ret i32 0
25: ; preds = %16, %25
%26 = phi i32 [ %29, %25 ], [ %11, %16 ]
%27 = load i32, i32* @stdout
%28 = tail call i32 @putc(i32 %26, i32 %27)
%29 = add i32 %26, 1
%30 = icmp eq i32 %26, %14
br i1 %30, label %24, label %25
}