#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char EOF;
char fgetc(int /*<<< orphan*/ *);
scalar_t__ printf(char *, char *);
int Vystup(FILE *aSoubor) {
  char arr[25];
  int cnt = 0;
  enum { LINE_ERR = 0, LINE_OK, LINE_LAST } line_type = LINE_ERR;
  if (aSoubor == NULL)
    return -1;
  while (1) {
    for (int i = 0; i < 25; i++) {
      arr[i] = fgetc(aSoubor);
      if (arr[i] == EOF) {
        arr[i] = '\0';
        line_type = LINE_LAST;
      }
      if (arr[i] == '\n') {
        line_type = LINE_OK;
        if (i < 24)
          arr[i + 1] = '\0';
        break;
      }
    }
    if (line_type == LINE_ERR)
      return -2;
    cnt += printf("%s", arr);
    if (line_type == LINE_LAST)
      return cnt;
    line_type = LINE_ERR;
  }
}


x86 assembly (clang, -O0):
<Vystup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1151 <Vystup+0x31>
movl   $0xffffffff,-0x4(%rbp)
jmp    1241 <Vystup+0x121>
jmp    1156 <Vystup+0x36>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x19,-0x3c(%rbp)
jge    11ed <Vystup+0xcd>
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,%cl
movslq -0x3c(%rbp),%rax
mov    %cl,-0x30(%rbp,%rax,1)
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
mov    0x2e5e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    11a5 <Vystup+0x85>
movslq -0x3c(%rbp),%rax
movb   $0x0,-0x30(%rbp,%rax,1)
movl   $0x2,-0x38(%rbp)
movslq -0x3c(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0xa,%eax
jne    11da <Vystup+0xba>
movl   $0x1,-0x38(%rbp)
cmpl   $0x18,-0x3c(%rbp)
jge    11d5 <Vystup+0xb5>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
cltq
movb   $0x0,-0x30(%rbp,%rax,1)
jmp    11ed <Vystup+0xcd>
jmp    11df <Vystup+0xbf>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    115d <Vystup+0x3d>
cmpl   $0x0,-0x38(%rbp)
jne    1203 <Vystup+0xe3>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1241 <Vystup+0x121>
lea    -0x30(%rbp),%rsi
lea    0xdf2(%rip),%rdi
call   1030 <printf@plt>
mov    %rax,%rcx
movslq -0x34(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x34(%rbp)
cmpl   $0x2,-0x38(%rbp)
jne    1235 <Vystup+0x115>
mov    -0x34(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1241 <Vystup+0x121>
movl   $0x0,-0x38(%rbp)
jmp    1156 <Vystup+0x36>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Vystup>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
test   %rdi,%rdi
je     11d7 <Vystup+0xb7>
mov    %rdi,%rbx
xor    %r14d,%r14d
mov    0x2ea4(%rip),%r13
mov    $0x2,%ebp
jmp    116b <Vystup+0x4b>
nopl   0x0(%rax,%rax,1)
lea    0xea9(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
movslq %r14d,%r14
add    %rax,%r14
cmp    $0x2,%r15d
je     11e5 <Vystup+0xc5>
xor    %r12d,%r12d
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <fgetc@plt>
movzbl 0x0(%r13),%ecx
xor    %edx,%edx
cmp    %cl,%al
je     1196 <Vystup+0x76>
movzbl %al,%edx
mov    %dl,(%rsp,%r12,1)
cmp    $0xa,%dl
je     11c0 <Vystup+0xa0>
cmp    %cl,%al
cmove  %ebp,%r15d
add    $0x1,%r12
cmp    $0x19,%r12
jne    1180 <Vystup+0x60>
test   %r15d,%r15d
jne    1150 <Vystup+0x30>
jmp    11df <Vystup+0xbf>
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%r15d
cmp    $0x17,%r12d
ja     1150 <Vystup+0x30>
movb   $0x0,0x1(%rsp,%r12,1)
jmp    1150 <Vystup+0x30>
mov    $0xffffffff,%r14d
jmp    11e5 <Vystup+0xc5>
mov    $0xfffffffe,%r14d
mov    %r14d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i8 0
@.str = [3 x i8] c"%s\00"
define i32 @Vystup(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [25 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %3
store i32 0, i32* %5
store i32 0, i32* %6
%8 = load i32*, i32** %3
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %70
11: ; preds = %1
br label %12
12: ; preds = %11, %69
store i32 0, i32* %7
br label %13
13: ; preds = %51, %12
%14 = load i32, i32* %7
%15 = icmp slt i32 %14, 25
br i1 %15, label %16, label %54
16: ; preds = %13
%17 = load i32*, i32** %3
%18 = call signext i8 @fgetc(i32* %17)
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [25 x i8], [25 x i8]* %4, i64 0, i64 %20
store i8 %18, i8* %21
%22 = load i32, i32* %7
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [25 x i8], [25 x i8]* %4, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = load i8, i8* @EOF
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %26, %28
br i1 %29, label %30, label %34
30: ; preds = %16
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [25 x i8], [25 x i8]* %4, i64 0, i64 %32
store i8 0, i8* %33
store i32 2, i32* %6
br label %34
34: ; preds = %30, %16
%35 = load i32, i32* %7
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [25 x i8], [25 x i8]* %4, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 10
br i1 %40, label %41, label %50
41: ; preds = %34
store i32 1, i32* %6
%42 = load i32, i32* %7
%43 = icmp slt i32 %42, 24
br i1 %43, label %44, label %49
44: ; preds = %41
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 1
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [25 x i8], [25 x i8]* %4, i64 0, i64 %47
store i8 0, i8* %48
br label %49
49: ; preds = %44, %41
br label %54
50: ; preds = %34
br label %51
51: ; preds = %50
%52 = load i32, i32* %7
%53 = add nsw i32 %52, 1
store i32 %53, i32* %7
br label %13
54: ; preds = %49, %13
%55 = load i32, i32* %6
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %58
57: ; preds = %54
store i32 -2, i32* %2
br label %70
58: ; preds = %54
%59 = getelementptr inbounds [25 x i8], [25 x i8]* %4, i64 0, i64 0
%60 = call i64 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %59)
%61 = load i32, i32* %5
%62 = sext i32 %61 to i64
%63 = add nsw i64 %62, %60
%64 = trunc i64 %63 to i32
store i32 %64, i32* %5
%65 = load i32, i32* %6
%66 = icmp eq i32 %65, 2
br i1 %66, label %67, label %69
67: ; preds = %58
%68 = load i32, i32* %5
store i32 %68, i32* %2
br label %70
69: ; preds = %58
store i32 0, i32* %6
br label %12
70: ; preds = %67, %57, %10
%71 = load i32, i32* %2
ret i32 %71
}

LLVM IR (-O2):
@EOF = global i8 0
@.str = [3 x i8] c"%s\00"
define i32 @Vystup(i32* %0) {
%2 = alloca [25 x i8]
%3 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 0
%4 = icmp eq i32* %0, null
br i1 %4, label %38, label %5
5: ; preds = %1, %29
%6 = phi i64 [ %34, %29 ], [ 0, %1 ]
br label %7
7: ; preds = %5, %23
%8 = phi i64 [ 0, %5 ], [ %25, %23 ]
%9 = phi i32 [ 0, %5 ], [ %24, %23 ]
%10 = call signext i8 @fgetc(i32* %0)
%11 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 %8
%12 = load i8, i8* @EOF
%13 = icmp eq i8 %10, %12
%14 = select i1 %13, i8 0, i8 %10
store i8 %14, i8* %11
%15 = icmp eq i8 %14, 10
br i1 %15, label %16, label %23
16: ; preds = %7
%17 = trunc i64 %8 to i32
%18 = icmp ult i32 %17, 24
br i1 %18, label %19, label %29
19: ; preds = %16
%20 = add nuw i64 %8, 1
%21 = and i64 %20, 4294967295
%22 = getelementptr inbounds [25 x i8], [25 x i8]* %2, i64 0, i64 %21
store i8 0, i8* %22
br label %29
23: ; preds = %7
%24 = select i1 %13, i32 2, i32 %9
%25 = add nuw nsw i64 %8, 1
%26 = icmp eq i64 %25, 25
br i1 %26, label %27, label %7
27: ; preds = %23
%28 = icmp eq i32 %24, 0
br i1 %28, label %38, label %29
29: ; preds = %16, %19, %27
%30 = phi i32 [ %24, %27 ], [ 1, %19 ], [ 1, %16 ]
%31 = call i64 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%32 = shl i64 %6, 32
%33 = ashr exact i64 %32, 32
%34 = add nsw i64 %31, %33
%35 = icmp eq i32 %30, 2
br i1 %35, label %36, label %5
36: ; preds = %29
%37 = trunc i64 %34 to i32
br label %38
38: ; preds = %27, %1, %36
%39 = phi i32 [ %37, %36 ], [ -1, %1 ], [ -2, %27 ]
ret i32 %39
}