#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 *, int *, int *, int *, int *, int *);
int main(int argc, const char *argv[]) {
  int hour1, minute1, second1, hour2, minute2, second2;
  scanf("%d:%d:%d %d:%d:%d", &hour1, &minute1, &second1, &hour2, &minute2,
        &second2);
  int interval = (hour2 * 3600 + minute2 * 60 + second2) -
                 (hour1 * 3600 + minute1 * 60 + second1);
  if (interval < 0) {
    interval += 24 * 3600;
  }
  printf("%d\n", interval);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
lea    -0x20(%rbp),%r8
lea    -0x24(%rbp),%r9
lea    -0x28(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <scanf@plt>
imul   $0xe10,-0x20(%rbp),%eax
imul   $0x3c,-0x24(%rbp),%ecx
add    %ecx,%eax
add    -0x28(%rbp),%eax
imul   $0xe10,-0x14(%rbp),%ecx
imul   $0x3c,-0x18(%rbp),%edx
add    %edx,%ecx
add    -0x1c(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jge    1198 <main+0x78>
mov    -0x2c(%rbp),%eax
add    $0x15180,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%esi
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
lea    0x10(%rsp),%rax
mov    %rax,(%rsp)
lea    0xecc(%rip),%rdi
lea    0x24(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x1c(%rsp),%rcx
lea    0x18(%rsp),%r8
lea    0x14(%rsp),%r9
call   1040 <scanf@plt>
mov    0x18(%rsp),%eax
mov    0x14(%rsp),%ecx
sub    0x20(%rsp),%ecx
mov    0x10(%rsp),%edx
imul   $0x3c,%ecx,%ecx
sub    0x24(%rsp),%eax
imul   $0xe10,%eax,%eax
sub    0x1c(%rsp),%edx
add    %eax,%edx
lea    (%rcx,%rdx,1),%esi
add    $0x15180,%esi
mov    %edx,%eax
add    %ecx,%eax
cmovns %eax,%esi
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"%d:%d:%d %d:%d:%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = call i32 @scanf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32* %6, i32* %7, i32* %8, i32* %9, i32* %10, i32* %11)
%14 = load i32, i32* %9
%15 = mul nsw i32 %14, 3600
%16 = load i32, i32* %10
%17 = mul nsw i32 %16, 60
%18 = add nsw i32 %15, %17
%19 = load i32, i32* %11
%20 = add nsw i32 %18, %19
%21 = load i32, i32* %6
%22 = mul nsw i32 %21, 3600
%23 = load i32, i32* %7
%24 = mul nsw i32 %23, 60
%25 = add nsw i32 %22, %24
%26 = load i32, i32* %8
%27 = add nsw i32 %25, %26
%28 = sub nsw i32 %20, %27
store i32 %28, i32* %12
%29 = load i32, i32* %12
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %2
%32 = load i32, i32* %12
%33 = add nsw i32 %32, 86400
store i32 %33, i32* %12
br label %34
34: ; preds = %31, %2
%35 = load i32, i32* %12
%36 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %35)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"%d:%d:%d %d:%d:%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = bitcast i32* %7 to i8*
%14 = bitcast i32* %8 to i8*
%15 = call i32 @scanf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8)
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = load i32, i32* %8
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = load i32, i32* %5
%22 = sub i32 %17, %20
%23 = mul i32 %22, 60
%24 = sub i32 %16, %19
%25 = mul i32 %24, 3600
%26 = sub i32 %18, %21
%27 = add i32 %26, %25
%28 = add i32 %27, %23
%29 = icmp slt i32 %28, 0
%30 = add nsw i32 %28, 86400
%31 = select i1 %29, i32 %30, i32 %28
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %31)
ret i32 0
}