#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 */
int Vystup(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(unsigned char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  unsigned char soubor_vstup[] = "vstup.in";
  FILE *input = fopen(soubor_vstup, "r");
  if (input == NULL) {
    printf("Nepodarilo se otevrit vstupni soubor!\n");
    return 1;
  }
  int num = Vystup(input);
  if (num > 0) {
    printf("Nacteno %d znaku\n", num);
    fclose(input);
    return 0;
  }
  fclose(input);
  return 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0xd(%rbp)
mov    0xea8(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0xd(%rbp),%rdi
lea    0xe9b(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    119c <main+0x5c>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11e8 <main+0xa8>
mov    -0x18(%rbp),%rdi
call   1030 <Vystup@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    11d8 <main+0x98>
mov    -0x1c(%rbp),%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    11e8 <main+0xa8>
mov    -0x18(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x2,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movabs $0x6e692e7075747376,%rax
2e 69 6e
mov    %rax,0x8(%rsp)
movb   $0x0,0x10(%rsp)
lea    0xe98(%rip),%rsi
lea    0x8(%rsp),%rdi
call   1070 <fopen@plt>
test   %rax,%rax
je     11ab <main+0x5b>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <Vystup@plt>
test   %eax,%eax
jle    11be <main+0x6e>
lea    0xe75(%rip),%rdi
xor    %ebp,%ebp
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
jmp    11cb <main+0x7b>
lea    0xe6b(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebp
jmp    11cb <main+0x7b>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    $0x2,%ebp
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.soubor_vstup = [9 x i8] c"vstup.in\00"
@.str = [2 x i8] c"r\00"
@.str.1 = [39 x i8] c"Nepodarilo se otevrit vstupni soubor!\0A\00"
@.str.2 = [18 x i8] c"Nacteno %d znaku\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i8]
%3 = alloca i32*
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [9 x i8]* %2 to i8*
%6 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%7 = call i32* @fopen(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %7, i32** %3
%8 = load i32*, i32** %3
%9 = icmp eq i32* %8, null
br i1 %9, label %10, label %12
10: ; preds = %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %25
12: ; preds = %0
%13 = load i32*, i32** %3
%14 = call i32 @Vystup(i32* %13)
store i32 %14, i32* %4
%15 = load i32, i32* %4
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %12
%18 = load i32, i32* %4
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %18)
%20 = load i32*, i32** %3
%21 = call i32 @fclose(i32* %20)
store i32 0, i32* %1
br label %25
22: ; preds = %12
%23 = load i32*, i32** %3
%24 = call i32 @fclose(i32* %23)
store i32 2, i32* %1
br label %25
25: ; preds = %22, %17, %10
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
@__const.main.soubor_vstup = [9 x i8] c"vstup.in\00"
@.str = [2 x i8] c"r\00"
@.str.2 = [18 x i8] c"Nacteno %d znaku\0A\00"
@str = [38 x i8] c"Nepodarilo se otevrit vstupni soubor!\00"
define i32 @main() {
%1 = alloca [9 x i8]
%2 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%3 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
br label %15
7: ; preds = %0
%8 = tail call i32 @Vystup(i32* %3)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%12 = tail call i32 @fclose(i32* %3)
br label %15
13: ; preds = %7
%14 = tail call i32 @fclose(i32* %3)
br label %15
15: ; preds = %10, %13, %5
%16 = phi i32 [ 1, %5 ], [ 0, %10 ], [ 2, %13 ]
ret i32 %16
}