#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 get_time_day();
int get_time_dow();
int get_time_hour();
int get_time_minute();
int get_time_month();
int get_time_second();
char *get_time_timezone();
int get_time_utc_offset();
int get_time_year();
int /*<<< orphan*/ printf(char *, ...);
void print_time(int action) {
  static const char *const dow[8] = {"Sun", "Mon", "Tue", "Wed",
                                     "Thu", "Fri", "Sat", ""};
  if (action == 0) {
    printf("Remote time is ");
  } else {
    printf("Remote time has been set to ");
  }
  printf("%04i/%02i/%02i %s %02i:%02i:%02i %+i %s\n", get_time_year(),
         get_time_month(), get_time_day(), dow[get_time_dow() & 7],
         get_time_hour(), get_time_minute(), get_time_second(),
         get_time_utc_offset(), get_time_timezone());
}


x86 assembly (clang, -O0):
<print_time>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x48,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    11c9 <print_time+0x29>
lea    0xe5f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    11d7 <print_time+0x37>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    $0x0,%al
call   1060 <get_time_year@plt>
mov    %eax,-0x2c(%rbp)
mov    $0x0,%al
call   1040 <get_time_month@plt>
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   1080 <get_time_day@plt>
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1090 <get_time_dow@plt>
and    $0x7,%eax
movslq %eax,%rcx
lea    0x2bd7(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    $0x0,%al
call   1030 <get_time_hour@plt>
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   10b0 <get_time_minute@plt>
mov    %eax,%ebx
mov    $0x0,%al
call   10a0 <get_time_second@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   10c0 <get_time_utc_offset@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <get_time_timezone@plt>
mov    -0x2c(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%r8
mov    -0x18(%rbp),%r9d
mov    -0x14(%rbp),%r11d
mov    -0x10(%rbp),%r10d
lea    0xdea(%rip),%rdi
mov    %ebx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %rax,0x18(%rsp)
mov    $0x0,%al
call   1070 <printf@plt>
add    $0x48,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_time>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %edi,%edi
lea    0xe85(%rip),%rax
lea    0xe8e(%rip),%rdi
cmove  %rax,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
call   1060 <get_time_year@plt>
mov    %eax,0x14(%rsp)
xor    %eax,%eax
call   1040 <get_time_month@plt>
mov    %eax,0x10(%rsp)
xor    %eax,%eax
call   1080 <get_time_day@plt>
mov    %eax,0xc(%rsp)
xor    %eax,%eax
call   1090 <get_time_dow@plt>
and    $0x7,%eax
lea    0xe05(%rip),%rcx
movslq (%rcx,%rax,4),%rbp
add    %rcx,%rbp
xor    %eax,%eax
call   1030 <get_time_hour@plt>
mov    %eax,%r12d
xor    %eax,%eax
call   10b0 <get_time_minute@plt>
mov    %eax,%r13d
xor    %eax,%eax
call   10a0 <get_time_second@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   10c0 <get_time_utc_offset@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1050 <get_time_timezone@plt>
mov    %rax,%rbx
lea    0xe2e(%rip),%rdi
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    %rbp,%r8
mov    %r12d,%r9d
xor    %eax,%eax
push   %rbx
push   %r15
push   %r14
push   %r13
call   1070 <printf@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@print_time.dow = internal constant [8 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.7, i32 0, i32 0)]
@.str = [4 x i8] c"Sun\00"
@.str.1 = [4 x i8] c"Mon\00"
@.str.2 = [4 x i8] c"Tue\00"
@.str.3 = [4 x i8] c"Wed\00"
@.str.4 = [4 x i8] c"Thu\00"
@.str.5 = [4 x i8] c"Fri\00"
@.str.6 = [4 x i8] c"Sat\00"
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [16 x i8] c"Remote time is \00"
@.str.9 = [29 x i8] c"Remote time has been set to \00"
@.str.10 = [41 x i8] c"%04i/%02i/%02i %s %02i:%02i:%02i %+i %s\0A\00"
define void @print_time(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
br label %9
7: ; preds = %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
%10 = call i32 (...) @get_time_year()
%11 = call i32 (...) @get_time_month()
%12 = call i32 (...) @get_time_day()
%13 = call i32 (...) @get_time_dow()
%14 = and i32 %13, 7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [8 x i8*], [8 x i8*]* @print_time.dow, i64 0, i64 %15
%17 = load i8*, i8** %16
%18 = call i32 (...) @get_time_hour()
%19 = call i32 (...) @get_time_minute()
%20 = call i32 (...) @get_time_second()
%21 = call i32 (...) @get_time_utc_offset()
%22 = call i8* (...) @get_time_timezone()
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.10, i64 0, i64 0), i32 %10, i32 %11, i32 %12, i8* %17, i32 %18, i32 %19, i32 %20, i32 %21, i8* %22)
ret void
}

LLVM IR (-O2):
@reltable.print_time = internal unnamed_addr constant [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.print_time to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_time to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_time to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.3 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_time to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_time to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.5 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_time to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.6 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_time to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([1 x i8]* @.str.7 to i64), i64 ptrtoint ([8 x i32]* @reltable.print_time to i64)) to i32)]
@.str = [4 x i8] c"Sun\00"
@.str.1 = [4 x i8] c"Mon\00"
@.str.2 = [4 x i8] c"Tue\00"
@.str.3 = [4 x i8] c"Wed\00"
@.str.4 = [4 x i8] c"Thu\00"
@.str.5 = [4 x i8] c"Fri\00"
@.str.6 = [4 x i8] c"Sat\00"
@.str.7 = [1 x i8] zeroinitializer
@.str.8 = [16 x i8] c"Remote time is \00"
@.str.9 = [29 x i8] c"Remote time has been set to \00"
@.str.10 = [41 x i8] c"%04i/%02i/%02i %s %02i:%02i:%02i %+i %s\0A\00"
define void @print_time(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %3)
%5 = tail call i32 (...) @get_time_year()
%6 = tail call i32 (...) @get_time_month()
%7 = tail call i32 (...) @get_time_day()
%8 = tail call i32 (...) @get_time_dow()
%9 = and i32 %8, 7
%10 = zext i32 %9 to i64
%11 = shl i64 %10, 2
%12 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.print_time to i8*), i64 %11)
%13 = tail call i32 (...) @get_time_hour()
%14 = tail call i32 (...) @get_time_minute()
%15 = tail call i32 (...) @get_time_second()
%16 = tail call i32 (...) @get_time_utc_offset()
%17 = tail call i8* (...) @get_time_timezone()
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.10, i64 0, i64 0), i32 %5, i32 %6, i32 %7, i8* %12, i32 %13, i32 %14, i32 %15, i32 %16, i8* %17)
ret void
}