#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() {
  int beginningHour, beginningMinute;
  int endingHour, endingMinute;
  int durationHour, durationMinute;
  scanf("%d %d %d %d", &beginningHour, &beginningMinute, &endingHour,
        &endingMinute);
  durationHour = endingHour - beginningHour;
  durationMinute = endingMinute - beginningMinute;
  if (durationMinute < 0) {
    durationMinute += 60;
    durationHour -= 1;
  }
  if (durationHour <= 0) {
    durationHour += 24;
  }
  if (durationHour == 24 && durationMinute > 0) {
    durationHour = 0;
  }
  printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n", durationHour,
         durationMinute);
  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    -0x10(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1179 <main+0x59>
mov    -0x1c(%rbp),%eax
add    $0x3c,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jg     118c <main+0x6c>
mov    -0x18(%rbp),%eax
add    $0x18,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x18,-0x18(%rbp)
jne    11a7 <main+0x87>
cmpl   $0x0,-0x1c(%rbp)
jle    11a7 <main+0x87>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe58(%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    0xc(%rsp),%eax
sub    0x14(%rsp),%eax
mov    0x8(%rsp),%ecx
sub    0x10(%rsp),%ecx
lea    0x3c(%rcx),%edx
mov    %ecx,%esi
sar    $0x1f,%esi
lea    (%rsi,%rax,1),%edi
test   %ecx,%ecx
cmovns %ecx,%edx
test   %edi,%edi
lea    0x18(%rsi,%rax,1),%eax
cmovg  %edi,%eax
xor    %ecx,%ecx
cmp    $0x18,%eax
mov    %eax,%esi
cmove  %ecx,%esi
test   %edx,%edx
cmovle %eax,%esi
lea    0xe89(%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* %4
%10 = load i32, i32* %2
%11 = sub nsw i32 %9, %10
store i32 %11, i32* %6
%12 = load i32, i32* %5
%13 = load i32, i32* %3
%14 = sub nsw i32 %12, %13
store i32 %14, i32* %7
%15 = load i32, i32* %7
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %0
%18 = load i32, i32* %7
%19 = add nsw i32 %18, 60
store i32 %19, i32* %7
%20 = load i32, i32* %6
%21 = sub nsw i32 %20, 1
store i32 %21, i32* %6
br label %22
22: ; preds = %17, %0
%23 = load i32, i32* %6
%24 = icmp sle i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 24
store i32 %27, i32* %6
br label %28
28: ; preds = %25, %22
%29 = load i32, i32* %6
%30 = icmp eq i32 %29, 24
br i1 %30, label %31, label %35
31: ; preds = %28
%32 = load i32, i32* %7
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %31
store i32 0, i32* %6
br label %35
35: ; preds = %34, %31, %28
%36 = load i32, i32* %6
%37 = load i32, i32* %7
%38 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %36, i32 %37)
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* %3
%11 = load i32, i32* %1
%12 = sub nsw i32 %10, %11
%13 = load i32, i32* %4
%14 = load i32, i32* %2
%15 = sub nsw i32 %13, %14
%16 = icmp slt i32 %15, 0
%17 = add nsw i32 %15, 60
%18 = ashr i32 %15, 31
%19 = add nsw i32 %18, %12
%20 = select i1 %16, i32 %17, i32 %15
%21 = icmp slt i32 %19, 1
%22 = add nsw i32 %19, 24
%23 = select i1 %21, i32 %22, i32 %19
%24 = icmp eq i32 %23, 24
%25 = icmp sgt i32 %20, 0
%26 = and i1 %25, %24
%27 = select i1 %26, i32 0, i32 %23
%28 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %27, i32 %20)
ret i32 0
}