#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 *, ...);
void ft_takes_place(int hour) {
  printf("THE FOLLOWING TAKES PLACE BETWEEN ");
  if (hour == 0 || hour == 24)
    printf("12.00 A.M. AND 1.00 A.M.\n");
  else if (hour < 11)
    printf("%d.00 A.M. AND %d.00 A.M.\n", hour, (hour + 1) % 12);
  else if (hour == 11)
    printf("11.00 A.M. AND 12.00 P.M.\n");
  else if (hour == 12)
    printf("12.00 P.M. AND 1.00 P.M.\n");
  else if (hour > 12 && hour < 23)
    printf("%d.00 P.M. AND %d.00 P.M.\n", hour % 12, (hour + 1) % 12);
  else if (hour == 23)
    printf("11.00 P.M. AND 12.00 A.M.\n");
}


x86 assembly (clang, -O0):
<ft_takes_place>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
je     113d <ft_takes_place+0x2d>
cmpl   $0x18,-0x4(%rbp)
jne    1150 <ft_takes_place+0x40>
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122b <ft_takes_place+0x11b>
cmpl   $0xb,-0x4(%rbp)
jge    117e <ft_takes_place+0x6e>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1226 <ft_takes_place+0x116>
cmpl   $0xb,-0x4(%rbp)
jne    119b <ft_takes_place+0x8b>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1221 <ft_takes_place+0x111>
cmpl   $0xc,-0x4(%rbp)
jne    11b8 <ft_takes_place+0xa8>
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121c <ft_takes_place+0x10c>
cmpl   $0xc,-0x4(%rbp)
jle    11fa <ft_takes_place+0xea>
cmpl   $0x17,-0x4(%rbp)
jge    11fa <ft_takes_place+0xea>
mov    -0x4(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1217 <ft_takes_place+0x107>
cmpl   $0x17,-0x4(%rbp)
jne    1212 <ft_takes_place+0x102>
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1217 <ft_takes_place+0x107>
jmp    121c <ft_takes_place+0x10c>
jmp    1221 <ft_takes_place+0x111>
jmp    1226 <ft_takes_place+0x116>
jmp    122b <ft_takes_place+0x11b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_takes_place>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x18,%ebx
je     113a <ft_takes_place+0x1a>
test   %ebx,%ebx
jne    1147 <ft_takes_place+0x27>
lea    0xf65(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
cmp    $0xa,%ebx
jg     1184 <ft_takes_place+0x64>
lea    0x1(%rbx),%eax
cltq
imul   $0x2aaaaaab,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x21,%rax
add    %ecx,%eax
shl    $0x2,%eax
lea    (%rax,%rax,2),%eax
neg    %eax
lea    (%rbx,%rax,1),%edx
add    $0x1,%edx
lea    0xea9(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
pop    %rbx
jmp    1040 <printf@plt>
cmp    $0xc,%ebx
je     119b <ft_takes_place+0x7b>
cmp    $0xb,%ebx
jne    11a8 <ft_takes_place+0x88>
lea    0xef7(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
lea    0xed1(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
cmp    $0x16,%ebx
ja     11e8 <ft_takes_place+0xc8>
movzbl %bl,%eax
imul   $0xab,%eax,%ecx
shr    $0x9,%ecx
and    $0xfffffffc,%ecx
lea    (%rcx,%rcx,2),%ecx
mov    %eax,%edx
sub    %cl,%dl
movzbl %dl,%esi
add    $0x1,%al
movzbl %al,%eax
imul   $0xab,%eax,%ecx
shr    $0x9,%ecx
and    $0xfffffffc,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %cl,%al
movzbl %al,%edx
lea    0xe58(%rip),%rdi
jmp    117c <ft_takes_place+0x5c>
cmp    $0x17,%ebx
jne    11fa <ft_takes_place+0xda>
lea    0xe65(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"THE FOLLOWING TAKES PLACE BETWEEN \00"
@.str.1 = [26 x i8] c"12.00 A.M. AND 1.00 A.M.\0A\00"
@.str.2 = [27 x i8] c"%d.00 A.M. AND %d.00 A.M.\0A\00"
@.str.3 = [27 x i8] c"11.00 A.M. AND 12.00 P.M.\0A\00"
@.str.4 = [26 x i8] c"12.00 P.M. AND 1.00 P.M.\0A\00"
@.str.5 = [27 x i8] c"%d.00 P.M. AND %d.00 P.M.\0A\00"
@.str.6 = [27 x i8] c"11.00 P.M. AND 12.00 A.M.\0A\00"
define void @ft_takes_place(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 24
br i1 %8, label %9, label %11
9: ; preds = %6, %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %53
11: ; preds = %6
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 11
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i32, i32* %2
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
%18 = srem i32 %17, 12
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %18)
br label %52
20: ; preds = %11
%21 = load i32, i32* %2
%22 = icmp eq i32 %21, 11
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
br label %51
25: ; preds = %20
%26 = load i32, i32* %2
%27 = icmp eq i32 %26, 12
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %50
30: ; preds = %25
%31 = load i32, i32* %2
%32 = icmp sgt i32 %31, 12
br i1 %32, label %33, label %43
33: ; preds = %30
%34 = load i32, i32* %2
%35 = icmp slt i32 %34, 23
br i1 %35, label %36, label %43
36: ; preds = %33
%37 = load i32, i32* %2
%38 = srem i32 %37, 12
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
%41 = srem i32 %40, 12
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %38, i32 %41)
br label %49
43: ; preds = %33, %30
%44 = load i32, i32* %2
%45 = icmp eq i32 %44, 23
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
br label %48
48: ; preds = %46, %43
br label %49
49: ; preds = %48, %36
br label %50
50: ; preds = %49, %28
br label %51
51: ; preds = %50, %23
br label %52
52: ; preds = %51, %14
br label %53
53: ; preds = %52, %9
ret void
}

LLVM IR (-O2):
@.str = [35 x i8] c"THE FOLLOWING TAKES PLACE BETWEEN \00"
@.str.2 = [27 x i8] c"%d.00 A.M. AND %d.00 A.M.\0A\00"
@.str.5 = [27 x i8] c"%d.00 P.M. AND %d.00 P.M.\0A\00"
@str = [26 x i8] c"11.00 P.M. AND 12.00 A.M.\00"
@str.7 = [25 x i8] c"12.00 P.M. AND 1.00 P.M.\00"
@str.8 = [26 x i8] c"11.00 A.M. AND 12.00 P.M.\00"
@str.9 = [25 x i8] c"12.00 A.M. AND 1.00 A.M.\00"
define void @ft_takes_place(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
switch i32 %0, label %5 [
i32 24, label %3
i32 0, label %3
]
3: ; preds = %1, %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.9, i64 0, i64 0))
br label %30
5: ; preds = %1
%6 = icmp slt i32 %0, 11
br i1 %6, label %7, label %11
7: ; preds = %5
%8 = add nsw i32 %0, 1
%9 = srem i32 %8, 12
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %0, i32 %9)
br label %30
11: ; preds = %5
switch i32 %0, label %16 [
i32 11, label %12
i32 12, label %14
]
12: ; preds = %11
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.8, i64 0, i64 0))
br label %30
14: ; preds = %11
%15 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.7, i64 0, i64 0))
br label %30
16: ; preds = %11
%17 = icmp ult i32 %0, 23
br i1 %17, label %18, label %26
18: ; preds = %16
%19 = trunc i32 %0 to i8
%20 = urem i8 %19, 12
%21 = zext i8 %20 to i32
%22 = add nuw nsw i8 %19, 1
%23 = urem i8 %22, 12
%24 = zext i8 %23 to i32
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %21, i32 %24)
br label %30
26: ; preds = %16
%27 = icmp eq i32 %0, 23
br i1 %27, label %28, label %30
28: ; preds = %26
%29 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %30
30: ; preds = %7, %14, %26, %28, %18, %12, %3
ret void
}