#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 /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int strlen(char *);
void stampa(void) {
  FILE *VoliAggiornatiPtr;
  FILE *VoliPtr;
  char buffer[80];
  if ((VoliPtr = fopen("Voli.txt", "r")) != NULL) {
    if ((VoliAggiornatiPtr = fopen("VoliAggiornati.txt", "r")) != NULL) {
      while (!feof(VoliPtr)) {
        fgets(buffer, 80, VoliPtr);
        printf("%s", buffer);
        if ((buffer[strlen(buffer) - 1]) != '\n') {
          puts("");
        }
        fgets(buffer, 80, VoliAggiornatiPtr);
        printf("%s\n", buffer);
        if ((buffer[strlen(buffer) - 1]) != '\n') {
          puts("");
        }
      }
    } else {
      printf("Attenzione non e' stato possibile aprire il file: %s\n",
             "VoliAggiornati.txt");
    }
  } else {
    printf("Attenzione non e' stato possibile aprire il file: %s\n",
           "Voli.txt");
  }
  return;
}


x86 assembly (clang, -O0):
<stampa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    0xe91(%rip),%rdi
lea    0xe93(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1283 <stampa+0x123>
lea    0xe7b(%rip),%rdi
lea    0xe72(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x8(%rbp)
cmp    $0x0,%rax
je     126b <stampa+0x10b>
jmp    11af <stampa+0x4f>
mov    -0x10(%rbp),%rdi
call   1070 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11cd <stampa+0x6d>
jmp    1266 <stampa+0x106>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x50,%esi
call   1060 <fgets@plt>
lea    -0x60(%rbp),%rsi
lea    0xe34(%rip),%rdi
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0xa,%eax
je     1217 <stampa+0xb7>
lea    0xe44(%rip),%rdi
call   1030 <puts@plt>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x50,%esi
call   1060 <fgets@plt>
lea    -0x60(%rbp),%rsi
lea    0xe1f(%rip),%rdi
call   1050 <printf@plt>
lea    -0x60(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0xa,%eax
je     1261 <stampa+0x101>
lea    0xdfa(%rip),%rdi
call   1030 <puts@plt>
jmp    11af <stampa+0x4f>
jmp    127e <stampa+0x11e>
lea    0xdaf(%rip),%rdi
lea    0xd92(%rip),%rsi
call   1050 <printf@plt>
jmp    1296 <stampa+0x136>
lea    0xd97(%rip),%rdi
lea    0xd6f(%rip),%rsi
call   1050 <printf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stampa>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x50,%rsp
lea    0xe8c(%rip),%rbx
lea    0xe8e(%rip),%rsi
mov    %rbx,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     11c3 <stampa+0x63>
mov    %rax,%r15
lea    0xe79(%rip),%rbx
lea    0xe70(%rip),%rsi
mov    %rbx,%rdi
call   1080 <fopen@plt>
test   %rax,%rax
je     11c3 <stampa+0x63>
mov    %rax,%r14
mov    %r15,%rdi
call   1070 <feof@plt>
test   %eax,%eax
je     11df <stampa+0x7f>
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
lea    0xe57(%rip),%rdi
mov    %rbx,%rsi
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1050 <printf@plt>
mov    %rsp,%rbx
lea    0xe35(%rip),%r12
lea    0xe63(%rip),%r13
jmp    120c <stampa+0xac>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r15,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    11b5 <stampa+0x55>
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
je     1242 <stampa+0xe2>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
mov    $0x50,%esi
mov    %r14,%rdx
call   1060 <fgets@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
je     1200 <stampa+0xa0>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1200 <stampa+0xa0>

LLVM IR (-O0):
@.str = [9 x i8] c"Voli.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"VoliAggiornati.txt\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [1 x i8] zeroinitializer
@.str.5 = [4 x i8] c"%s\0A\00"
@.str.6 = [54 x i8] c"Attenzione non e' stato possibile aprire il file: %s\0A\00"
define void @stampa() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca [80 x i8]
%4 = call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %2
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %52
6: ; preds = %0
%7 = call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %7, i32** %1
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %49
9: ; preds = %6
br label %10
10: ; preds = %47, %9
%11 = load i32*, i32** %2
%12 = call i32 @feof(i32* %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br i1 %14, label %15, label %48
15: ; preds = %10
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%17 = load i32*, i32** %2
%18 = call i32 @fgets(i8* %16, i32 80, i32* %17)
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%22 = call i32 @strlen(i8* %21)
%23 = sub nsw i32 %22, 1
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %27, 10
br i1 %28, label %29, label %31
29: ; preds = %15
%30 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %31
31: ; preds = %29, %15
%32 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%33 = load i32*, i32** %1
%34 = call i32 @fgets(i8* %32, i32 80, i32* %33)
%35 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %35)
%37 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%38 = call i32 @strlen(i8* %37)
%39 = sub nsw i32 %38, 1
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp ne i32 %43, 10
br i1 %44, label %45, label %47
45: ; preds = %31
%46 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
br label %47
47: ; preds = %45, %31
br label %10
48: ; preds = %10
br label %51
49: ; preds = %6
%50 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %51
51: ; preds = %49, %48
br label %54
52: ; preds = %0
%53 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %54
54: ; preds = %52, %51
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"Voli.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"VoliAggiornati.txt\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.5 = [4 x i8] c"%s\0A\00"
@.str.6 = [54 x i8] c"Attenzione non e' stato possibile aprire il file: %s\0A\00"
define void @stampa() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %36, label %5
5: ; preds = %0
%6 = tail call i32* @fopen(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %36, label %8
8: ; preds = %5
%9 = call i32 @feof(i32* %3)
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %39
11: ; preds = %8, %33
%12 = call i32 @fgets(i8* %2, i32 80, i32* %3)
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%14 = call i32 @strlen(i8* %2)
%15 = add nsw i32 %14, -1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %16
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 10
br i1 %19, label %22, label %20
20: ; preds = %11
%21 = call i32 @putchar(i32 10)
br label %22
22: ; preds = %20, %11
%23 = call i32 @fgets(i8* %2, i32 80, i32* %6)
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %2)
%25 = call i32 @strlen(i8* %2)
%26 = add nsw i32 %25, -1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 10
br i1 %30, label %33, label %31
31: ; preds = %22
%32 = call i32 @putchar(i32 10)
br label %33
33: ; preds = %31, %22
%34 = call i32 @feof(i32* %3)
%35 = icmp eq i32 %34, 0
br i1 %35, label %11, label %39
36: ; preds = %0, %5
%37 = phi i8* [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %0 ]
%38 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.6, i64 0, i64 0), i8* %37)
br label %39
39: ; preds = %33, %36, %8
ret void
}