#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, int);
void addTimes(int startTime, int duration) {
  int startMinutes = (startTime % 100);
  int startHours = ((startTime - startMinutes) / 100);
  int durationMinutes = (duration % 100);
  int durationHours = ((duration - durationMinutes) / 100);
  int finishHours, finishMinutes, finishTime;
  finishHours = startHours + durationHours;
  finishMinutes = startMinutes + durationMinutes;
  if (finishHours > 23) {
    finishHours -= 24;
  }
  if (finishMinutes > 59) {
    finishMinutes -= 60;
    finishHours++;
  }
  finishTime = ((finishHours * 100) + finishMinutes);
  printf("Start time is %04d. Duration is %04d. End time is %04d\n", startTime,
         duration, finishTime);
}


x86 assembly (clang, -O0):
<addTimes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x14(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x17,-0x1c(%rbp)
jle    1181 <addTimes+0x71>
mov    -0x1c(%rbp),%eax
sub    $0x18,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x3b,-0x20(%rbp)
jle    119d <addTimes+0x8d>
mov    -0x20(%rbp),%eax
sub    $0x3c,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
imul   $0x64,-0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<addTimes>:
mov    %esi,%eax
movslq %edi,%rsi
imul   $0x51eb851f,%rsi,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%edx
mov    %esi,%r8d
sub    %edx,%r8d
movslq %eax,%rdx
imul   $0x51eb851f,%rdx,%rax
mov    %rax,%rdi
shr    $0x3f,%rdi
sar    $0x25,%rax
add    %edi,%eax
imul   $0x64,%eax,%r9d
mov    %edx,%edi
sub    %r9d,%edi
lea    (%rax,%rcx,1),%r9d
lea    (%rdi,%r8,1),%r10d
cmp    $0x18,%r9d
lea    -0x18(%rax,%rcx,1),%eax
cmovl  %r9d,%eax
xor    %ecx,%ecx
cmp    $0x3c,%r10d
setge  %cl
lea    -0x3c(%rdi,%r8,1),%edi
cmovl  %r10d,%edi
add    %eax,%ecx
imul   $0x64,%ecx,%ecx
add    %edi,%ecx
lea    0xe7a(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [56 x i8] c"Start time is %04d. Duration is %04d. End time is %04d\0A\00"
define void @addTimes(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%12 = load i32, i32* %3
%13 = srem i32 %12, 100
store i32 %13, i32* %5
%14 = load i32, i32* %3
%15 = load i32, i32* %5
%16 = sub nsw i32 %14, %15
%17 = sdiv i32 %16, 100
store i32 %17, i32* %6
%18 = load i32, i32* %4
%19 = srem i32 %18, 100
store i32 %19, i32* %7
%20 = load i32, i32* %4
%21 = load i32, i32* %7
%22 = sub nsw i32 %20, %21
%23 = sdiv i32 %22, 100
store i32 %23, i32* %8
%24 = load i32, i32* %6
%25 = load i32, i32* %8
%26 = add nsw i32 %24, %25
store i32 %26, i32* %9
%27 = load i32, i32* %5
%28 = load i32, i32* %7
%29 = add nsw i32 %27, %28
store i32 %29, i32* %10
%30 = load i32, i32* %9
%31 = icmp sgt i32 %30, 23
br i1 %31, label %32, label %35
32: ; preds = %2
%33 = load i32, i32* %9
%34 = sub nsw i32 %33, 24
store i32 %34, i32* %9
br label %35
35: ; preds = %32, %2
%36 = load i32, i32* %10
%37 = icmp sgt i32 %36, 59
br i1 %37, label %38, label %43
38: ; preds = %35
%39 = load i32, i32* %10
%40 = sub nsw i32 %39, 60
store i32 %40, i32* %10
%41 = load i32, i32* %9
%42 = add nsw i32 %41, 1
store i32 %42, i32* %9
br label %43
43: ; preds = %38, %35
%44 = load i32, i32* %9
%45 = mul nsw i32 %44, 100
%46 = load i32, i32* %10
%47 = add nsw i32 %45, %46
store i32 %47, i32* %11
%48 = load i32, i32* %3
%49 = load i32, i32* %4
%50 = load i32, i32* %11
%51 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %48, i32 %49, i32 %50)
ret void
}

LLVM IR (-O2):
@.str = [56 x i8] c"Start time is %04d. Duration is %04d. End time is %04d\0A\00"
define void @addTimes(i32 %0, i32 %1) {
%3 = srem i32 %0, 100
%4 = sdiv i32 %0, 100
%5 = srem i32 %1, 100
%6 = sdiv i32 %1, 100
%7 = add nsw i32 %6, %4
%8 = add nsw i32 %5, %3
%9 = icmp sgt i32 %7, 23
%10 = add nsw i32 %7, -24
%11 = select i1 %9, i32 %10, i32 %7
%12 = icmp sgt i32 %8, 59
%13 = add nsw i32 %8, -60
%14 = select i1 %12, i32 %13, i32 %8
%15 = zext i1 %12 to i32
%16 = add nsw i32 %11, %15
%17 = mul nsw i32 %16, 100
%18 = add nsw i32 %17, %14
%19 = tail call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %18)
ret void
}