#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__ readline(char *, int);
int main(int argc, char *argv[]) {
  char line[1000][1000];
  int inspace, outspace, i, linecount, space;
  if (argc == 3) {
    inspace = 4;
    outspace = 2;
    i = linecount = 0;
    while (readline(line[i++], 1000) >= 0)
      linecount++;
  } else {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf4270,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    11ac <main+0x9c>
movl   $0x4,-0xf4254(%rbp)
movl   $0x2,-0xf4258(%rbp)
movl   $0x0,-0xf4260(%rbp)
movl   $0x0,-0xf425c(%rbp)
mov    -0xf425c(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0xf425c(%rbp)
cltq
lea    -0xf4250(%rbp),%rdi
imul   $0x3e8,%rax,%rax
add    %rax,%rdi
mov    $0x3e8,%esi
call   1030 <readline@plt>
cmp    $0x0,%rax
jl     11a7 <main+0x97>
mov    -0xf4260(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xf4260(%rbp)
jmp    115b <main+0x4b>
jmp    11b8 <main+0xa8>
movl   $0x1,-0x4(%rbp)
jmp    11bf <main+0xaf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xf4270,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%eax
cmp    $0x3,%edi
jne    1153 <main+0x43>
push   %rbx
sub    $0xf4240,%rsp
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1030 <readline@plt>
add    $0x3e8,%rbx
test   %rax,%rax
jns    1130 <main+0x20>
xor    %eax,%eax
add    $0xf4240,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1000 x [1000 x i8]]
%4 = getelementptr inbounds [1000 x [1000 x i8]], [1000 x [1000 x i8]]* %3, i64 0, i64 0, i64 0
%5 = icmp eq i32 %0, 3
br i1 %5, label %6, label %12
6: ; preds = %2, %6
%7 = phi i64 [ %11, %6 ], [ 0, %2 ]
%8 = getelementptr inbounds [1000 x [1000 x i8]], [1000 x [1000 x i8]]* %3, i64 0, i64 %7, i64 0
%9 = call i64 @readline(i8* %8, i32 1000)
%10 = icmp sgt i64 %9, -1
%11 = add nuw i64 %7, 1
br i1 %10, label %6, label %12
12: ; preds = %6, %2
%13 = phi i32 [ 1, %2 ], [ 0, %6 ]
ret i32 %13
}