#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 atoi(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int n;
  int r;
  printf("Ler arquivo (c) 2015.\n");
  FILE *entrada = fopen("aparelho.txt", "r");
  char linha[100];
  while (fgets(linha, 100, entrada) != NULL) {
    n = atoi(linha);
    if (n != 0) {
      printf("%02i:%02i\n", n / 60, n % 60);
    }
  }
  fclose(entrada);
  printf("*FIM*\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%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   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x64,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     11e4 <main+0x94>
lea    -0x80(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11df <main+0x8f>
mov    -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1187 <main+0x37>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe3d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
lea    0xe84(%rip),%rdi
lea    0xe8a(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
mov    %rsp,%rdi
mov    $0x64,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     11fe <main+0x9e>
mov    %rsp,%rbx
lea    0xe65(%rip),%r15
jmp    11c5 <main+0x65>
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r14,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     11fe <main+0x9e>
mov    %rbx,%rdi
call   1080 <atoi@plt>
test   %eax,%eax
je     11b0 <main+0x50>
movslq %eax,%rcx
imul   $0xffffffff88888889,%rcx,%rsi
shr    $0x20,%rsi
add    %eax,%esi
mov    %esi,%ecx
shr    $0x1f,%ecx
sar    $0x5,%esi
add    %ecx,%esi
imul   $0x3c,%esi,%ecx
sub    %ecx,%eax
mov    %r15,%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11b0 <main+0x50>
mov    %r14,%rdi
call   1040 <fclose@plt>
lea    0xe23(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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 = [11 x i8] c"%02i:%02i\0A\00"
@.str.4 = [7 x i8] c"*FIM*\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca [100 x i8]
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = 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* %7, i32** %4
br label %8
8: ; preds = %24, %0
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%10 = load i32*, i32** %4
%11 = call i32* @fgets(i8* %9, i32 100, i32* %10)
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %25
13: ; preds = %8
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %13
%19 = load i32, i32* %2
%20 = sdiv i32 %19, 60
%21 = load i32, i32* %2
%22 = srem i32 %21, 60
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %20, i32 %22)
br label %24
24: ; preds = %18, %13
br label %8
25: ; preds = %8
%26 = load i32*, i32** %4
%27 = call i32 @fclose(i32* %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, 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 = [11 x i8] c"%02i:%02i\0A\00"
@str = [22 x i8] c"Ler arquivo (c) 2015.\00"
@str.5 = [6 x i8] c"*FIM*\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%3 = 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))
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = call i32* @fgets(i8* %4, i32 100, i32* %3)
%6 = icmp eq i32* %5, null
br i1 %6, label %17, label %7
7: ; preds = %0, %14
%8 = call i32 @atoi(i8* %4)
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = sdiv i32 %8, 60
%12 = srem i32 %8, 60
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %11, i32 %12)
br label %14
14: ; preds = %10, %7
%15 = call i32* @fgets(i8* %4, i32 100, i32* %3)
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %7
17: ; preds = %14, %0
%18 = call i32 @fclose(i32* %3)
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}