#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);
void forward(int d, int h, int m) {
  int d_h = d / 60;
  int d_m = d % 60;
  h += d_h;
  m += d_m;
  if (m >= 60) {
    h += 1;
    m -= 60;
  }
  if (h >= 24) {
    h -= 24;
  }
  printf("%d %d\n", h, m);
}


x86 assembly (clang, -O0):
<forward>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x3c,-0xc(%rbp)
jl     116b <forward+0x5b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x3c,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x18,-0x8(%rbp)
jl     117e <forward+0x6e>
mov    -0x8(%rbp),%eax
sub    $0x18,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<forward>:
movslq %edi,%rcx
imul   $0xffffffff88888889,%rcx,%rax
shr    $0x20,%rax
add    %ecx,%eax
mov    %eax,%edi
shr    $0x1f,%edi
sar    $0x5,%eax
add    %edi,%eax
imul   $0x3c,%eax,%edi
sub    %edi,%ecx
add    %esi,%eax
lea    (%rcx,%rdx,1),%esi
xor    %edi,%edi
cmp    $0x3c,%esi
setge  %dil
lea    -0x3c(%rdx,%rcx,1),%edx
cmovl  %esi,%edx
lea    (%rax,%rdi,1),%ecx
cmp    $0x18,%ecx
lea    -0x18(%rdi,%rax,1),%esi
cmovl  %ecx,%esi
lea    0xea8(%rip),%rdi
jmp    1030 <printf@plt>

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

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