#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  size_t tm_isdst;
};

/* Variables and functions */
char *asctime(struct tm *);
struct tm *gmtime(int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
scalar_t__ strcmp(char *, char *);
int strlen(char const *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
char **tzname;
int /*<<< orphan*/ usage();
int /*<<< orphan*/ write(int, char const *, int);
int main(int argc, char *argv[]) {
  time_t t;
  struct tm *tm;
  const char *ts, *z;
  int utc = 0;
  if (argc > 1 && strcmp(argv[1], "-u") == 0) {
    utc = 1;
    argc--;
  }
  if (argc != 1)
    usage();
  time(&t);
  if (utc)
    tm = gmtime(&t);
  else
    tm = localtime(&t);
  ts = asctime(tm);
  write(1, ts, 20);
  z = tzname[tm->tm_isdst];
  write(1, z, strlen(z));
  write(1, ts + 19, 6);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x34(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11d5 <main+0x55>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe4a(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    11d5 <main+0x55>
movl   $0x1,-0x34(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     11e6 <main+0x66>
mov    $0x0,%al
call   1090 <usage@plt>
lea    -0x14(%rbp),%rdi
call   1080 <time@plt>
cmpl   $0x0,-0x34(%rbp)
je     120b <main+0x8b>
lea    -0x14(%rbp),%rdi
call   10a0 <gmtime@plt>
mov    %rax,-0x20(%rbp)
jmp    1218 <main+0x98>
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1060 <asctime@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
mov    $0x1,%edi
mov    $0x14,%edx
call   1040 <write@plt>
mov    0x2da1(%rip),%rax
mov    (%rax),%rax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x40(%rbp),%rsi
mov    %eax,%edx
mov    $0x1,%edi
call   1040 <write@plt>
mov    -0x28(%rbp),%rsi
add    $0x13,%rsi
mov    $0x1,%edi
mov    $0x6,%edx
call   1040 <write@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    $0x2,%edi
jl     11a9 <main+0x29>
mov    0x8(%rsi),%rdi
lea    0xe6a(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     11ba <main+0x3a>
xor    %eax,%eax
call   1090 <usage@plt>
jmp    11ae <main+0x2e>
cmp    $0x1,%ebx
jne    11cb <main+0x4b>
lea    0x4(%rsp),%rdi
call   1080 <time@plt>
jmp    11ed <main+0x6d>
cmp    $0x2,%ebx
jne    11cb <main+0x4b>
lea    0x4(%rsp),%rdi
call   1080 <time@plt>
jmp    11e1 <main+0x61>
xor    %eax,%eax
call   1090 <usage@plt>
lea    0x4(%rsp),%rdi
call   1080 <time@plt>
cmp    $0x1,%ebx
jle    11ed <main+0x6d>
lea    0x4(%rsp),%rdi
call   10a0 <gmtime@plt>
jmp    11f7 <main+0x77>
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1060 <asctime@plt>
mov    %rax,%rbx
mov    $0x1,%edi
mov    %rax,%rsi
mov    $0x14,%edx
call   1040 <write@plt>
mov    0x2dc2(%rip),%rax
mov    (%rax),%rax
mov    (%r14),%rcx
mov    (%rax,%rcx,8),%r14
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <write@plt>
add    $0x13,%rbx
mov    $0x1,%edi
mov    %rbx,%rsi
mov    $0x6,%edx
call   1040 <write@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i64 }
@.str = [3 x i8] c"-u\00"
@tzname = global i8** null
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.tm*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %10
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %22
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %13
store i32 1, i32* %10
%20 = load i32, i32* %4
%21 = add nsw i32 %20, -1
store i32 %21, i32* %4
br label %22
22: ; preds = %19, %13, %2
%23 = load i32, i32* %4
%24 = icmp ne i32 %23, 1
br i1 %24, label %25, label %27
25: ; preds = %22
%26 = call i32 (...) @usage()
br label %27
27: ; preds = %25, %22
%28 = call i32 @time(i32* %6)
%29 = load i32, i32* %10
%30 = icmp ne i32 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call %struct.tm* @gmtime(i32* %6)
store %struct.tm* %32, %struct.tm** %7
br label %35
33: ; preds = %27
%34 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %34, %struct.tm** %7
br label %35
35: ; preds = %33, %31
%36 = load %struct.tm*, %struct.tm** %7
%37 = call i8* @asctime(%struct.tm* %36)
store i8* %37, i8** %8
%38 = load i8*, i8** %8
%39 = call i32 @write(i32 1, i8* %38, i32 20)
%40 = load i8**, i8*** @tzname
%41 = load %struct.tm*, %struct.tm** %7
%42 = getelementptr inbounds %struct.tm, %struct.tm* %41, i32 0, i32 0
%43 = load i64, i64* %42
%44 = getelementptr inbounds i8*, i8** %40, i64 %43
%45 = load i8*, i8** %44
store i8* %45, i8** %9
%46 = load i8*, i8** %9
%47 = load i8*, i8** %9
%48 = call i32 @strlen(i8* %47)
%49 = call i32 @write(i32 1, i8* %46, i32 %48)
%50 = load i8*, i8** %8
%51 = getelementptr inbounds i8, i8* %50, i64 19
%52 = call i32 @write(i32 1, i8* %51, i32 6)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i64 }
@.str = [3 x i8] c"-u\00"
@tzname = global i8** null
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %22
11: ; preds = %6
%12 = icmp eq i32 %0, 2
br i1 %12, label %18, label %15
13: ; preds = %2
%14 = icmp eq i32 %0, 1
br i1 %14, label %24, label %15
15: ; preds = %13, %11
%16 = tail call i32 (...) @usage()
%17 = call i32 @time(i32* %3)
br i1 %5, label %20, label %26
18: ; preds = %11
%19 = call i32 @time(i32* %3)
br label %20
20: ; preds = %18, %15
%21 = call %struct.tm* @gmtime(i32* %3)
br label %28
22: ; preds = %6
%23 = tail call i32 (...) @usage()
br label %24
24: ; preds = %13, %22
%25 = call i32 @time(i32* %3)
br label %26
26: ; preds = %24, %15
%27 = call %struct.tm* @localtime(i32* %3)
br label %28
28: ; preds = %26, %20
%29 = phi %struct.tm* [ %21, %20 ], [ %27, %26 ]
%30 = call i8* @asctime(%struct.tm* %29)
%31 = call i32 @write(i32 1, i8* %30, i32 20)
%32 = load i8**, i8*** @tzname
%33 = getelementptr inbounds %struct.tm, %struct.tm* %29, i64 0, i32 0
%34 = load i64, i64* %33
%35 = getelementptr inbounds i8*, i8** %32, i64 %34
%36 = load i8*, i8** %35
%37 = call i32 @strlen(i8* %36)
%38 = call i32 @write(i32 1, i8* %36, i32 %37)
%39 = getelementptr inbounds i8, i8* %30, i64 19
%40 = call i32 @write(i32 1, i8* %39, i32 6)
ret i32 0
}