#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_wday;
  int tm_hour;
};

/* Variables and functions */
struct tm *localtime(long *);
long time(int /*<<< orphan*/);
int workhours() {
  long tc;
  struct tm *t_info;
  tc = time(0);
  t_info = localtime(&tc);
  return ((t_info->tm_wday > 0) && (t_info->tm_wday < 6) &&
          (t_info->tm_hour >= 9) && (t_info->tm_hour < 17));
}


x86 assembly (clang, -O0):
<workhours>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %edi,%edi
call   1040 <time@plt>
mov    %rax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x0,(%rcx)
mov    %al,-0x11(%rbp)
jle    1185 <workhours+0x65>
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x6,(%rcx)
mov    %al,-0x11(%rbp)
jge    1185 <workhours+0x65>
mov    -0x10(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x9,0x4(%rcx)
mov    %al,-0x11(%rbp)
jl     1185 <workhours+0x65>
mov    -0x10(%rbp),%rax
cmpl   $0x11,0x4(%rax)
setl   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<workhours>:
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
xor    %edi,%edi
call   1040 <time@plt>
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%ecx
add    $0xffffffff,%ecx
cmp    $0x4,%ecx
ja     1157 <workhours+0x37>
mov    0x4(%rax),%eax
cmp    $0x9,%eax
jl     1157 <workhours+0x37>
xor    %ebx,%ebx
cmp    $0x11,%eax
setb   %bl
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32 }
define i32 @workhours() {
%1 = alloca i64
%2 = alloca %struct.tm*
%3 = call i64 @time(i32 0)
store i64 %3, i64* %1
%4 = call %struct.tm* @localtime(i64* %1)
store %struct.tm* %4, %struct.tm** %2
%5 = load %struct.tm*, %struct.tm** %2
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %24
9: ; preds = %0
%10 = load %struct.tm*, %struct.tm** %2
%11 = getelementptr inbounds %struct.tm, %struct.tm* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = icmp slt i32 %12, 6
br i1 %13, label %14, label %24
14: ; preds = %9
%15 = load %struct.tm*, %struct.tm** %2
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = icmp sge i32 %17, 9
br i1 %18, label %19, label %24
19: ; preds = %14
%20 = load %struct.tm*, %struct.tm** %2
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 1
%22 = load i32, i32* %21
%23 = icmp slt i32 %22, 17
br label %24
24: ; preds = %19, %14, %9, %0
%25 = phi i1 [ false, %14 ], [ false, %9 ], [ false, %0 ], [ %23, %19 ]
%26 = zext i1 %25 to i32
ret i32 %26
}

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