#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, int);
int /*<<< orphan*/ scanf(char *, int *, int *, int *, int *);
int main(void) {
  int horaInicial, minutoInicial, horaFinal, minutoFinal, horaDelta,
      minutoDelta;
  scanf("%d %d %d %d", &horaInicial, &minutoInicial, &horaFinal, &minutoFinal);
  if (horaInicial < horaFinal) {
    horaDelta = horaFinal - horaInicial;
  } else {
    horaDelta = 24 - (horaInicial - horaFinal);
  }
  if (minutoInicial <= minutoFinal) {
    minutoDelta = minutoFinal - minutoInicial;
  } else {
    minutoDelta = 60 - (minutoInicial - minutoFinal);
    horaDelta -= 1;
  }
  printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n", horaDelta, minutoDelta);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1165 <main+0x45>
mov    -0x10(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1175 <main+0x55>
mov    -0x8(%rbp),%ecx
sub    -0x10(%rbp),%ecx
mov    $0x18,%eax
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     118f <main+0x6f>
mov    -0x14(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    11a8 <main+0x88>
mov    -0xc(%rbp),%ecx
sub    -0x14(%rbp),%ecx
mov    $0x3c,%eax
sub    %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1040 <scanf@plt>
mov    0x8(%rsp),%edx
mov    0x10(%rsp),%eax
mov    %edx,%ecx
sub    %eax,%ecx
add    $0x3c,%ecx
xor    %edi,%edi
sub    %eax,%edx
mov    0xc(%rsp),%esi
mov    0x14(%rsp),%eax
setl   %dil
cmovl  %ecx,%edx
mov    %esi,%ecx
sub    %eax,%ecx
add    $0x18,%ecx
sub    %eax,%esi
cmovle %ecx,%esi
sub    %edi,%esi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%d %d %d %d\00"
@.str.1 = [40 x i8] c"O JOGO DUROU %d HORA(S) E %d MINUTO(S)\0A\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
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
%9 = load i32, i32* %2
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %16
12: ; preds = %0
%13 = load i32, i32* %4
%14 = load i32, i32* %2
%15 = sub nsw i32 %13, %14
store i32 %15, i32* %6
br label %21
16: ; preds = %0
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = sub nsw i32 %17, %18
%20 = sub nsw i32 24, %19
store i32 %20, i32* %6
br label %21
21: ; preds = %16, %12
%22 = load i32, i32* %3
%23 = load i32, i32* %5
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = load i32, i32* %5
%27 = load i32, i32* %3
%28 = sub nsw i32 %26, %27
store i32 %28, i32* %7
br label %36
29: ; preds = %21
%30 = load i32, i32* %3
%31 = load i32, i32* %5
%32 = sub nsw i32 %30, %31
%33 = sub nsw i32 60, %32
store i32 %33, i32* %7
%34 = load i32, i32* %6
%35 = sub nsw i32 %34, 1
store i32 %35, i32* %6
br label %36
36: ; preds = %29, %25
%37 = load i32, i32* %6
%38 = load i32, i32* %7
%39 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %37, i32 %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"%d %d %d %d\00"
@.str.1 = [40 x i8] c"O JOGO DUROU %d HORA(S) E %d MINUTO(S)\0A\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 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %1
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, %10
%13 = sub i32 %11, %10
%14 = add i32 %13, 24
%15 = select i1 %12, i32 %13, i32 %14
%16 = load i32, i32* %2
%17 = load i32, i32* %4
%18 = icmp slt i32 %17, %16
%19 = sub i32 %17, %16
%20 = add i32 %19, 60
%21 = sext i1 %18 to i32
%22 = add nsw i32 %15, %21
%23 = select i1 %18, i32 %20, i32 %19
%24 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %22, i32 %23)
ret i32 0
}