#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 /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  char dia_i[5], dia_f[5], p[2], p2[2];
  int DIA_I, HORA_I, MIN_I, SEG_I, DIA_F, HORA_F, MIN_F, SEG_F, DIA_T, HORA_T,
      MIN_T, SEG_T;
  scanf("%s%d", dia_i, &DIA_I);
  scanf("%d%s%d%s%d", &HORA_I, p, &MIN_I, p2, &SEG_I);
  scanf("%s%d", dia_f, &DIA_F);
  scanf("%d%s%d%s%d", &HORA_F, p, &MIN_F, p2, &SEG_F);
  if (DIA_F == DIA_I) {
    DIA_T = 0;
  } else {
    DIA_T = DIA_F - DIA_I;
  }
  if (HORA_F - HORA_I > 0) {
    HORA_T = HORA_F - HORA_I;
  } else {
    HORA_T = 24 + (HORA_F - HORA_I);
    DIA_T--;
  }
  if (MIN_F - MIN_I >= 0) {
    MIN_T = (MIN_F - MIN_I);
  } else {
    MIN_T = 60 + (MIN_F - MIN_I);
    HORA_T--;
  }
  if (SEG_F - SEG_I >= 0) {
    SEG_T = (SEG_F - SEG_I);
  } else {
    SEG_T = 60 + (SEG_F - SEG_I);
    MIN_T--;
  }
  printf("%d dia(s)\n", DIA_T);
  printf("%d hora(s)\n", HORA_T);
  printf("%d minuto(s)\n", MIN_T);
  printf("%d segundo(s)\n", SEG_T);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x9(%rbp),%rsi
lea    0xecc(%rip),%rdi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    -0x10(%rbp),%rdx
lea    -0x12(%rbp),%r8
lea    0xeac(%rip),%rdi
lea    -0x1c(%rbp),%rsi
lea    -0x20(%rbp),%rcx
lea    -0x24(%rbp),%r9
mov    $0x0,%al
call   1040 <scanf@plt>
lea    -0xe(%rbp),%rsi
lea    0xe94(%rip),%rdi
lea    -0x28(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    -0x10(%rbp),%rdx
lea    -0x12(%rbp),%r8
lea    0xe74(%rip),%rdi
lea    -0x2c(%rbp),%rsi
lea    -0x30(%rbp),%rcx
lea    -0x34(%rbp),%r9
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x28(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    11b7 <main+0x97>
movl   $0x0,-0x38(%rbp)
jmp    11c0 <main+0xa0>
mov    -0x28(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
sub    -0x1c(%rbp),%eax
cmp    $0x0,%eax
jle    11dd <main+0xbd>
mov    -0x2c(%rbp),%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
jmp    11f2 <main+0xd2>
mov    -0x2c(%rbp),%eax
sub    -0x1c(%rbp),%eax
add    $0x18,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%eax
sub    -0x20(%rbp),%eax
cmp    $0x0,%eax
jl     120f <main+0xef>
mov    -0x30(%rbp),%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x40(%rbp)
jmp    1224 <main+0x104>
mov    -0x30(%rbp),%eax
sub    -0x20(%rbp),%eax
add    $0x3c,%eax
mov    %eax,-0x40(%rbp)
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
sub    -0x24(%rbp),%eax
cmp    $0x0,%eax
jl     1241 <main+0x121>
mov    -0x34(%rbp),%eax
sub    -0x24(%rbp),%eax
mov    %eax,-0x44(%rbp)
jmp    1256 <main+0x136>
mov    -0x34(%rbp),%eax
sub    -0x24(%rbp),%eax
add    $0x3c,%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x40(%rbp)
mov    -0x38(%rbp),%esi
lea    0xdab(%rip),%rdi
call   1030 <printf@plt>
mov    -0x3c(%rbp),%esi
lea    0xda7(%rip),%rdi
call   1030 <printf@plt>
mov    -0x40(%rbp),%esi
lea    0xda4(%rip),%rdi
call   1030 <printf@plt>
mov    -0x44(%rbp),%esi
lea    0xda3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
lea    0xed3(%rip),%r14
xor    %ebp,%ebp
lea    0x2b(%rsp),%rsi
lea    0x1c(%rsp),%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xeb0(%rip),%rbx
lea    0x18(%rsp),%rsi
lea    0x24(%rsp),%r15
lea    0x14(%rsp),%rcx
lea    0x22(%rsp),%r12
lea    0x10(%rsp),%r9
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r12,%r8
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0x26(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0x8(%rsp),%rsi
lea    0x4(%rsp),%rcx
mov    %rsp,%r9
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r12,%r8
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
sub    0x1c(%rsp),%esi
cmove  %ebp,%esi
mov    0x8(%rsp),%eax
sub    0x18(%rsp),%eax
lea    0x18(%rax),%ecx
xor    %edx,%edx
test   %eax,%eax
cmovg  %eax,%ecx
setle  %dl
mov    0x4(%rsp),%eax
sub    0x14(%rsp),%eax
sub    %edx,%esi
lea    0x3c(%rax),%edx
mov    %eax,%ebx
sar    $0x1f,%ebx
add    %ecx,%ebx
test   %eax,%eax
cmovns %eax,%edx
mov    (%rsp),%eax
sub    0x10(%rsp),%eax
lea    0x3c(%rax),%r14d
mov    %eax,%ebp
sar    $0x1f,%ebp
add    %edx,%ebp
test   %eax,%eax
cmovns %eax,%r14d
lea    0xe09(%rip),%rdi
call   1030 <printf@plt>
lea    0xe08(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
lea    0xe06(%rip),%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
lea    0xe06(%rip),%rdi
mov    %r14d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s%d\00"
@.str.1 = [11 x i8] c"%d%s%d%s%d\00"
@.str.2 = [11 x i8] c"%d dia(s)\0A\00"
@.str.3 = [12 x i8] c"%d hora(s)\0A\00"
@.str.4 = [14 x i8] c"%d minuto(s)\0A\00"
@.str.5 = [15 x i8] c"%d segundo(s)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
%3 = alloca [5 x i8]
%4 = alloca [2 x i8]
%5 = alloca [2 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i32 0, i32* %1
%18 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %18, i32* %6)
%20 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%21 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* %7, i8* %20, i32* %8, i8* %21, i32* %9)
%23 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %23, i32* %10)
%25 = getelementptr inbounds [2 x i8], [2 x i8]* %4, i64 0, i64 0
%26 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%27 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* %11, i8* %25, i32* %12, i8* %26, i32* %13)
%28 = load i32, i32* %10
%29 = load i32, i32* %6
%30 = icmp eq i32 %28, %29
br i1 %30, label %31, label %32
31: ; preds = %0
store i32 0, i32* %14
br label %36
32: ; preds = %0
%33 = load i32, i32* %10
%34 = load i32, i32* %6
%35 = sub nsw i32 %33, %34
store i32 %35, i32* %14
br label %36
36: ; preds = %32, %31
%37 = load i32, i32* %11
%38 = load i32, i32* %7
%39 = sub nsw i32 %37, %38
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %36
%42 = load i32, i32* %11
%43 = load i32, i32* %7
%44 = sub nsw i32 %42, %43
store i32 %44, i32* %15
br label %52
45: ; preds = %36
%46 = load i32, i32* %11
%47 = load i32, i32* %7
%48 = sub nsw i32 %46, %47
%49 = add nsw i32 24, %48
store i32 %49, i32* %15
%50 = load i32, i32* %14
%51 = add nsw i32 %50, -1
store i32 %51, i32* %14
br label %52
52: ; preds = %45, %41
%53 = load i32, i32* %12
%54 = load i32, i32* %8
%55 = sub nsw i32 %53, %54
%56 = icmp sge i32 %55, 0
br i1 %56, label %57, label %61
57: ; preds = %52
%58 = load i32, i32* %12
%59 = load i32, i32* %8
%60 = sub nsw i32 %58, %59
store i32 %60, i32* %16
br label %68
61: ; preds = %52
%62 = load i32, i32* %12
%63 = load i32, i32* %8
%64 = sub nsw i32 %62, %63
%65 = add nsw i32 60, %64
store i32 %65, i32* %16
%66 = load i32, i32* %15
%67 = add nsw i32 %66, -1
store i32 %67, i32* %15
br label %68
68: ; preds = %61, %57
%69 = load i32, i32* %13
%70 = load i32, i32* %9
%71 = sub nsw i32 %69, %70
%72 = icmp sge i32 %71, 0
br i1 %72, label %73, label %77
73: ; preds = %68
%74 = load i32, i32* %13
%75 = load i32, i32* %9
%76 = sub nsw i32 %74, %75
store i32 %76, i32* %17
br label %84
77: ; preds = %68
%78 = load i32, i32* %13
%79 = load i32, i32* %9
%80 = sub nsw i32 %78, %79
%81 = add nsw i32 60, %80
store i32 %81, i32* %17
%82 = load i32, i32* %16
%83 = add nsw i32 %82, -1
store i32 %83, i32* %16
br label %84
84: ; preds = %77, %73
%85 = load i32, i32* %14
%86 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %85)
%87 = load i32, i32* %15
%88 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %87)
%89 = load i32, i32* %16
%90 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %89)
%91 = load i32, i32* %17
%92 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32 %91)
ret i32 0
}

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