#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 /*<<< orphan*/ exit(int);
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int sscanf(char *, char *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  int from, to, i;
  char buf[1025];
  if (argc >= 2) {
    if (sscanf(argv[1], "%d", &from) != 1) {
      fprintf(stderr, "Invalid parameter (from): %s\n", argv[1]);
      exit(1);
    }
    if (argc == 3) {
      if (sscanf(argv[2], "%d", &to) != 1) {
        fprintf(stderr, "Invalid parameter (to): %s\n", argv[2]);
        exit(1);
      }
    } else
      to = from;
  } else {
    fprintf(stderr, "Syntax: pf <from> [<to>]\n");
    exit(1);
  }
  i = 0;
  while (fgets(buf, 1025, stdin) && i <= to) {
    if (i >= from)
      fputs(buf, stdout);
    if (buf[0] == '\n')
      i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     1221 <main+0xd1>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7e(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x1,%eax
je     11bd <main+0x6d>
mov    0x2e3d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe57(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
cmpl   $0x3,-0x8(%rbp)
jne    1216 <main+0xc6>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe2a(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <sscanf@plt>
cmp    $0x1,%eax
je     1211 <main+0xc1>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xe21(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
jmp    121c <main+0xcc>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1242 <main+0xf2>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
lea    0xe0c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
movl   $0x0,-0x1c(%rbp)
lea    -0x420(%rbp),%rdi
mov    0x2d91(%rip),%rax
mov    (%rax),%edx
mov    $0x401,%esi
call   1040 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x421(%rbp)
je     1287 <main+0x137>
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
setle  %al
mov    %al,-0x421(%rbp)
mov    -0x421(%rbp),%al
test   $0x1,%al
jne    129a <main+0x14a>
jmp    12d9 <main+0x189>
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jl     12bb <main+0x16b>
lea    -0x420(%rbp),%rdi
mov    0x2d1c(%rip),%rax
mov    (%rax),%esi
call   1030 <fputs@plt>
movsbl -0x420(%rbp),%eax
cmp    $0xa,%eax
jne    12d4 <main+0x184>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1249 <main+0xf9>
xor    %eax,%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
cmp    $0x2,%edi
jl     1250 <main+0x100>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
lea    0xe86(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1060 <sscanf@plt>
cmp    $0x1,%eax
jne    1271 <main+0x121>
cmp    $0x3,%ebp
jne    11c5 <main+0x75>
mov    0x10(%rbx),%rdi
lea    0xe63(%rip),%rsi
lea    0x8(%rsp),%rdx
call   1060 <sscanf@plt>
cmp    $0x1,%eax
je     11cd <main+0x7d>
mov    0x2e25(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rbx),%rdx
lea    0xe61(%rip),%rsi
jmp    1285 <main+0x135>
mov    0xc(%rsp),%eax
mov    %eax,0x8(%rsp)
mov    0x2e14(%rip),%r14
mov    (%r14),%edx
lea    0x10(%rsp),%rdi
mov    $0x401,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     123c <main+0xec>
cmpl   $0x0,0x8(%rsp)
js     123c <main+0xec>
xor    %ebp,%ebp
lea    0x10(%rsp),%r12
mov    0x2dd0(%rip),%r15
cmp    0xc(%rsp),%ebp
jl     1211 <main+0xc1>
mov    (%r15),%esi
mov    %r12,%rdi
call   1030 <fputs@plt>
xor    %ebx,%ebx
cmpb   $0xa,0x10(%rsp)
sete   %r13b
mov    (%r14),%edx
mov    %r12,%rdi
mov    $0x401,%esi
call   1040 <fgets@plt>
test   %rax,%rax
je     123c <main+0xec>
mov    %r13b,%bl
add    %ebx,%ebp
cmp    0x8(%rsp),%ebp
jle    1200 <main+0xb0>
xor    %eax,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d81(%rip),%rax
mov    (%rax),%edi
lea    0xddd(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%edi
mov    0x8(%rbx),%rdx
lea    0xd7e(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.1 = [30 x i8] c"Invalid parameter (from): %s\0A\00"
@.str.2 = [28 x i8] c"Invalid parameter (to): %s\0A\00"
@.str.3 = [26 x i8] c"Syntax: pf <from> [<to>]\0A\00"
@stdin = global i32 0
@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
%9 = alloca [1025 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp sge i32 %10, 2
br i1 %11, label %12, label %45
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @sscanf(i8* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%17 = icmp ne i32 %16, 1
br i1 %17, label %18, label %25
18: ; preds = %12
%19 = load i32, i32* @stderr
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = call i32 @exit(i32 1)
unreachable
25: ; preds = %12
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 3
br i1 %27, label %28, label %42
28: ; preds = %25
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
%32 = call i32 @sscanf(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%33 = icmp ne i32 %32, 1
br i1 %33, label %34, label %41
34: ; preds = %28
%35 = load i32, i32* @stderr
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 2
%38 = load i8*, i8** %37
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %38)
%40 = call i32 @exit(i32 1)
unreachable
41: ; preds = %28
br label %44
42: ; preds = %25
%43 = load i32, i32* %6
store i32 %43, i32* %7
br label %44
44: ; preds = %42, %41
br label %49
45: ; preds = %2
%46 = load i32, i32* @stderr
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %44
store i32 0, i32* %8
br label %50
50: ; preds = %77, %49
%51 = getelementptr inbounds [1025 x i8], [1025 x i8]* %9, i64 0, i64 0
%52 = load i32, i32* @stdin
%53 = call i64 @fgets(i8* %51, i32 1025, i32 %52)
%54 = icmp ne i64 %53, 0
br i1 %54, label %55, label %59
55: ; preds = %50
%56 = load i32, i32* %8
%57 = load i32, i32* %7
%58 = icmp sle i32 %56, %57
br label %59
59: ; preds = %55, %50
%60 = phi i1 [ false, %50 ], [ %58, %55 ]
br i1 %60, label %61, label %78
61: ; preds = %59
%62 = load i32, i32* %8
%63 = load i32, i32* %6
%64 = icmp sge i32 %62, %63
br i1 %64, label %65, label %69
65: ; preds = %61
%66 = getelementptr inbounds [1025 x i8], [1025 x i8]* %9, i64 0, i64 0
%67 = load i32, i32* @stdout
%68 = call i32 @fputs(i8* %66, i32 %67)
br label %69
69: ; preds = %65, %61
%70 = getelementptr inbounds [1025 x i8], [1025 x i8]* %9, i64 0, i64 0
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp eq i32 %72, 10
br i1 %73, label %74, label %77
74: ; preds = %69
%75 = load i32, i32* %8
%76 = add nsw i32 %75, 1
store i32 %76, i32* %8
br label %77
77: ; preds = %74, %69
br label %50
78: ; preds = %59
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@stderr = global i32 0
@.str.1 = [30 x i8] c"Invalid parameter (from): %s\0A\00"
@.str.2 = [28 x i8] c"Invalid parameter (to): %s\0A\00"
@.str.3 = [26 x i8] c"Syntax: pf <from> [<to>]\0A\00"
@stdin = global i32 0
@stdout = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [1025 x i8]
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = getelementptr inbounds [1025 x i8], [1025 x i8]* %5, i64 0, i64 0
%9 = icmp sgt i32 %0, 1
br i1 %9, label %10, label %34
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @sscanf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%14 = icmp eq i32 %13, 1
br i1 %14, label %20, label %15
15: ; preds = %10
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %11
%18 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %10
%21 = icmp eq i32 %0, 3
br i1 %21, label %22, label %32
22: ; preds = %20
%23 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = call i32 @sscanf(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%26 = icmp eq i32 %25, 1
br i1 %26, label %38, label %27
27: ; preds = %22
%28 = load i32, i32* @stderr
%29 = load i8*, i8** %23
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = call i32 @exit(i32 1)
unreachable
32: ; preds = %20
%33 = load i32, i32* %3
store i32 %33, i32* %4
br label %38
34: ; preds = %2
%35 = load i32, i32* @stderr
%36 = tail call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%37 = tail call i32 @exit(i32 1)
unreachable
38: ; preds = %32, %22
%39 = load i32, i32* @stdin
%40 = call i64 @fgets(i8* %8, i32 1025, i32 %39)
%41 = icmp ne i64 %40, 0
%42 = load i32, i32* %4
%43 = icmp sgt i32 %42, -1
%44 = select i1 %41, i1 %43, i1 false
br i1 %44, label %45, label %63
45: ; preds = %38, %52
%46 = phi i32 [ %56, %52 ], [ 0, %38 ]
%47 = load i32, i32* %3
%48 = icmp slt i32 %46, %47
br i1 %48, label %52, label %49
49: ; preds = %45
%50 = load i32, i32* @stdout
%51 = call i32 @fputs(i8* %8, i32 %50)
br label %52
52: ; preds = %49, %45
%53 = load i8, i8* %8
%54 = icmp eq i8 %53, 10
%55 = zext i1 %54 to i32
%56 = add nuw nsw i32 %46, %55
%57 = load i32, i32* @stdin
%58 = call i64 @fgets(i8* %8, i32 1025, i32 %57)
%59 = icmp ne i64 %58, 0
%60 = load i32, i32* %4
%61 = icmp sle i32 %56, %60
%62 = select i1 %59, i1 %61, i1 false
br i1 %62, label %45, label %63
63: ; preds = %52, %38
ret i32 0
}