#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 ler_acessos(int *, int *);
int mais_tempo(int *, int);
int /*<<< orphan*/ printf(char *, int, ...);
int main() {
  int id[100], tempo[100];
  int numAcessos = ler_acessos(id, tempo);
  int iMaior = mais_tempo(tempo, numAcessos);
  printf("Total de acessos: %d\n", numAcessos);
  printf("Carro que permaneceu mais tempo: %d (%d minutos)\n", id[iMaior],
         tempo[iMaior]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x1a0(%rbp),%rdi
lea    -0x330(%rbp),%rsi
call   1050 <ler_acessos@plt>
mov    %eax,-0x334(%rbp)
lea    -0x330(%rbp),%rdi
mov    -0x334(%rbp),%esi
call   1030 <mais_tempo@plt>
mov    %eax,-0x338(%rbp)
mov    -0x334(%rbp),%esi
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movslq -0x338(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%esi
movslq -0x338(%rbp),%rax
mov    -0x330(%rbp,%rax,4),%edx
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x328,%rsp
lea    0x190(%rsp),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <ler_acessos@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <mais_tempo@plt>
mov    %eax,%ebx
lea    0xe9f(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq %ebx,%rax
mov    0x190(%rsp,%rax,4),%esi
mov    (%rsp,%rax,4),%edx
lea    0xe98(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x328,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Total de acessos: %d\0A\00"
@.str.1 = [50 x i8] c"Carro que permaneceu mais tempo: %d (%d minutos)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca [100 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%7 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
%8 = call i32 @ler_acessos(i32* %6, i32* %7)
store i32 %8, i32* %4
%9 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
%10 = load i32, i32* %4
%11 = call i32 @mais_tempo(i32* %9, i32 %10)
store i32 %11, i32* %5
%12 = load i32, i32* %4
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Total de acessos: %d\0A\00"
@.str.1 = [50 x i8] c"Carro que permaneceu mais tempo: %d (%d minutos)\0A\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = alloca [100 x i32]
%3 = bitcast [100 x i32]* %1 to i8*
%4 = bitcast [100 x i32]* %2 to i8*
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%7 = call i32 @ler_acessos(i32* %5, i32* %6)
%8 = call i32 @mais_tempo(i32* %6, i32 %7)
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %7)
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %10
%12 = load i32, i32* %11
%13 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %10
%14 = load i32, i32* %13
%15 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %14)
ret i32 0
}