#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*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, int *);
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) {
    r = sscanf(linha, "%i", &n);
    if (r == 1) {
      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   1070 <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     11ef <main+0x9f>
lea    -0x80(%rbp),%rdi
lea    0xe78(%rip),%rsi
lea    -0x8(%rbp),%rdx
call   1060 <sscanf@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    11ea <main+0x9a>
mov    -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1187 <main+0x37>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe35(%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   %r13
push   %r12
push   %rbx
sub    $0x80,%rsp
lea    0xea6(%rip),%rdi
call   1030 <puts@plt>
lea    0xe7d(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%r15
lea    0x10(%rsp),%rdi
mov    $0x64,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1225 <main+0xc5>
lea    0xe5f(%rip),%r14
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%r12
lea    0xe51(%rip),%r13
jmp    11e5 <main+0x85>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
mov    $0x64,%esi
mov    %r15,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1225 <main+0xc5>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1070 <sscanf@plt>
cmp    $0x1,%eax
jne    11d0 <main+0x70>
movslq 0xc(%rsp),%rdx
imul   $0xffffffff88888889,%rdx,%rsi
shr    $0x20,%rsi
add    %edx,%esi
mov    %esi,%eax
shr    $0x1f,%eax
sar    $0x5,%esi
add    %eax,%esi
imul   $0x3c,%esi,%eax
sub    %eax,%edx
mov    %r13,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    11d0 <main+0x70>
mov    %r15,%rdi
call   1040 <fclose@plt>
lea    0xdff(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r13
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 = [3 x i8] c"%i\00"
@.str.4 = [11 x i8] c"%02i:%02i\0A\00"
@.str.5 = [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 @sscanf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 1
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.4, 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.5, 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 = [11 x i8] c"%02i:%02i\0A\00"
@str = [22 x i8] c"Ler arquivo (c) 2015.\00"
@str.6 = [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 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%7 = call i32* @fgets(i8* %6, i32 100, i32* %5)
%8 = icmp eq i32* %7, null
br i1 %8, label %20, label %9
9: ; preds = %0, %17
%10 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = load i32, i32* %1
%14 = sdiv i32 %13, 60
%15 = srem i32 %13, 60
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i32 %14, i32 %15)
br label %17
17: ; preds = %12, %9
%18 = call i32* @fgets(i8* %6, i32 100, i32* %5)
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %9
20: ; preds = %17, %0
%21 = call i32 @fclose(i32* %5)
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.6, i64 0, i64 0))
ret i32 0
}