#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 a = 0, b = 0, c = 0, d = 0, temp, cou1, cou2;
  scanf("%d%d%d%d", &a, &b, &c, &d);
  cou1 = c - a;
  cou2 = d - b;
  if (cou1 < 0) {
    cou1 += 24;
  }
  if (cou2 < 0) {
    cou2 += 60;
    cou1--;
  }
  if (a == c && b == d) {
    printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n", 24, 0);
  } else {
    printf("O JOGO DUROU %d HORA(S) E %d MINUTO(S)\n", cou1, cou2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xeae(%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,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    118c <main+0x6c>
mov    -0x1c(%rbp),%eax
add    $0x18,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    11a8 <main+0x88>
mov    -0x20(%rbp),%eax
add    $0x3c,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    11d8 <main+0xb8>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    11d8 <main+0xb8>
lea    0xe42(%rip),%rdi
mov    $0x18,%esi
xor    %edx,%edx
call   1030 <printf@plt>
jmp    11ea <main+0xca>
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe24(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xeb5(%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
mov    0x8(%rsp),%esi
mov    0x10(%rsp),%ecx
sub    0x14(%rsp),%eax
jne    118a <main+0x6a>
cmp    %ecx,%esi
jne    118a <main+0x6a>
lea    0xe88(%rip),%rdi
mov    $0x18,%esi
xor    %edx,%edx
jmp    11a8 <main+0x88>
sub    %ecx,%esi
lea    0x3c(%rsi),%edx
test   %esi,%esi
cmovns %esi,%edx
lea    0x18(%rax),%ecx
test   %eax,%eax
cmovns %eax,%ecx
sar    $0x1f,%esi
add    %ecx,%esi
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str = [9 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*
store i32 0, i32* %1
%6 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%7 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%8 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 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 eq i32 %10, %11
%17 = icmp eq i32 %13, %14
%18 = select i1 %16, i1 %17, i1 false
br i1 %18, label %19, label %21
19: ; preds = %0
%20 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 24, i32 0)
br label %31
21: ; preds = %0
%22 = icmp slt i32 %15, 0
%23 = add nsw i32 %15, 60
%24 = select i1 %22, i32 %23, i32 %15
%25 = icmp slt i32 %12, 0
%26 = add nsw i32 %12, 24
%27 = select i1 %25, i32 %26, i32 %12
%28 = ashr i32 %15, 31
%29 = add nsw i32 %28, %27
%30 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %29, i32 %24)
br label %31
31: ; preds = %21, %19
ret i32 0
}