#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 */
struct tm {
  int tm_hour;
};

/* Variables and functions */
struct tm *localtime(long *);
int /*<<< orphan*/ time(long *);
int MaxSlot(void) {
  long t;
  struct tm *tv;
  time(&t);
  tv = localtime(&t);
  if (tv == NULL)
    return (0);
  if (tv->tm_hour < 7)
    return (20);
  if (tv->tm_hour < 21)
    return (12);
  if (tv->tm_hour < 23)
    return (16);
  if (tv->tm_hour == 23)
    return (20);
  return (8);
}


x86 assembly (clang, -O0):
<MaxSlot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
call   1040 <time@plt>
lea    -0x10(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1155 <MaxSlot+0x35>
movl   $0x0,-0x4(%rbp)
jmp    11c0 <MaxSlot+0xa0>
mov    -0x18(%rbp),%rax
cmpl   $0x7,(%rax)
jge    116e <MaxSlot+0x4e>
movl   $0x14,-0x4(%rbp)
jmp    11c0 <MaxSlot+0xa0>
mov    -0x18(%rbp),%rax
cmpl   $0x15,(%rax)
jge    1187 <MaxSlot+0x67>
movl   $0xc,-0x4(%rbp)
jmp    11c0 <MaxSlot+0xa0>
mov    -0x18(%rbp),%rax
cmpl   $0x17,(%rax)
jge    11a0 <MaxSlot+0x80>
movl   $0x10,-0x4(%rbp)
jmp    11c0 <MaxSlot+0xa0>
mov    -0x18(%rbp),%rax
cmpl   $0x17,(%rax)
jne    11b9 <MaxSlot+0x99>
movl   $0x14,-0x4(%rbp)
jmp    11c0 <MaxSlot+0xa0>
movl   $0x8,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MaxSlot>:
push   %rbx
sub    $0x10,%rsp
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
test   %rax,%rax
je     116e <MaxSlot+0x4e>
mov    (%rax),%ecx
mov    $0x14,%eax
cmp    $0x7,%ecx
jl     1170 <MaxSlot+0x50>
mov    $0xc,%eax
cmp    $0x15,%ecx
jb     1170 <MaxSlot+0x50>
mov    $0x10,%eax
cmp    $0x17,%ecx
jb     1170 <MaxSlot+0x50>
mov    $0x14,%ecx
mov    $0x8,%eax
cmove  %ecx,%eax
jmp    1170 <MaxSlot+0x50>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
define i32 @MaxSlot() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca %struct.tm*
%4 = call i32 @time(i64* %2)
%5 = call %struct.tm* @localtime(i64* %2)
store %struct.tm* %5, %struct.tm** %3
%6 = load %struct.tm*, %struct.tm** %3
%7 = icmp eq %struct.tm* %6, null
br i1 %7, label %8, label %9
8: ; preds = %0
store i32 0, i32* %1
br label %34
9: ; preds = %0
%10 = load %struct.tm*, %struct.tm** %3
%11 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = icmp slt i32 %12, 7
br i1 %13, label %14, label %15
14: ; preds = %9
store i32 20, i32* %1
br label %34
15: ; preds = %9
%16 = load %struct.tm*, %struct.tm** %3
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 0
%18 = load i32, i32* %17
%19 = icmp slt i32 %18, 21
br i1 %19, label %20, label %21
20: ; preds = %15
store i32 12, i32* %1
br label %34
21: ; preds = %15
%22 = load %struct.tm*, %struct.tm** %3
%23 = getelementptr inbounds %struct.tm, %struct.tm* %22, i32 0, i32 0
%24 = load i32, i32* %23
%25 = icmp slt i32 %24, 23
br i1 %25, label %26, label %27
26: ; preds = %21
store i32 16, i32* %1
br label %34
27: ; preds = %21
%28 = load %struct.tm*, %struct.tm** %3
%29 = getelementptr inbounds %struct.tm, %struct.tm* %28, i32 0, i32 0
%30 = load i32, i32* %29
%31 = icmp eq i32 %30, 23
br i1 %31, label %32, label %33
32: ; preds = %27
store i32 20, i32* %1
br label %34
33: ; preds = %27
store i32 8, i32* %1
br label %34
34: ; preds = %33, %32, %26, %20, %14, %8
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
%struct.tm = type { i32 }
define i32 @MaxSlot() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
%3 = call i32 @time(i64* %1)
%4 = call %struct.tm* @localtime(i64* %1)
%5 = icmp eq %struct.tm* %4, null
br i1 %5, label %17, label %6
6: ; preds = %0
%7 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%8 = load i32, i32* %7
%9 = icmp slt i32 %8, 7
br i1 %9, label %17, label %10
10: ; preds = %6
%11 = icmp ult i32 %8, 21
br i1 %11, label %17, label %12
12: ; preds = %10
%13 = icmp ult i32 %8, 23
br i1 %13, label %17, label %14
14: ; preds = %12
%15 = icmp eq i32 %8, 23
%16 = select i1 %15, i32 20, i32 8
br label %17
17: ; preds = %14, %12, %10, %6, %0
%18 = phi i32 [ 0, %0 ], [ 20, %6 ], [ 12, %10 ], [ 16, %12 ], [ %16, %14 ]
ret i32 %18
}