#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 */

/* Variables and functions */
int scanf(char *, int *, int *);
int ler_acessos(int *tempos) {
  int count = 0;
  int saidaAnterior = -190;
  for (;;) {
    int entrada, saida;
    if (scanf("%d %d", &entrada, &saida) < 2) {
      break;
    }
    if (entrada - saidaAnterior < 120) {
      tempos[count - 1] += saida - saidaAnterior;
    } else {
      tempos[count++] = saida - entrada;
    }
    saidaAnterior = saida;
  }
  return count;
}


x86 assembly (clang, -O0):
<ler_acessos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0xffffff42,-0x10(%rbp)
lea    0xecf(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1030 <scanf@plt>
cmp    $0x2,%eax
jge    114c <ler_acessos+0x3c>
jmp    119f <ler_acessos+0x8f>
mov    -0x14(%rbp),%eax
sub    -0x10(%rbp),%eax
cmp    $0x78,%eax
jge    1179 <ler_acessos+0x69>
mov    -0x18(%rbp),%edx
sub    -0x10(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
add    (%rax,%rcx,4),%edx
mov    %edx,(%rax,%rcx,4)
jmp    1194 <ler_acessos+0x84>
mov    -0x18(%rbp),%edx
sub    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0xc(%rbp)
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    112a <ler_acessos+0x1a>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ler_acessos>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r13
lea    0xedb(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1030 <scanf@plt>
xor    %ebp,%ebp
cmp    $0x2,%eax
jge    114a <ler_acessos+0x3a>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
mov    $0xffffff42,%ecx
lea    0xea8(%rip),%r14
lea    0x4(%rsp),%r15
mov    %rsp,%r12
jmp    1194 <ler_acessos+0x84>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%ecx
sub    %eax,%ecx
movslq %ebp,%rax
add    $0x1,%ebp
mov    %ecx,0x0(%r13,%rax,4)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
call   1030 <scanf@plt>
mov    %ebx,%ecx
cmp    $0x1,%eax
jle    1139 <ler_acessos+0x29>
mov    0x4(%rsp),%eax
mov    %eax,%edx
sub    %ecx,%edx
mov    (%rsp),%ebx
cmp    $0x77,%edx
jg     1170 <ler_acessos+0x60>
mov    %ebx,%eax
sub    %ecx,%eax
movslq %ebp,%rcx
add    %eax,-0x4(%r13,%rcx,4)
jmp    117f <ler_acessos+0x6f>

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
define i32 @ler_acessos(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
store i32 -190, i32* %4
br label %7
7: ; preds = %36, %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %6)
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %11
10: ; preds = %7
br label %38
11: ; preds = %7
%12 = load i32, i32* %5
%13 = load i32, i32* %4
%14 = sub nsw i32 %12, %13
%15 = icmp slt i32 %14, 120
br i1 %15, label %16, label %27
16: ; preds = %11
%17 = load i32, i32* %6
%18 = load i32, i32* %4
%19 = sub nsw i32 %17, %18
%20 = load i32*, i32** %2
%21 = load i32, i32* %3
%22 = sub nsw i32 %21, 1
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %20, i64 %23
%25 = load i32, i32* %24
%26 = add nsw i32 %25, %19
store i32 %26, i32* %24
br label %36
27: ; preds = %11
%28 = load i32, i32* %6
%29 = load i32, i32* %5
%30 = sub nsw i32 %28, %29
%31 = load i32*, i32** %2
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
%34 = sext i32 %32 to i64
%35 = getelementptr inbounds i32, i32* %31, i64 %34
store i32 %30, i32* %35
br label %36
36: ; preds = %27, %16
%37 = load i32, i32* %6
store i32 %37, i32* %4
br label %7
38: ; preds = %10
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
define i32 @ler_acessos(i32* nocapture %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%7 = icmp slt i32 %6, 2
br i1 %7, label %31, label %8
8: ; preds = %1, %27
%9 = phi i32 [ %14, %27 ], [ -190, %1 ]
%10 = phi i32 [ %28, %27 ], [ 0, %1 ]
%11 = load i32, i32* %2
%12 = sub nsw i32 %11, %9
%13 = icmp slt i32 %12, 120
%14 = load i32, i32* %3
br i1 %13, label %15, label %22
15: ; preds = %8
%16 = sub i32 %14, %9
%17 = add nsw i32 %10, -1
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i32, i32* %0, i64 %18
%20 = load i32, i32* %19
%21 = add nsw i32 %16, %20
store i32 %21, i32* %19
br label %27
22: ; preds = %8
%23 = sub nsw i32 %14, %11
%24 = add nsw i32 %10, 1
%25 = sext i32 %10 to i64
%26 = getelementptr inbounds i32, i32* %0, i64 %25
store i32 %23, i32* %26
br label %27
27: ; preds = %15, %22
%28 = phi i32 [ %10, %15 ], [ %24, %22 ]
%29 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%30 = icmp slt i32 %29, 2
br i1 %30, label %31, label %8
31: ; preds = %27, %1
%32 = phi i32 [ 0, %1 ], [ %28, %27 ]
ret i32 %32
}