#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 int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
int abs(int);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, int *, int *, int *, int *,
                  int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  FILE *fp;
  int h1, m1, s1, h2, m2, s2;
  if (argc != 2) {
    printf("Usage: %s [FILE]\n", argv[0]);
    return 1;
  }
  fp = fopen(*++argv, "r");
  while (fscanf(fp, "%d:%d:%d %d:%d:%d\n", &h1, &m1, &s1, &h2, &m2, &s2) !=
         EOF) {
    int t = abs((h1 - h2) * 3600 + (m1 - m2) * 60 + s1 - s2);
    printf("%02d:%02d:%02d\n", t / 3600, (t / 60) % 60, t % 60);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1181 <main+0x41>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1257 <main+0x117>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rdi
lea    0xe77(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe65(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    -0x24(%rbp),%r8
lea    -0x28(%rbp),%r9
lea    -0x2c(%rbp),%r10
lea    -0x30(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <fscanf@plt>
mov    0x2e0c(%rip),%rcx
cmp    (%rcx),%rax
je     1250 <main+0x110>
mov    -0x1c(%rbp),%eax
sub    -0x28(%rbp),%eax
imul   $0xe10,%eax,%edi
mov    -0x20(%rbp),%eax
sub    -0x2c(%rbp),%eax
imul   $0x3c,%eax,%eax
add    %eax,%edi
add    -0x24(%rbp),%edi
sub    -0x30(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x34(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x38(%rbp)
mov    -0x34(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x38(%rbp),%edx
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11a4 <main+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jne    1260 <main+0x130>
mov    0x8(%rsi),%rdi
lea    0xec0(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %rsp,%rax
lea    0x4(%rsp),%rbp
lea    0xeab(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
lea    0x8(%rsp),%r9
mov    %rbx,%rdi
push   %rax
push   %rbp
call   1040 <fscanf@plt>
add    $0x10,%rsp
mov    0x2e56(%rip),%r13
xor    %r15d,%r15d
cmp    0x0(%r13),%rax
je     1277 <main+0x147>
mov    $0x88888889,%r12d
lea    0xc(%rsp),%rbp
lea    0x8(%rsp),%r14
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x14(%rsp),%eax
sub    0x8(%rsp),%eax
mov    0x10(%rsp),%ecx
sub    0x4(%rsp),%ecx
imul   $0xe10,%eax,%eax
imul   $0x3c,%ecx,%ecx
add    0xc(%rsp),%eax
add    %ecx,%eax
sub    (%rsp),%eax
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
mov    %rcx,%rsi
mov    $0x91a2b3c5,%eax
imul   %rax,%rsi
shr    $0x2b,%rsi
mov    %rcx,%rdx
imul   %r12,%rdx
shr    $0x25,%rdx
mov    %rdx,%rax
imul   %r12,%rax
shr    $0x25,%rax
imul   $0x3c,%eax,%eax
imul   $0x3c,%edx,%edi
sub    %eax,%edx
sub    %edi,%ecx
lea    0xe07(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
lea    0xde3(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
mov    %rbp,%r8
mov    %r14,%r9
mov    %rsp,%rax
push   %rax
lea    0xc(%rsp),%rax
push   %rax
call   1040 <fscanf@plt>
add    $0x10,%rsp
cmp    0x0(%r13),%rax
jne    11c0 <main+0x90>
jmp    1277 <main+0x147>
mov    (%rsi),%rsi
lea    0xd96(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%r15d
mov    %r15d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"%d:%d:%d %d:%d:%d\0A\00"
@EOF = global i64 0
@.str.3 = [16 x i8] c"%02d:%02d:%02d\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
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 2
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 0
%19 = load i8*, i8** %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %19)
store i32 1, i32* %3
br label %55
21: ; preds = %2
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i32 1
store i8** %23, i8*** %5
%24 = load i8*, i8** %23
%25 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %25, i32** %6
br label %26
26: ; preds = %31, %21
%27 = load i32*, i32** %6
%28 = call i64 @fscanf(i32* %27, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32* %7, i32* %8, i32* %9, i32* %10, i32* %11, i32* %12)
%29 = load i64, i64* @EOF
%30 = icmp ne i64 %28, %29
br i1 %30, label %31, label %54
31: ; preds = %26
%32 = load i32, i32* %7
%33 = load i32, i32* %10
%34 = sub nsw i32 %32, %33
%35 = mul nsw i32 %34, 3600
%36 = load i32, i32* %8
%37 = load i32, i32* %11
%38 = sub nsw i32 %36, %37
%39 = mul nsw i32 %38, 60
%40 = add nsw i32 %35, %39
%41 = load i32, i32* %9
%42 = add nsw i32 %40, %41
%43 = load i32, i32* %12
%44 = sub nsw i32 %42, %43
%45 = call i32 @abs(i32 %44)
store i32 %45, i32* %13
%46 = load i32, i32* %13
%47 = sdiv i32 %46, 3600
%48 = load i32, i32* %13
%49 = sdiv i32 %48, 60
%50 = srem i32 %49, 60
%51 = load i32, i32* %13
%52 = srem i32 %51, 60
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %47, i32 %50, i32 %52)
br label %26
54: ; preds = %26
store i32 0, i32* %3
br label %55
55: ; preds = %54, %16
%56 = load i32, i32* %3
ret i32 %56
}

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: %s [FILE]\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"%d:%d:%d %d:%d:%d\0A\00"
@EOF = global i64 0
@.str.3 = [16 x i8] c"%02d:%02d:%02d\0A\00"
define i32 @main(i32 %0, i8** nocapture %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 = icmp eq i32 %0, 2
br i1 %15, label %19, label %16
16: ; preds = %2
%17 = load i8*, i8** %1
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %17)
br label %49
19: ; preds = %2
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = tail call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%23 = call i64 @fscanf(i32* %22, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8)
%24 = load i64, i64* @EOF
%25 = icmp eq i64 %23, %24
br i1 %25, label %49, label %26
26: ; preds = %19, %26
%27 = load i32, i32* %3
%28 = load i32, i32* %6
%29 = sub nsw i32 %27, %28
%30 = mul nsw i32 %29, 3600
%31 = load i32, i32* %4
%32 = load i32, i32* %7
%33 = sub nsw i32 %31, %32
%34 = mul nsw i32 %33, 60
%35 = load i32, i32* %5
%36 = load i32, i32* %8
%37 = add i32 %35, %30
%38 = add i32 %37, %34
%39 = sub i32 %38, %36
%40 = call i32 @llvm.abs.i32(i32 %39, i1 true)
%41 = udiv i32 %40, 3600
%42 = udiv i32 %40, 60
%43 = urem i32 %42, 60
%44 = urem i32 %40, 60
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %41, i32 %43, i32 %44)
%46 = call i64 @fscanf(i32* %22, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32* %8)
%47 = load i64, i64* @EOF
%48 = icmp eq i64 %46, %47
br i1 %48, label %49, label %26
49: ; preds = %26, %19, %16
%50 = phi i32 [ 1, %16 ], [ 0, %19 ], [ 0, %26 ]
ret i32 %50
}