#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*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ remove_new_line(char *);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
char *strtok(char *, char *);
scalar_t__ strtol(char *, char **, int);
int main() {
  char input[10];
  fgets(input, 10, stdin);
  remove_new_line(input);
  char *token = strtok(input, ": ");
  char *remainder;
  int hour = (int)strtol(token, &remainder, 10);
  if (hour < 1 || hour > 12) {
    printf("Incorrect input.");
    exit(EXIT_FAILURE);
  }
  token = strtok(NULL, ": ");
  int minute = (int)strtol(token, &remainder, 10);
  if (minute < 0 || minute > 59) {
    printf("Incorrect input.");
    exit(EXIT_FAILURE);
  }
  char *tt = strtok(NULL, ": ");
  if (strcmp(tt, "AM") != 0 && strcmp(tt, "PM") != 0) {
    printf("Incorrect input.");
    exit(EXIT_FAILURE);
  } else if ((hour >= 1 && tt[0] == 'P') || (hour < 3 && tt[0] == 'A')) {
    printf("bear time");
  } else {
    printf("non-bear time");
  }
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rdi
mov    0x2e5e(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1040 <fgets@plt>
lea    -0xe(%rbp),%rdi
call   1080 <remove_new_line@plt>
lea    -0xe(%rbp),%rdi
lea    0xe56(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
jl     11dc <main+0x6c>
cmpl   $0xc,-0x24(%rbp)
jle    11f6 <main+0x86>
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
mov    0x2de9(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xdff(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %eax,-0x28(%rbp)
cmpl   $0x0,-0x28(%rbp)
jl     1233 <main+0xc3>
cmpl   $0x3b,-0x28(%rbp)
jle    124d <main+0xdd>
lea    0xdc9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2d92(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xda8(%rip),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xda8(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     12af <main+0x13f>
mov    -0x30(%rbp),%rdi
lea    0xd91(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     12af <main+0x13f>
lea    0xd67(%rip),%rdi
call   1030 <printf@plt>
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>
cmpl   $0x1,-0x24(%rbp)
jl     12c9 <main+0x159>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x50,%eax
je     12e3 <main+0x173>
cmpl   $0x3,-0x24(%rbp)
jge    12f4 <main+0x184>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x41,%eax
jne    12f4 <main+0x184>
lea    0xd34(%rip),%rdi
call   1030 <printf@plt>
jmp    1300 <main+0x190>
lea    0xd1f(%rip),%rdi
call   1030 <printf@plt>
jmp    1305 <main+0x195>
mov    0x2cc4(%rip),%rax
mov    (%rax),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    0x2e6a(%rip),%rax
mov    (%rax),%edx
lea    0xe(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <fgets@plt>
mov    %rbx,%rdi
call   1080 <remove_new_line@plt>
lea    0xe5f(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strtok@plt>
mov    %rsp,%rsi
mov    %rax,%rdi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %rax,%r14
add    $0xfffffff3,%eax
cmp    $0xfffffff3,%eax
jbe    1261 <main+0xf1>
lea    0xe31(%rip),%rsi
xor    %edi,%edi
call   1070 <strtok@plt>
mov    %rsp,%rsi
mov    %rax,%rdi
mov    $0xa,%edx
call   1060 <strtol@plt>
cmp    $0x3c,%eax
jae    1261 <main+0xf1>
lea    0xe0e(%rip),%rsi
xor    %edi,%edi
call   1070 <strtok@plt>
mov    %rax,%rbx
lea    0xe11(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1224 <main+0xb4>
lea    0xe00(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    1261 <main+0xf1>
mov    (%rbx),%al
cmp    $0x41,%al
lea    0xdef(%rip),%rcx
lea    0xde4(%rip),%rdx
mov    %rdx,%rdi
cmove  %rcx,%rdi
cmp    $0x3,%r14d
cmovae %rdx,%rdi
cmp    $0x50,%al
cmove  %rcx,%rdi
call   1030 <printf@plt>
mov    0x2d79(%rip),%rax
mov    (%rax),%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret
lea    0xd9b(%rip),%rdi
call   1030 <printf@plt>
mov    0x2d64(%rip),%rax
mov    (%rax),%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@stdin = global i32 0
@.str = [3 x i8] c": \00"
@.str.1 = [17 x i8] c"Incorrect input.\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [3 x i8] c"AM\00"
@.str.3 = [3 x i8] c"PM\00"
@.str.4 = [10 x i8] c"bear time\00"
@.str.5 = [14 x i8] c"non-bear time\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %1
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%9 = load i32, i32* @stdin
%10 = call i32 @fgets(i8* %8, i32 10, i32 %9)
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%12 = call i32 @remove_new_line(i8* %11)
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%14 = call i8* @strtok(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %14, i8** %3
%15 = load i8*, i8** %3
%16 = call i64 @strtol(i8* %15, i8** %4, i32 10)
%17 = trunc i64 %16 to i32
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = icmp slt i32 %18, 1
br i1 %19, label %23, label %20
20: ; preds = %0
%21 = load i32, i32* %5
%22 = icmp sgt i32 %21, 12
br i1 %22, label %23, label %27
23: ; preds = %20, %0
%24 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%25 = load i32, i32* @EXIT_FAILURE
%26 = call i32 @exit(i32 %25)
unreachable
27: ; preds = %20
%28 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %28, i8** %3
%29 = load i8*, i8** %3
%30 = call i64 @strtol(i8* %29, i8** %4, i32 10)
%31 = trunc i64 %30 to i32
store i32 %31, i32* %6
%32 = load i32, i32* %6
%33 = icmp slt i32 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %27
%35 = load i32, i32* %6
%36 = icmp sgt i32 %35, 59
br i1 %36, label %37, label %41
37: ; preds = %34, %27
%38 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%39 = load i32, i32* @EXIT_FAILURE
%40 = call i32 @exit(i32 %39)
unreachable
41: ; preds = %34
%42 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %42, i8** %7
%43 = load i8*, i8** %7
%44 = call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%45 = icmp ne i64 %44, 0
br i1 %45, label %46, label %54
46: ; preds = %41
%47 = load i8*, i8** %7
%48 = call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%49 = icmp ne i64 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %46
%51 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%52 = load i32, i32* @EXIT_FAILURE
%53 = call i32 @exit(i32 %52)
unreachable
54: ; preds = %46, %41
%55 = load i32, i32* %5
%56 = icmp sge i32 %55, 1
br i1 %56, label %57, label %63
57: ; preds = %54
%58 = load i8*, i8** %7
%59 = getelementptr inbounds i8, i8* %58, i64 0
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 80
br i1 %62, label %72, label %63
63: ; preds = %57, %54
%64 = load i32, i32* %5
%65 = icmp slt i32 %64, 3
br i1 %65, label %66, label %74
66: ; preds = %63
%67 = load i8*, i8** %7
%68 = getelementptr inbounds i8, i8* %67, i64 0
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 65
br i1 %71, label %72, label %74
72: ; preds = %66, %57
%73 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
br label %76
74: ; preds = %66, %63
%75 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
br label %76
76: ; preds = %74, %72
br label %77
77: ; preds = %76
%78 = load i32, i32* @EXIT_SUCCESS
ret i32 %78
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c": \00"
@.str.1 = [17 x i8] c"Incorrect input.\00"
@EXIT_FAILURE = global i32 0
@.str.2 = [3 x i8] c"AM\00"
@.str.3 = [3 x i8] c"PM\00"
@.str.4 = [10 x i8] c"bear time\00"
@.str.5 = [14 x i8] c"non-bear time\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca i8*
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %3, i32 10, i32 %4)
%6 = call i32 @remove_new_line(i8* %3)
%7 = call i8* @strtok(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = bitcast i8** %2 to i8*
%9 = call i64 @strtol(i8* %7, i8** %2, i32 10)
%10 = trunc i64 %9 to i32
%11 = add i32 %10, -13
%12 = icmp ult i32 %11, -12
br i1 %12, label %13, label %17
13: ; preds = %0
%14 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %0
%18 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%19 = call i64 @strtol(i8* %18, i8** %2, i32 10)
%20 = trunc i64 %19 to i32
%21 = icmp ugt i32 %20, 59
br i1 %21, label %22, label %26
22: ; preds = %17
%23 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%24 = load i32, i32* @EXIT_FAILURE
%25 = call i32 @exit(i32 %24)
unreachable
26: ; preds = %17
%27 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %37, label %30
30: ; preds = %26
%31 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %37, label %33
33: ; preds = %30
%34 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%35 = load i32, i32* @EXIT_FAILURE
%36 = call i32 @exit(i32 %35)
unreachable
37: ; preds = %26, %30
%38 = load i8, i8* %27
%39 = icmp eq i8 %38, 80
%40 = icmp ult i32 %10, 3
%41 = icmp eq i8 %38, 65
%42 = select i1 %40, i1 %41, i1 false
%43 = select i1 %39, i1 true, i1 %42
%44 = select i1 %43, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0)
%45 = call i32 @printf(i8* dereferenceable(1) %44)
%46 = load i32, i32* @EXIT_SUCCESS
ret i32 %46
}