#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 /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ timeinwords(int);
int main() {
  int i, j, k, h, m;
  scanf("%d", &h);
  scanf("%d", &m);
  if (m == 0) {
    timeinwords(h);
    printf(" ");
    timeinwords(m);
  } else {
    if (m == 1) {
      timeinwords(m);
      printf(" ");
      printf("minute past ");
      timeinwords(h);
    } else if (m <= 29 && m > 1 && m != 15) {
      timeinwords(m);
      printf(" ");
      printf("minutes past ");
      timeinwords(h);
    } else if (m == 30 || m == 15) {
      timeinwords(m);
      printf(" ");
      printf("past ");
      timeinwords(h);
    } else if (m > 30 && m < 60 && m != 45) {
      timeinwords(60 - m);
      printf(" ");
      printf("minutes to ");
      timeinwords(h + 1);
    } else if (m == 45) {
      timeinwords(60 - m);
      printf(" ");
      printf("to ");
      timeinwords(h + 1);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x18(%rbp)
jne    118a <main+0x5a>
mov    -0x14(%rbp),%edi
call   1030 <timeinwords@plt>
lea    0xeb0(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%edi
call   1030 <timeinwords@plt>
jmp    12f3 <main+0x1c3>
cmpl   $0x1,-0x18(%rbp)
jne    11c1 <main+0x91>
mov    -0x18(%rbp),%edi
call   1030 <timeinwords@plt>
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
lea    0xe54(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
call   1030 <timeinwords@plt>
jmp    12ee <main+0x1be>
cmpl   $0x1d,-0x18(%rbp)
jg     120c <main+0xdc>
cmpl   $0x1,-0x18(%rbp)
jle    120c <main+0xdc>
cmpl   $0xf,-0x18(%rbp)
je     120c <main+0xdc>
mov    -0x18(%rbp),%edi
call   1030 <timeinwords@plt>
lea    0xe3a(%rip),%rdi
call   1040 <printf@plt>
lea    0xe16(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
call   1030 <timeinwords@plt>
jmp    12e9 <main+0x1b9>
cmpl   $0x1e,-0x18(%rbp)
je     1220 <main+0xf0>
cmpl   $0xf,-0x18(%rbp)
jne    124d <main+0x11d>
mov    -0x18(%rbp),%edi
call   1030 <timeinwords@plt>
lea    0xdf9(%rip),%rdi
call   1040 <printf@plt>
lea    0xdcf(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
call   1030 <timeinwords@plt>
jmp    12e4 <main+0x1b4>
cmpl   $0x1e,-0x18(%rbp)
jle    12a0 <main+0x170>
cmpl   $0x3c,-0x18(%rbp)
jge    12a0 <main+0x170>
cmpl   $0x2d,-0x18(%rbp)
je     12a0 <main+0x170>
mov    $0x3c,%edi
sub    -0x18(%rbp),%edi
call   1030 <timeinwords@plt>
lea    0xda9(%rip),%rdi
call   1040 <printf@plt>
lea    0xd93(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
add    $0x1,%edi
call   1030 <timeinwords@plt>
jmp    12df <main+0x1af>
cmpl   $0x2d,-0x18(%rbp)
jne    12da <main+0x1aa>
mov    $0x3c,%edi
sub    -0x18(%rbp),%edi
call   1030 <timeinwords@plt>
lea    0xd6a(%rip),%rdi
call   1040 <printf@plt>
lea    0xd5c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
add    $0x1,%edi
call   1030 <timeinwords@plt>
jmp    12df <main+0x1af>
jmp    12e4 <main+0x1b4>
jmp    12e9 <main+0x1b9>
jmp    12ee <main+0x1be>
jmp    12f3 <main+0x1c3>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
cmp    $0x1,%edi
je     118c <main+0x4c>
test   %edi,%edi
jne    11a9 <main+0x69>
mov    0x8(%rsp),%edi
call   1040 <timeinwords@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%edi
jmp    11f7 <main+0xb7>
mov    $0x1,%edi
call   1040 <timeinwords@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0xe5c(%rip),%rdi
jmp    11ee <main+0xae>
cmp    $0xf,%edi
je     11ce <main+0x8e>
lea    -0x2(%rdi),%eax
cmp    $0x1b,%eax
ja     11ce <main+0x8e>
call   1040 <timeinwords@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0xe44(%rip),%rdi
jmp    11ee <main+0xae>
cmp    $0x1e,%edi
je     11d8 <main+0x98>
cmp    $0xf,%edi
jne    1204 <main+0xc4>
call   1040 <timeinwords@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0xe1c(%rip),%rdi
call   1050 <printf@plt>
mov    0x8(%rsp),%edi
call   1040 <timeinwords@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
cmp    $0x2d,%edi
je     1232 <main+0xf2>
lea    -0x1f(%rdi),%eax
cmp    $0x1c,%eax
ja     1232 <main+0xf2>
mov    $0x3c,%eax
sub    %edi,%eax
mov    %eax,%edi
call   1040 <timeinwords@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0xdee(%rip),%rdi
jmp    1252 <main+0x112>
cmp    $0x2d,%edi
jne    11fc <main+0xbc>
mov    $0xf,%edi
call   1040 <timeinwords@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
lea    0xdd4(%rip),%rdi
call   1050 <printf@plt>
mov    0x8(%rsp),%edi
add    $0x1,%edi
jmp    11f7 <main+0xb7>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [13 x i8] c"minute past \00"
@.str.3 = [14 x i8] c"minutes past \00"
@.str.4 = [6 x i8] c"past \00"
@.str.5 = [12 x i8] c"minutes to \00"
@.str.6 = [4 x i8] c"to \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%9 = load i32, i32* %6
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %0
%12 = load i32, i32* %5
%13 = call i32 @timeinwords(i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* %6
%16 = call i32 @timeinwords(i32 %15)
br label %91
17: ; preds = %0
%18 = load i32, i32* %6
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %27
20: ; preds = %17
%21 = load i32, i32* %6
%22 = call i32 @timeinwords(i32 %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%24 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%25 = load i32, i32* %5
%26 = call i32 @timeinwords(i32 %25)
br label %90
27: ; preds = %17
%28 = load i32, i32* %6
%29 = icmp sle i32 %28, 29
br i1 %29, label %30, label %43
30: ; preds = %27
%31 = load i32, i32* %6
%32 = icmp sgt i32 %31, 1
br i1 %32, label %33, label %43
33: ; preds = %30
%34 = load i32, i32* %6
%35 = icmp ne i32 %34, 15
br i1 %35, label %36, label %43
36: ; preds = %33
%37 = load i32, i32* %6
%38 = call i32 @timeinwords(i32 %37)
%39 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%40 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%41 = load i32, i32* %5
%42 = call i32 @timeinwords(i32 %41)
br label %89
43: ; preds = %33, %30, %27
%44 = load i32, i32* %6
%45 = icmp eq i32 %44, 30
br i1 %45, label %49, label %46
46: ; preds = %43
%47 = load i32, i32* %6
%48 = icmp eq i32 %47, 15
br i1 %48, label %49, label %56
49: ; preds = %46, %43
%50 = load i32, i32* %6
%51 = call i32 @timeinwords(i32 %50)
%52 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%53 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%54 = load i32, i32* %5
%55 = call i32 @timeinwords(i32 %54)
br label %88
56: ; preds = %46
%57 = load i32, i32* %6
%58 = icmp sgt i32 %57, 30
br i1 %58, label %59, label %74
59: ; preds = %56
%60 = load i32, i32* %6
%61 = icmp slt i32 %60, 60
br i1 %61, label %62, label %74
62: ; preds = %59
%63 = load i32, i32* %6
%64 = icmp ne i32 %63, 45
br i1 %64, label %65, label %74
65: ; preds = %62
%66 = load i32, i32* %6
%67 = sub nsw i32 60, %66
%68 = call i32 @timeinwords(i32 %67)
%69 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%70 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%71 = load i32, i32* %5
%72 = add nsw i32 %71, 1
%73 = call i32 @timeinwords(i32 %72)
br label %87
74: ; preds = %62, %59, %56
%75 = load i32, i32* %6
%76 = icmp eq i32 %75, 45
br i1 %76, label %77, label %86
77: ; preds = %74
%78 = load i32, i32* %6
%79 = sub nsw i32 60, %78
%80 = call i32 @timeinwords(i32 %79)
%81 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%82 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%83 = load i32, i32* %5
%84 = add nsw i32 %83, 1
%85 = call i32 @timeinwords(i32 %84)
br label %86
86: ; preds = %77, %74
br label %87
87: ; preds = %86, %65
br label %88
88: ; preds = %87, %49
br label %89
89: ; preds = %88, %36
br label %90
90: ; preds = %89, %20
br label %91
91: ; preds = %90, %11
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"minute past \00"
@.str.3 = [14 x i8] c"minutes past \00"
@.str.4 = [6 x i8] c"past \00"
@.str.5 = [12 x i8] c"minutes to \00"
@.str.6 = [4 x i8] c"to \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
switch i32 %7, label %18 [
i32 0, label %8
i32 1, label %13
]
8: ; preds = %0
%9 = load i32, i32* %1
%10 = call i32 @timeinwords(i32 %9)
%11 = call i32 @putchar(i32 32)
%12 = load i32, i32* %2
br label %54
13: ; preds = %0
%14 = call i32 @timeinwords(i32 1)
%15 = call i32 @putchar(i32 32)
%16 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* %1
br label %54
18: ; preds = %0
%19 = add i32 %7, -2
%20 = icmp ult i32 %19, 28
%21 = icmp ne i32 %7, 15
%22 = and i1 %21, %20
br i1 %22, label %23, label %28
23: ; preds = %18
%24 = call i32 @timeinwords(i32 %7)
%25 = call i32 @putchar(i32 32)
%26 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%27 = load i32, i32* %1
br label %54
28: ; preds = %18
switch i32 %7, label %34 [
i32 30, label %29
i32 15, label %29
]
29: ; preds = %28, %28
%30 = call i32 @timeinwords(i32 %7)
%31 = call i32 @putchar(i32 32)
%32 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%33 = load i32, i32* %1
br label %54
34: ; preds = %28
%35 = add i32 %7, -31
%36 = icmp ult i32 %35, 29
%37 = icmp ne i32 %7, 45
%38 = and i1 %37, %36
br i1 %38, label %39, label %46
39: ; preds = %34
%40 = sub nuw nsw i32 60, %7
%41 = call i32 @timeinwords(i32 %40)
%42 = call i32 @putchar(i32 32)
%43 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%44 = load i32, i32* %1
%45 = add nsw i32 %44, 1
br label %54
46: ; preds = %34
%47 = icmp eq i32 %7, 45
br i1 %47, label %48, label %57
48: ; preds = %46
%49 = call i32 @timeinwords(i32 15)
%50 = call i32 @putchar(i32 32)
%51 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%52 = load i32, i32* %1
%53 = add nsw i32 %52, 1
br label %54
54: ; preds = %8, %23, %39, %48, %29, %13
%55 = phi i32 [ %17, %13 ], [ %33, %29 ], [ %53, %48 ], [ %45, %39 ], [ %27, %23 ], [ %12, %8 ]
%56 = call i32 @timeinwords(i32 %55)
br label %57
57: ; preds = %54, %46
ret i32 0
}