#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*/ sscanf(char *, char *, int *, int *);
int time_diff(char time1[6], char time2[6]) {
  int t1h, t1m, t2h, t2m;
  sscanf(time1, "%2d:%2d", &t1h, &t1m);
  sscanf(time2, "%2d:%2d", &t2h, &t2m);
  t1m += t1h * 60;
  t2m += t2h * 60;
  return t2m - t1m;
}


x86 assembly (clang, -O0):
<time_diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed5(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1030 <sscanf@plt>
mov    -0x10(%rbp),%rdi
lea    0xebd(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1030 <sscanf@plt>
imul   $0x3c,-0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
imul   $0x3c,-0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
sub    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_diff>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
lea    0xedf(%rip),%r14
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
mov    %r14,%rsi
call   1030 <sscanf@plt>
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <sscanf@plt>
imul   $0x3c,0x14(%rsp),%ecx
add    0x10(%rsp),%ecx
imul   $0x3c,0xc(%rsp),%eax
add    0x8(%rsp),%eax
sub    %ecx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"%2d:%2d\00"
define i32 @time_diff(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %3
%10 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %6)
%11 = load i8*, i8** %4
%12 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %7, i32* %8)
%13 = load i32, i32* %5
%14 = mul nsw i32 %13, 60
%15 = load i32, i32* %6
%16 = add nsw i32 %15, %14
store i32 %16, i32* %6
%17 = load i32, i32* %7
%18 = mul nsw i32 %17, 60
%19 = load i32, i32* %8
%20 = add nsw i32 %19, %18
store i32 %20, i32* %8
%21 = load i32, i32* %8
%22 = load i32, i32* %6
%23 = sub nsw i32 %21, %22
ret i32 %23
}

LLVM IR (-O2):
@.str = [8 x i8] c"%2d:%2d\00"
define i32 @time_diff(i8* nocapture %0, i8* nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
%12 = call i32 @sscanf(i8* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %6)
%13 = load i32, i32* %3
%14 = mul nsw i32 %13, 60
%15 = load i32, i32* %4
%16 = add nsw i32 %15, %14
%17 = load i32, i32* %5
%18 = mul nsw i32 %17, 60
%19 = load i32, i32* %6
%20 = add nsw i32 %19, %18
%21 = sub nsw i32 %20, %16
ret i32 %21
}