#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int n;
  int h, m;
  int r;
  printf("Ler arquivo (c) 2015.\n");
  FILE *entrada = fopen("aparelho.txt", "r");
  while (!feof(entrada)) {
    r = fscanf(entrada, "%i", &n);
    if (r == 1) {
      h = n / 60;
      m = n % 60;
      printf("r=%i h=%i m=%i\n", r, h, m);
    } else {
      char dummy[100];
      fscanf(entrada, "%s", dummy);
    }
  }
  fclose(entrada);
  printf("*FIM*\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea0(%rip),%rdi
lea    0xea6(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11a5 <main+0x55>
jmp    121e <main+0xce>
mov    -0x20(%rbp),%rdi
lea    0xe76(%rip),%rsi
lea    -0x8(%rbp),%rdx
mov    $0x0,%al
call   1050 <fscanf@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    1200 <main+0xb0>
mov    -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x14(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1219 <main+0xc9>
mov    -0x20(%rbp),%rdi
lea    -0x90(%rbp),%rdx
lea    0xe27(%rip),%rsi
mov    $0x0,%al
call   1050 <fscanf@plt>
jmp    1187 <main+0x37>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7f(%rip),%rdi
lea    0xe85(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <feof@plt>
test   %eax,%eax
je     11c1 <main+0x61>
mov    %rbx,%rdi
call   1040 <fclose@plt>
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe47(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xe3e(%rip),%r12
lea    0xe47(%rip),%r13
lea    0x10(%rsp),%rbp
jmp    120c <main+0xac>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1060 <fscanf@plt>
mov    %rbx,%rdi
call   1070 <feof@plt>
test   %eax,%eax
jne    119c <main+0x3c>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1060 <fscanf@plt>
cmp    $0x1,%eax
jne    11f0 <main+0x90>
movslq 0xc(%rsp),%rcx
imul   $0xffffffff88888889,%rcx,%rdx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%eax
shr    $0x1f,%eax
sar    $0x5,%edx
add    %eax,%edx
imul   $0x3c,%edx,%eax
sub    %eax,%ecx
mov    %r12,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1200 <main+0xa0>

LLVM IR (-O0):
@.str = [23 x i8] c"Ler arquivo (c) 2015.\0A\00"
@.str.1 = [13 x i8] c"aparelho.txt\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [3 x i8] c"%i\00"
@.str.4 = [16 x i8] c"r=%i h=%i m=%i\0A\00"
@.str.5 = [3 x i8] c"%s\00"
@.str.6 = [7 x i8] c"*FIM*\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
%7 = alloca [100 x i8]
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%9 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %9, i32** %6
br label %10
10: ; preds = %33, %0
%11 = load i32*, i32** %6
%12 = call i32 @feof(i32* %11)
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
br i1 %14, label %15, label %34
15: ; preds = %10
%16 = load i32*, i32** %6
%17 = call i32 (i32*, i8*, ...) @fscanf(i32* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %29
20: ; preds = %15
%21 = load i32, i32* %2
%22 = sdiv i32 %21, 60
store i32 %22, i32* %3
%23 = load i32, i32* %2
%24 = srem i32 %23, 60
store i32 %24, i32* %4
%25 = load i32, i32* %5
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %25, i32 %26, i32 %27)
br label %33
29: ; preds = %15
%30 = load i32*, i32** %6
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%32 = call i32 (i32*, i8*, ...) @fscanf(i32* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %29, %20
br label %10
34: ; preds = %10
%35 = load i32*, i32** %6
%36 = call i32 @fclose(i32* %35)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [13 x i8] c"aparelho.txt\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [3 x i8] c"%i\00"
@.str.4 = [16 x i8] c"r=%i h=%i m=%i\0A\00"
@.str.5 = [3 x i8] c"%s\00"
@str = [22 x i8] c"Ler arquivo (c) 2015.\00"
@str.7 = [6 x i8] c"*FIM*\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32 @feof(i32* %5)
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %23
8: ; preds = %0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
br label %10
10: ; preds = %8, %20
%11 = call i32 (i32*, i8*, ...) @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i32, i32* %1
%15 = sdiv i32 %14, 60
%16 = srem i32 %14, 60
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 1, i32 %15, i32 %16)
br label %20
18: ; preds = %10
%19 = call i32 (i32*, i8*, ...) @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %9)
br label %20
20: ; preds = %18, %13
%21 = call i32 @feof(i32* %5)
%22 = icmp eq i32 %21, 0
br i1 %22, label %10, label %23
23: ; preds = %20, %0
%24 = call i32 @fclose(i32* %5)
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.7, i64 0, i64 0))
ret i32 0
}