#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;

/* Variables and functions */
int /*<<< orphan*/ chop_newline(char *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int getopt(int, char **, char *);
int /*<<< orphan*/ stdin;
scalar_t__ str2time(char *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ unixtime(int /*<<< orphan*/);
int /*<<< orphan*/ usage();
int /*<<< orphan*/ warnx(char *, char *);
int main(int argc, char **argv) {
  extern int optind;
  int ch;
  time_t t;
  char line[1024];
  int num_base = 10;
  int err;
  while ((ch = getopt(argc, argv, "hx")) != -1) {
    switch (ch) {
    case 'h':
      usage();
      return 0;
    case 'x':
      num_base = 16;
      break;
    default:
      usage();
      return -1;
    }
  }
  argc -= optind;
  argv += optind;
  if (argc == 0) {
    while (fgets(line, sizeof line, stdin) != NULL) {
      if (*line == '\n')
        continue;
      chop_newline(line);
      if (str2time(line, &t, num_base))
        unixtime(t);
      else
        warnx("%s: failed to convert number", line);
    }
  } else {
    while (argc > 0) {
      if (str2time(*argv, &t, num_base))
        unixtime(t);
      else
        warnx("%s: failed to convert number", *argv);
      --argc;
      ++argv;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa,-0x424(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe5f(%rip),%rdx
call   1080 <getopt@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
je     1217 <main+0xa7>
mov    -0x14(%rbp),%eax
mov    %eax,-0x42c(%rbp)
sub    $0x68,%eax
je     11dd <main+0x6d>
jmp    11c9 <main+0x59>
mov    -0x42c(%rbp),%eax
sub    $0x78,%eax
je     11f0 <main+0x80>
jmp    11ff <main+0x8f>
mov    $0x0,%al
call   1070 <usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1356 <main+0x1e6>
movl   $0x10,-0x424(%rbp)
jmp    1212 <main+0xa2>
mov    $0x0,%al
call   1070 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1356 <main+0x1e6>
jmp    1193 <main+0x23>
mov    0x2dba(%rip),%rax
mov    (%rax),%ecx
mov    -0x8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    0x2da9(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    12e1 <main+0x171>
jmp    1252 <main+0xe2>
lea    -0x420(%rbp),%rdi
mov    0x2d88(%rip),%rax
mov    (%rax),%edx
mov    $0x400,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     12dc <main+0x16c>
movsbl -0x420(%rbp),%eax
cmp    $0xa,%eax
jne    128b <main+0x11b>
jmp    1252 <main+0xe2>
lea    -0x420(%rbp),%rdi
call   1060 <chop_newline@plt>
lea    -0x420(%rbp),%rdi
mov    -0x424(%rbp),%edx
lea    -0x18(%rbp),%rsi
call   1090 <str2time@plt>
cmp    $0x0,%rax
je     12c4 <main+0x154>
mov    -0x18(%rbp),%edi
call   1030 <unixtime@plt>
jmp    12d7 <main+0x167>
lea    -0x420(%rbp),%rsi
lea    0xd31(%rip),%rdi
call   1040 <warnx@plt>
jmp    1252 <main+0xe2>
jmp    134f <main+0x1df>
jmp    12e6 <main+0x176>
cmpl   $0x0,-0x8(%rbp)
jle    134a <main+0x1da>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x424(%rbp),%edx
lea    -0x18(%rbp),%rsi
call   1090 <str2time@plt>
cmp    $0x0,%rax
je     131d <main+0x1ad>
mov    -0x18(%rbp),%edi
call   1030 <unixtime@plt>
jmp    1330 <main+0x1c0>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xcd8(%rip),%rdi
call   1040 <warnx@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    12e6 <main+0x176>
jmp    134f <main+0x1df>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %rsi,%r15
mov    %edi,%ebp
mov    $0xa,%ecx
lea    0xe6e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ecx,%r12d
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14,%rdx
call   1080 <getopt@plt>
mov    $0x10,%ecx
cmp    $0x78,%eax
je     11a0 <main+0x30>
cmp    $0x68,%eax
je     1235 <main+0xc5>
cmp    $0xffffffff,%eax
jne    123a <main+0xca>
mov    0x2e0d(%rip),%rax
movslq (%rax),%rax
mov    %ebp,%ecx
sub    %eax,%ecx
je     125c <main+0xec>
xor    %r14d,%r14d
test   %ecx,%ecx
jle    1247 <main+0xd7>
lea    (%r15,%rax,8),%rbx
sub    %eax,%ebp
add    $0x1,%ebp
lea    0xc(%rsp),%r15
lea    0xe0f(%rip),%r13
jmp    1217 <main+0xa7>
cs nopw 0x0(%rax,%rax,1)
mov    (%rbx),%rsi
mov    %r13,%rdi
call   1040 <warnx@plt>
add    $0x8,%rbx
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
jle    1247 <main+0xd7>
mov    (%rbx),%rdi
mov    %r15,%rsi
mov    %r12d,%edx
call   1090 <str2time@plt>
test   %rax,%rax
je     1200 <main+0x90>
mov    0xc(%rsp),%edi
call   1030 <unixtime@plt>
jmp    120b <main+0x9b>
xor    %r14d,%r14d
jmp    1240 <main+0xd0>
mov    $0xffffffff,%r14d
xor    %eax,%eax
call   1070 <usage@plt>
mov    %r14d,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2d85(%rip),%r13
mov    0x0(%r13),%edx
lea    0x10(%rsp),%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     1247 <main+0xd7>
lea    0x10(%rsp),%rbp
lea    0xc(%rsp),%r15
lea    0xd74(%rip),%rbx
jmp    12b6 <main+0x146>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1040 <warnx@plt>
nopl   0x0(%rax)
mov    0x0(%r13),%edx
mov    %rbp,%rdi
mov    $0x400,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     1247 <main+0xd7>
cmpb   $0xa,0x10(%rsp)
je     12a0 <main+0x130>
mov    %rbp,%rdi
call   1060 <chop_newline@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %r12d,%edx
call   1090 <str2time@plt>
test   %rax,%rax
je     1291 <main+0x121>
mov    0xc(%rsp),%edi
call   1030 <unixtime@plt>
jmp    12a0 <main+0x130>

LLVM IR (-O0):
@.str = [3 x i8] c"hx\00"
@optind = external global i32
@stdin = global i32 0
@.str.1 = [29 x i8] c"%s: failed to convert number\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 [1024 x i8]
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10, i32* %9
br label %11
11: ; preds = %23, %2
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call i32 @getopt(i32 %12, i8** %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32 %14, i32* %6
%15 = icmp ne i32 %14, -1
br i1 %15, label %16, label %24
16: ; preds = %11
%17 = load i32, i32* %6
switch i32 %17, label %21 [
i32 104, label %18
i32 120, label %20
]
18: ; preds = %16
%19 = call i32 (...) @usage()
store i32 0, i32* %3
br label %85
20: ; preds = %16
store i32 16, i32* %9
br label %23
21: ; preds = %16
%22 = call i32 (...) @usage()
store i32 -1, i32* %3
br label %85
23: ; preds = %20
br label %11
24: ; preds = %11
%25 = load i32, i32* @optind
%26 = load i32, i32* %4
%27 = sub nsw i32 %26, %25
store i32 %27, i32* %4
%28 = load i32, i32* @optind
%29 = load i8**, i8*** %5
%30 = sext i32 %28 to i64
%31 = getelementptr inbounds i8*, i8** %29, i64 %30
store i8** %31, i8*** %5
%32 = load i32, i32* %4
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %61
34: ; preds = %24
br label %35
35: ; preds = %59, %45, %34
%36 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%37 = load i32, i32* @stdin
%38 = call i32* @fgets(i8* %36, i32 1024, i32 %37)
%39 = icmp ne i32* %38, null
br i1 %39, label %40, label %60
40: ; preds = %35
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 10
br i1 %44, label %45, label %46
45: ; preds = %40
br label %35
46: ; preds = %40
%47 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%48 = call i32 @chop_newline(i8* %47)
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%50 = load i32, i32* %9
%51 = call i64 @str2time(i8* %49, i32* %7, i32 %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %46
%54 = load i32, i32* %7
%55 = call i32 @unixtime(i32 %54)
br label %59
56: ; preds = %46
%57 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%58 = call i32 @warnx(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %57)
br label %59
59: ; preds = %56, %53
br label %35
60: ; preds = %35
br label %84
61: ; preds = %24
br label %62
62: ; preds = %78, %61
%63 = load i32, i32* %4
%64 = icmp sgt i32 %63, 0
br i1 %64, label %65, label %83
65: ; preds = %62
%66 = load i8**, i8*** %5
%67 = load i8*, i8** %66
%68 = load i32, i32* %9
%69 = call i64 @str2time(i8* %67, i32* %7, i32 %68)
%70 = icmp ne i64 %69, 0
br i1 %70, label %71, label %74
71: ; preds = %65
%72 = load i32, i32* %7
%73 = call i32 @unixtime(i32 %72)
br label %78
74: ; preds = %65
%75 = load i8**, i8*** %5
%76 = load i8*, i8** %75
%77 = call i32 @warnx(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %76)
br label %78
78: ; preds = %74, %71
%79 = load i32, i32* %4
%80 = add nsw i32 %79, -1
store i32 %80, i32* %4
%81 = load i8**, i8*** %5
%82 = getelementptr inbounds i8*, i8** %81, i32 1
store i8** %82, i8*** %5
br label %62
83: ; preds = %62
br label %84
84: ; preds = %83, %60
store i32 0, i32* %3
br label %85
85: ; preds = %84, %21, %18
%86 = load i32, i32* %3
ret i32 %86
}

LLVM IR (-O2):
@.str = [3 x i8] c"hx\00"
@optind = external global i32
@stdin = global i32 0
@.str.1 = [29 x i8] c"%s: failed to convert number\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca [1024 x i8]
%5 = bitcast i32* %3 to i8*
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
br label %7
7: ; preds = %7, %2
%8 = phi i32 [ 10, %2 ], [ 16, %7 ]
%9 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
switch i32 %9, label %55 [
i32 -1, label %10
i32 104, label %56
i32 120, label %7
]
10: ; preds = %7
%11 = load i32, i32* @optind
%12 = sub nsw i32 %0, %11
%13 = icmp eq i32 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %10
%15 = icmp sgt i32 %12, 0
br i1 %15, label %16, label %59
16: ; preds = %14
%17 = sext i32 %11 to i64
%18 = getelementptr inbounds i8*, i8** %1, i64 %17
br label %39
19: ; preds = %10
%20 = load i32, i32* @stdin
%21 = call i32* @fgets(i8* %6, i32 1024, i32 %20)
%22 = icmp eq i32* %21, null
br i1 %22, label %59, label %23
23: ; preds = %19, %35
%24 = load i8, i8* %6
%25 = icmp eq i8 %24, 10
br i1 %25, label %35, label %26
26: ; preds = %23
%27 = call i32 @chop_newline(i8* %6)
%28 = call i64 @str2time(i8* %6, i32* %3, i32 %8)
%29 = icmp eq i64 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %26
%31 = load i32, i32* %3
%32 = call i32 @unixtime(i32 %31)
br label %35
33: ; preds = %26
%34 = call i32 @warnx(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %35
35: ; preds = %30, %33, %23
%36 = load i32, i32* @stdin
%37 = call i32* @fgets(i8* %6, i32 1024, i32 %36)
%38 = icmp eq i32* %37, null
br i1 %38, label %59, label %23
39: ; preds = %16, %51
%40 = phi i32 [ %52, %51 ], [ %12, %16 ]
%41 = phi i8** [ %53, %51 ], [ %18, %16 ]
%42 = load i8*, i8** %41
%43 = call i64 @str2time(i8* %42, i32* %3, i32 %8)
%44 = icmp eq i64 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %39
%46 = load i32, i32* %3
%47 = call i32 @unixtime(i32 %46)
br label %51
48: ; preds = %39
%49 = load i8*, i8** %41
%50 = call i32 @warnx(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %49)
br label %51
51: ; preds = %48, %45
%52 = add nsw i32 %40, -1
%53 = getelementptr inbounds i8*, i8** %41, i64 1
%54 = icmp sgt i32 %40, 1
br i1 %54, label %39, label %59
55: ; preds = %7
br label %56
56: ; preds = %7, %55
%57 = phi i32 [ -1, %55 ], [ 0, %7 ]
%58 = tail call i32 (...) @usage()
br label %59
59: ; preds = %51, %35, %56, %14, %19
%60 = phi i32 [ 0, %19 ], [ 0, %14 ], [ %57, %56 ], [ 0, %35 ], [ 0, %51 ]
ret i32 %60
}