#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int h1, min1, h2, min2, th, tm;
  float valor;
  printf("Digite a hora e minuto da chegada:\n ");
  printf("Hora: ");
  scanf("%d", &h1);
  printf("Minuto: ");
  scanf("%d", &min1);
  printf("Digite a hora e minuto da Saída:\n");
  printf("Hora: ");
  scanf("%d", &h2);
  printf("Minuto: ");
  scanf("%d", &min2);
  if (h2 > h1) {
    th = h2 - h1;
  }
  if (min2 > min1) {
    tm = min2 - min1;
  }
  if ((th * 60 + tm) % 60 != 0) {
    th += 1;
  }
  if (th <= 2) {
    valor = th * 1;
  }
  if (th > 2 && th <= 4) {
    valor = th * 1.4;
  }
  if (th > 4) {
    valor = th * 2;
  }
  printf("Custo do estacionamento: R$ %.2f (%dh)", valor, th);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7a(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11d8 <main+0xb8>
mov    -0x10(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11ed <main+0xcd>
mov    -0x14(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
imul   $0x3c,-0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     120e <main+0xee>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x2,-0x18(%rbp)
jg     1227 <main+0x107>
mov    -0x18(%rbp),%eax
shl    $0x0,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x20(%rbp)
cmpl   $0x2,-0x18(%rbp)
jle    1255 <main+0x135>
cmpl   $0x4,-0x18(%rbp)
jg     1255 <main+0x135>
cvtsi2sdl -0x18(%rbp),%xmm0
movsd  0xdb8(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
cmpl   $0x4,-0x18(%rbp)
jle    126e <main+0x14e>
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x18(%rbp),%esi
lea    0xde2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xedf(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed5(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xec4(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
sub    0xc(%rsp),%esi
mov    (%rsp),%eax
sub    0x8(%rsp),%eax
imul   $0x3c,%esi,%ecx
add    %eax,%ecx
imul   $0xeeeeeeef,%ecx,%eax
add    $0x8888888,%eax
ror    $0x2,%eax
cmp    $0x4444445,%eax
sbb    $0xffffffff,%esi
lea    -0x3(%rsi),%eax
cmp    $0x2,%eax
jb     11ff <main+0xcf>
cvtsi2ss %esi,%xmm0
cmp    $0x5,%esi
jge    1214 <main+0xe4>
jmp    121e <main+0xee>
cvtsi2sd %esi,%xmm0
mulsd  0xdf5(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cmp    $0x5,%esi
jl     121e <main+0xee>
lea    (%rsi,%rsi,1),%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe17(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Digite a hora e minuto da chegada:\0A \00"
@.str.1 = [7 x i8] c"Hora: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [9 x i8] c"Minuto: \00"
@.str.4 = [35 x i8] c"Digite a hora e minuto da Sa\C3\ADda:\0A\00"
@.str.5 = [39 x i8] c"Custo do estacionamento: R$ %.2f (%dh)\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca float
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%19 = load i32, i32* %4
%20 = load i32, i32* %2
%21 = icmp sgt i32 %19, %20
br i1 %21, label %22, label %26
22: ; preds = %0
%23 = load i32, i32* %4
%24 = load i32, i32* %2
%25 = sub nsw i32 %23, %24
store i32 %25, i32* %6
br label %26
26: ; preds = %22, %0
%27 = load i32, i32* %5
%28 = load i32, i32* %3
%29 = icmp sgt i32 %27, %28
br i1 %29, label %30, label %34
30: ; preds = %26
%31 = load i32, i32* %5
%32 = load i32, i32* %3
%33 = sub nsw i32 %31, %32
store i32 %33, i32* %7
br label %34
34: ; preds = %30, %26
%35 = load i32, i32* %6
%36 = mul nsw i32 %35, 60
%37 = load i32, i32* %7
%38 = add nsw i32 %36, %37
%39 = srem i32 %38, 60
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %34
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
store i32 %43, i32* %6
br label %44
44: ; preds = %41, %34
%45 = load i32, i32* %6
%46 = icmp sle i32 %45, 2
br i1 %46, label %47, label %51
47: ; preds = %44
%48 = load i32, i32* %6
%49 = mul nsw i32 %48, 1
%50 = sitofp i32 %49 to float
store float %50, float* %8
br label %51
51: ; preds = %47, %44
%52 = load i32, i32* %6
%53 = icmp sgt i32 %52, 2
br i1 %53, label %54, label %62
54: ; preds = %51
%55 = load i32, i32* %6
%56 = icmp sle i32 %55, 4
br i1 %56, label %57, label %62
57: ; preds = %54
%58 = load i32, i32* %6
%59 = sitofp i32 %58 to double
%60 = fmul double %59, 1.400000e+00
%61 = fptrunc double %60 to float
store float %61, float* %8
br label %62
62: ; preds = %57, %54, %51
%63 = load i32, i32* %6
%64 = icmp sgt i32 %63, 4
br i1 %64, label %65, label %69
65: ; preds = %62
%66 = load i32, i32* %6
%67 = mul nsw i32 %66, 2
%68 = sitofp i32 %67 to float
store float %68, float* %8
br label %69
69: ; preds = %65, %62
%70 = load float, float* %8
%71 = fpext float %70 to double
%72 = load i32, i32* %6
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), double %71, i32 %72)
ret i32 0
}

LLVM IR (-O2):
@.str = [37 x i8] c"Digite a hora e minuto da chegada:\0A \00"
@.str.1 = [7 x i8] c"Hora: \00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [9 x i8] c"Minuto: \00"
@.str.5 = [39 x i8] c"Custo do estacionamento: R$ %.2f (%dh)\00"
@str = [34 x i8] c"Digite a hora e minuto da Sa\C3\ADda:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%19 = load i32, i32* %3
%20 = load i32, i32* %1
%21 = icmp sgt i32 %19, %20
%22 = sub nsw i32 %19, %20
%23 = select i1 %21, i32 %22, i32 undef
%24 = load i32, i32* %4
%25 = load i32, i32* %2
%26 = icmp sgt i32 %24, %25
%27 = sub nsw i32 %24, %25
%28 = select i1 %26, i32 %27, i32 undef
%29 = mul nsw i32 %23, 60
%30 = add nsw i32 %28, %29
%31 = srem i32 %30, 60
%32 = icmp ne i32 %31, 0
%33 = zext i1 %32 to i32
%34 = add nsw i32 %23, %33
%35 = sitofp i32 %34 to float
%36 = add i32 %34, -3
%37 = icmp ult i32 %36, 2
%38 = sitofp i32 %34 to double
%39 = fmul double %38, 1.400000e+00
%40 = fptrunc double %39 to float
%41 = select i1 %37, float %40, float %35
%42 = icmp sgt i32 %34, 4
%43 = shl nsw i32 %34, 1
%44 = sitofp i32 %43 to float
%45 = select i1 %42, float %44, float %41
%46 = fpext float %45 to double
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0), double %46, i32 %34)
ret i32 0
}