#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 */
typedef scalar_t__ int32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, scalar_t__);
int /*<<< orphan*/ scanf(char *, scalar_t__ *, ...);
int main() {
  int32_t d, dd, h, hh, m, mm, s, ss;
  scanf("Dia %d", &d);
  scanf("%d : %d : %d\n", &h, &m, &s);
  scanf("Dia %d", &dd);
  scanf("%d : %d : %d", &hh, &mm, &ss);
  s = ss - s;
  m = mm - m;
  h = hh - h;
  d = dd - d;
  if (s < 0) {
    s += 60;
    m--;
  }
  if (m < 0) {
    m += 60;
    h--;
  }
  if (h < 0) {
    h += 24;
    d--;
  }
  printf("%d dia(s)\n", d);
  printf("%d hora(s)\n", h);
  printf("%d minuto(s)\n", m);
  printf("%d segundo(s)\n", s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xebf(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x30(%rbp),%rdx
lea    -0x40(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe9e(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xea1(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x38(%rbp),%rdx
lea    -0x48(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x48(%rbp),%rax
sub    -0x40(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
sub    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
sub    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x40(%rbp)
jge    11da <main+0xba>
mov    -0x40(%rbp),%rax
add    $0x3c,%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jge    11fd <main+0xdd>
mov    -0x30(%rbp),%rax
add    $0x3c,%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jge    1220 <main+0x100>
mov    -0x20(%rbp),%rax
add    $0x18,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xdf7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xdf2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xdee(%rip),%rdi
call   1030 <printf@plt>
mov    -0x40(%rbp),%rsi
lea    0xdec(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x40,%rsp
lea    0xed4(%rip),%rbx
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xec5(%rip),%rdi
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
lea    0x10(%rsp),%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0x38(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xea9(%rip),%rdi
lea    0x30(%rsp),%rsi
lea    0x28(%rsp),%rdx
lea    0x20(%rsp),%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x20(%rsp),%rdx
mov    0x28(%rsp),%rcx
sub    (%rsp),%rcx
mov    0x30(%rsp),%rax
sub    0x8(%rsp),%rax
mov    0x38(%rsp),%rsi
sub    0x18(%rsp),%rsi
sub    0x10(%rsp),%rdx
mov    %rdx,0x10(%rsp)
mov    %rcx,(%rsp)
mov    %rax,0x8(%rsp)
mov    %rsi,0x18(%rsp)
js     120e <main+0xee>
test   %rcx,%rcx
js     1224 <main+0x104>
test   %rax,%rax
js     123a <main+0x11a>
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rsp),%rsi
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
mov    (%rsp),%rsi
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
mov    0x10(%rsp),%rsi
lea    0xe46(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
ret
add    $0x3c,%rdx
mov    %rdx,0x10(%rsp)
add    $0xffffffffffffffff,%rcx
mov    %rcx,(%rsp)
test   %rcx,%rcx
jns    11c3 <main+0xa3>
add    $0x3c,%rcx
mov    %rcx,(%rsp)
add    $0xffffffffffffffff,%rax
mov    %rax,0x8(%rsp)
test   %rax,%rax
jns    11c8 <main+0xa8>
add    $0x18,%rax
mov    %rax,0x8(%rsp)
add    $0xffffffffffffffff,%rsi
mov    %rsi,0x18(%rsp)
jmp    11c8 <main+0xa8>

LLVM IR (-O0):
@.str = [7 x i8] c"Dia %d\00"
@.str.1 = [14 x i8] c"%d : %d : %d\0A\00"
@.str.2 = [13 x i8] c"%d : %d : %d\00"
@.str.3 = [11 x i8] c"%d dia(s)\0A\00"
@.str.4 = [12 x i8] c"%d hora(s)\0A\00"
@.str.5 = [14 x i8] c"%d minuto(s)\0A\00"
@.str.6 = [15 x i8] c"%d segundo(s)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i32 0, i32* %1
%10 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64* %2)
%11 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i64* %4, i64* %6, i64* %8)
%12 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64* %3)
%13 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i64* %5, i64* %7, i64* %9)
%14 = load i64, i64* %9
%15 = load i64, i64* %8
%16 = sub nsw i64 %14, %15
store i64 %16, i64* %8
%17 = load i64, i64* %7
%18 = load i64, i64* %6
%19 = sub nsw i64 %17, %18
store i64 %19, i64* %6
%20 = load i64, i64* %5
%21 = load i64, i64* %4
%22 = sub nsw i64 %20, %21
store i64 %22, i64* %4
%23 = load i64, i64* %3
%24 = load i64, i64* %2
%25 = sub nsw i64 %23, %24
store i64 %25, i64* %2
%26 = load i64, i64* %8
%27 = icmp slt i64 %26, 0
br i1 %27, label %28, label %33
28: ; preds = %0
%29 = load i64, i64* %8
%30 = add nsw i64 %29, 60
store i64 %30, i64* %8
%31 = load i64, i64* %6
%32 = add nsw i64 %31, -1
store i64 %32, i64* %6
br label %33
33: ; preds = %28, %0
%34 = load i64, i64* %6
%35 = icmp slt i64 %34, 0
br i1 %35, label %36, label %41
36: ; preds = %33
%37 = load i64, i64* %6
%38 = add nsw i64 %37, 60
store i64 %38, i64* %6
%39 = load i64, i64* %4
%40 = add nsw i64 %39, -1
store i64 %40, i64* %4
br label %41
41: ; preds = %36, %33
%42 = load i64, i64* %4
%43 = icmp slt i64 %42, 0
br i1 %43, label %44, label %49
44: ; preds = %41
%45 = load i64, i64* %4
%46 = add nsw i64 %45, 24
store i64 %46, i64* %4
%47 = load i64, i64* %2
%48 = add nsw i64 %47, -1
store i64 %48, i64* %2
br label %49
49: ; preds = %44, %41
%50 = load i64, i64* %2
%51 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i64 %50)
%52 = load i64, i64* %4
%53 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i64 %52)
%54 = load i64, i64* %6
%55 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i64 %54)
%56 = load i64, i64* %8
%57 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i64 %56)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"Dia %d\00"
@.str.1 = [14 x i8] c"%d : %d : %d\0A\00"
@.str.2 = [13 x i8] c"%d : %d : %d\00"
@.str.3 = [11 x i8] c"%d dia(s)\0A\00"
@.str.4 = [12 x i8] c"%d hora(s)\0A\00"
@.str.5 = [14 x i8] c"%d minuto(s)\0A\00"
@.str.6 = [15 x i8] c"%d segundo(s)\0A\00"
define i32 @main() {
%1 = alloca i64
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = bitcast i64* %1 to i8*
%10 = bitcast i64* %2 to i8*
%11 = bitcast i64* %3 to i8*
%12 = bitcast i64* %4 to i8*
%13 = bitcast i64* %5 to i8*
%14 = bitcast i64* %6 to i8*
%15 = bitcast i64* %7 to i8*
%16 = bitcast i64* %8 to i8*
%17 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64* %1)
%18 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i64* %3, i64* %5, i64* %7)
%19 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64* %2)
%20 = call i32 (i8*, i64*, ...) @scanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i64* %4, i64* %6, i64* %8)
%21 = load i64, i64* %8
%22 = load i64, i64* %7
%23 = sub nsw i64 %21, %22
store i64 %23, i64* %7
%24 = load i64, i64* %6
%25 = load i64, i64* %5
%26 = sub nsw i64 %24, %25
store i64 %26, i64* %5
%27 = load i64, i64* %4
%28 = load i64, i64* %3
%29 = sub nsw i64 %27, %28
store i64 %29, i64* %3
%30 = load i64, i64* %2
%31 = load i64, i64* %1
%32 = sub nsw i64 %30, %31
store i64 %32, i64* %1
%33 = icmp slt i64 %23, 0
br i1 %33, label %34, label %37
34: ; preds = %0
%35 = add nsw i64 %23, 60
store i64 %35, i64* %7
%36 = add nsw i64 %26, -1
store i64 %36, i64* %5
br label %37
37: ; preds = %0, %34
%38 = phi i64 [ %36, %34 ], [ %26, %0 ]
%39 = icmp slt i64 %38, 0
br i1 %39, label %40, label %43
40: ; preds = %37
%41 = add nsw i64 %38, 60
store i64 %41, i64* %5
%42 = add nsw i64 %29, -1
store i64 %42, i64* %3
br label %43
43: ; preds = %37, %40
%44 = phi i64 [ %42, %40 ], [ %29, %37 ]
%45 = icmp slt i64 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = add nsw i64 %44, 24
store i64 %47, i64* %3
%48 = add nsw i64 %32, -1
store i64 %48, i64* %1
br label %49
49: ; preds = %46, %43
%50 = phi i64 [ %48, %46 ], [ %32, %43 ]
%51 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i64 %50)
%52 = load i64, i64* %3
%53 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i64 %52)
%54 = load i64, i64* %5
%55 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), i64 %54)
%56 = load i64, i64* %7
%57 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0), i64 %56)
ret i32 0
}