#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*/ assert(int);
int getlines(char **, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  char *lines[1000];
  int len;
  if (len = getlines(lines, 1000, stdin)) {
    assert(len == 3);
    assert(strcmp(lines[0], "line1\n") == 0);
    assert(strcmp(lines[1], "line2\n") == 0);
    assert(strcmp(lines[2], "line3\n") == 0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x1f50(%rbp),%rdi
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
mov    $0x3e8,%esi
call   1050 <getlines@plt>
mov    %eax,-0x1f54(%rbp)
cmp    $0x0,%eax
je     11f2 <main+0xc2>
cmpl   $0x3,-0x1f54(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x1f50(%rbp),%rdi
lea    0xe6c(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x1f48(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x1f40(%rbp),%rdi
lea    0xe32(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x1f60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x1f48,%rsp
mov    0x2eaa(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x3e8,%esi
call   1050 <getlines@plt>
test   %eax,%eax
je     11bb <main+0x8b>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1040 <assert@plt>
mov    (%rsp),%rdi
lea    0xe96(%rip),%rsi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
mov    0x8(%rsp),%rdi
lea    0xe7e(%rip),%rsi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
mov    0x10(%rsp),%rdi
lea    0xe66(%rip),%rsi
call   1030 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x1f48,%rsp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [7 x i8] c"line1\0A\00"
@.str.1 = [7 x i8] c"line2\0A\00"
@.str.2 = [7 x i8] c"line3\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [1000 x i8*]
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %6, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32 @getlines(i8** %8, i32 1000, i32 %9)
store i32 %10, i32* %7
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %35
12: ; preds = %2
%13 = load i32, i32* %7
%14 = icmp eq i32 %13, 3
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %6, i64 0, i64 0
%18 = load i8*, i8** %17
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %6, i64 0, i64 1
%24 = load i8*, i8** %23
%25 = call i64 @strcmp(i8* %24, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %6, i64 0, i64 2
%30 = load i8*, i8** %29
%31 = call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
br label %35
35: ; preds = %12, %2
%36 = load i32, i32* %3
ret i32 %36
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [7 x i8] c"line1\0A\00"
@.str.1 = [7 x i8] c"line2\0A\00"
@.str.2 = [7 x i8] c"line3\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1000 x i8*]
%4 = bitcast [1000 x i8*]* %3 to i8*
%5 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %3, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i32 @getlines(i8** %5, i32 1000, i32 %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %30, label %9
9: ; preds = %2
%10 = icmp eq i32 %7, 3
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i8*, i8** %5
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %3, i64 0, i64 1
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %3, i64 0, i64 2
%25 = load i8*, i8** %24
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
br label %30
30: ; preds = %9, %2
ret i32 0
}