#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 option {
  char *member_0;
  char member_3;
  int /*<<< orphan*/ member_2;
  int /*<<< orphan*/ member_1;
};

/* Variables and functions */
int EOF;
char *ctime(int /*<<< orphan*/ *);
scalar_t__ errno;
int getopt_long(int, char **, char *, struct option *, int *);
int /*<<< orphan*/ help();
int optind;
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strtoul(char *, char **, int);
int /*<<< orphan*/ version();
int main(int argc, char *argv[]) {
  int i;
  time_t time;
  char *ep;
  int cmd_x = 0;
  char stropts[] = "htfv";
  int optch;
  int cmd_t = 0;
  int cmd_f = 0;
  struct option long_opts[] = {{"help", 0, 0, 'h'},
                               {"version", 0, 0, 'v'},
                               {"time", 0, 0, 't'},
                               {"format", 0, 0, 'f'},
                               {NULL, 0, 0, 0}};
  while ((optch = getopt_long(argc, argv, stropts, long_opts, &cmd_x)) != EOF) {
    switch (optch) {
    case 'h':
      help();
      return 0;
    case 'v':
      version();
      return 0;
    case 't':
      cmd_t = 1;
      break;
    case 'f':
      cmd_f = 0;
      break;
    default:
      printf("Unkown option, try -h or --help for help.\n");
      break;
    }
  }
  if (argc - optind < 1) {
    printf("Missing input arguments\n");
    return 0;
  }
  if (cmd_t) {
    printf("option -t specified\n");
  }
  if (cmd_f) {
    printf("option -f specified\n");
  }
  for (i = optind; i < argc; i++) {
    errno = 0;
    time = strtoul(argv[i], &ep, 10);
    if (errno) {
      perror(argv[i]);
      continue;
    }
    printf("%s", ctime(&time));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
mov    0xe9e(%rip),%eax
mov    %eax,-0x29(%rbp)
mov    0xe99(%rip),%al
mov    %al,-0x25(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    -0xb0(%rbp),%rdi
lea    0x2bc2(%rip),%rsi
mov    $0x78,%edx
call   1060 <memcpy@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x29(%rbp),%rdx
lea    -0xb0(%rbp),%rcx
lea    -0x24(%rbp),%r8
call   1040 <getopt_long@plt>
mov    %eax,-0x30(%rbp)
mov    0x2deb(%rip),%rcx
cmp    (%rcx),%eax
je     1285 <main+0x105>
mov    -0x30(%rbp),%eax
add    $0xffffff9a,%eax
mov    %eax,%ecx
mov    %rcx,-0xb8(%rbp)
sub    $0x10,%eax
ja     1272 <main+0xf2>
mov    -0xb8(%rbp),%rax
lea    0xdd5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   10a0 <help@plt>
movl   $0x0,-0x4(%rbp)
jmp    137d <main+0x1fd>
mov    $0x0,%al
call   1070 <version@plt>
movl   $0x0,-0x4(%rbp)
jmp    137d <main+0x1fd>
movl   $0x1,-0x34(%rbp)
jmp    1280 <main+0x100>
movl   $0x0,-0x38(%rbp)
jmp    1280 <main+0x100>
lea    0xde9(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11d8 <main+0x58>
mov    -0x8(%rbp),%eax
mov    0x2d51(%rip),%rcx
sub    (%rcx),%eax
cmp    $0x1,%eax
jge    12b4 <main+0x134>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    137d <main+0x1fd>
cmpl   $0x0,-0x34(%rbp)
je     12cc <main+0x14c>
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x38(%rbp)
je     12e4 <main+0x164>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2cf5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1376 <main+0x1f6>
mov    0x2ccd(%rip),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x20(%rbp),%rsi
mov    $0xa,%edx
call   1090 <strtoul@plt>
mov    %eax,-0x18(%rbp)
mov    0x2ca2(%rip),%rax
cmpq   $0x0,(%rax)
je     134e <main+0x1ce>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1080 <perror@plt>
jmp    1368 <main+0x1e8>
lea    -0x18(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,%rsi
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12f0 <main+0x170>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
movl   $0x0,0x10(%rsp)
movb   $0x0,0xc(%rsp)
movl   $0x76667468,0x8(%rsp)
76
mov    0x2c4e(%rip),%rax
mov    %rax,0x90(%rsp)
movaps 0x2c2f(%rip),%xmm0
movaps %xmm0,0x80(%rsp)
movaps 0x2c10(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0x2bf4(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0x2bd8(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0x2bbc(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0x2ba0(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0x2b84(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
lea    0x8(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0x10(%rsp),%r8
call   1050 <getopt_long@plt>
mov    0x2dbc(%rip),%rcx
cmp    (%rcx),%eax
jne    1246 <main+0xc6>
mov    0x2da9(%rip),%rax
mov    (%rax),%eax
cmp    %ebx,%eax
jl     12df <main+0x15f>
jmp    1363 <main+0x1e3>
xor    %r13d,%r13d
lea    0x10(%rsp),%rbp
lea    0xdab(%rip),%r12
jmp    1291 <main+0x111>
nopw   0x0(%rax,%rax,1)
lea    0xe0a(%rip),%rdi
call   1030 <puts@plt>
mov    %r15d,%r13d
mov    %ebx,%edi
mov    %r14,%rsi
lea    0x8(%rsp),%rdx
lea    0x20(%rsp),%rcx
mov    %rbp,%r8
call   1050 <getopt_long@plt>
mov    0x2d5b(%rip),%rcx
cmp    (%rcx),%eax
je     12b9 <main+0x139>
mov    %r13d,%r15d
add    $0xffffff9a,%eax
ror    %eax
cmp    $0x8,%eax
ja     1260 <main+0xe0>
mov    $0x1,%r13d
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
xor    %eax,%eax
call   10a0 <help@plt>
jmp    1378 <main+0x1f8>
mov    0x2d20(%rip),%rbp
mov    0x0(%rbp),%eax
cmp    %ebx,%eax
jge    1363 <main+0x1e3>
test   %r13d,%r13d
je     12df <main+0x15f>
lea    0xd6e(%rip),%rdi
call   1030 <puts@plt>
mov    0x0(%rbp),%eax
cmp    %ebx,%eax
jge    1378 <main+0x1f8>
movslq %eax,%rcx
lea    (%r14,%rcx,8),%r13
sub    %eax,%ebx
mov    0x2cd9(%rip),%rbp
lea    0x18(%rsp),%r14
lea    0xd3f(%rip),%r12
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
movq   $0x0,0x0(%rbp)
mov    0x0(%r13,%r15,8),%rdi
mov    %r14,%rsi
mov    $0xa,%edx
call   1090 <strtoul@plt>
mov    %eax,0x14(%rsp)
cmpq   $0x0,0x0(%rbp)
jne    1357 <main+0x1d7>
lea    0x14(%rsp),%rdi
call   1040 <ctime@plt>
mov    %r12,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%r15
cmp    %r15d,%ebx
jne    1310 <main+0x190>
jmp    1378 <main+0x1f8>
mov    0x0(%r13,%r15,8),%rdi
call   1080 <perror@plt>
jmp    134c <main+0x1cc>
lea    0xcef(%rip),%rdi
call   1030 <puts@plt>
jmp    1378 <main+0x1f8>
xor    %eax,%eax
call   1070 <version@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.option = type { i8*, i8, i32, i32 }
@__const.main.stropts = [5 x i8] c"htfv\00"
@.str = [5 x i8] c"help\00"
@.str.1 = [8 x i8] c"version\00"
@.str.2 = [5 x i8] c"time\00"
@.str.3 = [7 x i8] c"format\00"
@__const.main.long_opts = [5 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8 0, i32 0, i32 104 }, %struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8 0, i32 0, i32 118 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8 0, i32 0, i32 116 }, %struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8 0, i32 0, i32 102 }, %struct.option zeroinitializer]
@EOF = global i32 0
@.str.4 = [43 x i8] c"Unkown option, try -h or --help for help.\0A\00"
@optind = global i32 0
@.str.5 = [25 x i8] c"Missing input arguments\0A\00"
@.str.6 = [21 x i8] c"option -t specified\0A\00"
@.str.7 = [21 x i8] c"option -f specified\0A\00"
@errno = global i64 0
@.str.8 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca [5 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca [5 x %struct.option]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %9
%15 = bitcast [5 x i8]* %10 to i8*
store i32 0, i32* %12
store i32 0, i32* %13
%16 = bitcast [5 x %struct.option]* %14 to i8*
br label %17
17: ; preds = %35, %2
%18 = load i32, i32* %4
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds [5 x i8], [5 x i8]* %10, i64 0, i64 0
%21 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %14, i64 0, i64 0
%22 = call i32 @getopt_long(i32 %18, i8** %19, i8* %20, %struct.option* %21, i32* %9)
store i32 %22, i32* %11
%23 = load i32, i32* @EOF
%24 = icmp ne i32 %22, %23
br i1 %24, label %25, label %36
25: ; preds = %17
%26 = load i32, i32* %11
switch i32 %26, label %33 [
i32 104, label %27
i32 118, label %29
i32 116, label %31
i32 102, label %32
]
27: ; preds = %25
%28 = call i32 (...) @help()
store i32 0, i32* %3
br label %82
29: ; preds = %25
%30 = call i32 (...) @version()
store i32 0, i32* %3
br label %82
31: ; preds = %25
store i32 1, i32* %12
br label %35
32: ; preds = %25
store i32 0, i32* %13
br label %35
33: ; preds = %25
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
br label %35
35: ; preds = %33, %32, %31
br label %17
36: ; preds = %17
%37 = load i32, i32* %4
%38 = load i32, i32* @optind
%39 = sub nsw i32 %37, %38
%40 = icmp slt i32 %39, 1
br i1 %40, label %41, label %43
41: ; preds = %36
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %82
43: ; preds = %36
%44 = load i32, i32* %12
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0))
br label %48
48: ; preds = %46, %43
%49 = load i32, i32* %13
%50 = icmp ne i32 %49, 0
br i1 %50, label %51, label %53
51: ; preds = %48
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
br label %53
53: ; preds = %51, %48
%54 = load i32, i32* @optind
store i32 %54, i32* %6
br label %55
55: ; preds = %78, %53
%56 = load i32, i32* %6
%57 = load i32, i32* %4
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %81
59: ; preds = %55
store i64 0, i64* @errno
%60 = load i8**, i8*** %5
%61 = load i32, i32* %6
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8*, i8** %60, i64 %62
%64 = load i8*, i8** %63
%65 = call i32 @strtoul(i8* %64, i8** %8, i32 10)
store i32 %65, i32* %7
%66 = load i64, i64* @errno
%67 = icmp ne i64 %66, 0
br i1 %67, label %68, label %75
68: ; preds = %59
%69 = load i8**, i8*** %5
%70 = load i32, i32* %6
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8*, i8** %69, i64 %71
%73 = load i8*, i8** %72
%74 = call i32 @perror(i8* %73)
br label %78
75: ; preds = %59
%76 = call i8* @ctime(i32* %7)
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %76)
br label %78
78: ; preds = %75, %68
%79 = load i32, i32* %6
%80 = add nsw i32 %79, 1
store i32 %80, i32* %6
br label %55
81: ; preds = %55
store i32 0, i32* %3
br label %82
82: ; preds = %81, %41, %29, %27
%83 = load i32, i32* %3
ret i32 %83
}

LLVM IR (-O2):
%struct.option = type { i8*, i8, i32, i32 }
@__const.main.stropts = [5 x i8] c"htfv\00"
@.str = [5 x i8] c"help\00"
@.str.1 = [8 x i8] c"version\00"
@.str.2 = [5 x i8] c"time\00"
@.str.3 = [7 x i8] c"format\00"
@__const.main.long_opts = [5 x %struct.option] [%struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8 0, i32 0, i32 104 }, %struct.option { i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8 0, i32 0, i32 118 }, %struct.option { i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8 0, i32 0, i32 116 }, %struct.option { i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8 0, i32 0, i32 102 }, %struct.option zeroinitializer]
@EOF = global i32 0
@optind = global i32 0
@errno = global i64 0
@.str.8 = [3 x i8] c"%s\00"
@str = [20 x i8] c"option -t specified\00"
@str.9 = [24 x i8] c"Missing input arguments\00"
@str.10 = [42 x i8] c"Unkown option, try -h or --help for help.\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [5 x i8]
%7 = alloca [5 x %struct.option]
%8 = bitcast i32* %3 to i8*
%9 = bitcast i8** %4 to i8*
%10 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%12 = bitcast [5 x %struct.option]* %7 to i8*
%13 = getelementptr inbounds [5 x %struct.option], [5 x %struct.option]* %7, i64 0, i64 0
%14 = call i32 @getopt_long(i32 %0, i8** %1, i8* %11, %struct.option* %13, i32* %5)
%15 = load i32, i32* @EOF
%16 = icmp eq i32 %14, %15
br i1 %16, label %37, label %17
17: ; preds = %2, %29
%18 = phi i32 [ %31, %29 ], [ %14, %2 ]
%19 = phi i32 [ %30, %29 ], [ 0, %2 ]
%20 = add i32 %18, -102
%21 = call i32 @llvm.fshl.i32(i32 %20, i32 %20, i32 31)
switch i32 %21, label %27 [
i32 1, label %22
i32 8, label %24
i32 7, label %29
i32 0, label %26
]
22: ; preds = %17
%23 = call i32 (...) @help()
br label %69
24: ; preds = %17
%25 = call i32 (...) @version()
br label %69
26: ; preds = %17
br label %29
27: ; preds = %17
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.10, i64 0, i64 0))
br label %29
29: ; preds = %17, %27, %26
%30 = phi i32 [ %19, %27 ], [ %19, %26 ], [ 1, %17 ]
%31 = call i32 @getopt_long(i32 %0, i8** %1, i8* %11, %struct.option* %13, i32* %5)
%32 = load i32, i32* @EOF
%33 = icmp eq i32 %31, %32
br i1 %33, label %34, label %17
34: ; preds = %29
%35 = load i32, i32* @optind
%36 = icmp slt i32 %35, %0
br i1 %36, label %42, label %40
37: ; preds = %2
%38 = load i32, i32* @optind
%39 = icmp slt i32 %38, %0
br i1 %39, label %47, label %40
40: ; preds = %37, %34
%41 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.9, i64 0, i64 0))
br label %69
42: ; preds = %34
%43 = icmp eq i32 %30, 0
br i1 %43, label %47, label %44
44: ; preds = %42
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%46 = load i32, i32* @optind
br label %47
47: ; preds = %37, %42, %44
%48 = phi i32 [ %35, %42 ], [ %46, %44 ], [ %38, %37 ]
%49 = icmp slt i32 %48, %0
br i1 %49, label %50, label %69
50: ; preds = %47
%51 = sext i32 %48 to i64
br label %52
52: ; preds = %50, %65
%53 = phi i64 [ %51, %50 ], [ %66, %65 ]
store i64 0, i64* @errno
%54 = getelementptr inbounds i8*, i8** %1, i64 %53
%55 = load i8*, i8** %54
%56 = call i32 @strtoul(i8* %55, i8** %4, i32 10)
store i32 %56, i32* %3
%57 = load i64, i64* @errno
%58 = icmp eq i64 %57, 0
br i1 %58, label %62, label %59
59: ; preds = %52
%60 = load i8*, i8** %54
%61 = call i32 @perror(i8* %60)
br label %65
62: ; preds = %52
%63 = call i8* @ctime(i32* %3)
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8* %63)
br label %65
65: ; preds = %62, %59
%66 = add nsw i64 %53, 1
%67 = trunc i64 %66 to i32
%68 = icmp eq i32 %67, %0
br i1 %68, label %69, label %52
69: ; preds = %65, %47, %40, %24, %22
ret i32 0
}