#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 time_t;
struct tm {
  int tm_year;
  int tm_mon;
  int tm_isdst;
  void *tm_min;
  void *tm_hour;
  void *tm_mday;
};

/* Variables and functions */
int /*<<< orphan*/ Usage();
int atoi(char *);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
void *get_digits(char **, int);
char getopt(int, char **, char *);
struct tm *localtime(int *);
int mktime(struct tm *);
char *optarg;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
char *strdup(char *);
int strftime(char *, int, char *, struct tm *);
int time(int /*<<< orphan*/ *);
int tosec(char *);
int main(int argc, char *argv[]) {
  char optchar;
  int nopt = 0;
  int nscan = 0;
  char *date_format = "%Y-%m-%d-%H:%M";
  char *time_interval = "1d";
  char *rounding_time = NULL;
  char *initial_time = NULL;
  char *pstr = NULL;
  time_t current_time = 0;
  time_t standard_time = 0;
  time_t time_diff = 0;
  int isdst = 0;
  struct tm *ts = NULL;
  char timestr[1024 + 1];
  char *prefix = "", *suffix = "";
  int ndate = 1;
  int result;
  int time_adjust_sec = 0;
  while (argc > 1 &&
         -1 != (optchar = getopt(argc, argv, "a:d:f:hi:n:p:r:s:t:v"))) {
    nopt++;
    switch (optchar) {
    case '?':
      return 1;
    case 'a':
      time_adjust_sec += tosec(optarg);
      break;
    case 'd':
      isdst = atoi(optarg);
      break;
    case 'h':
      Usage();
      return 0;
    case 'v':
      printf("%s (compiled %s)\n", "pdate 0.91", "Mar 16 2022");
      return 0;
    case 'f':
      date_format = strdup(optarg);
      break;
    case 'i':
      time_interval = strdup(optarg);
      break;
    case 't':
      initial_time = strdup(optarg);
      break;
    case 'r':
      rounding_time = strdup(optarg);
      break;
    case 'p':
      prefix = strdup(optarg);
      break;
    case 's':
      suffix = strdup(optarg);
      break;
    case 'n':
      ndate = atoi(optarg);
      break;
    default:
      return 1;
    }
  }
  if (initial_time) {
    ts = (struct tm *)calloc(1, sizeof(struct tm));
    pstr = initial_time;
    ts->tm_year = get_digits(&pstr, 4);
    ts->tm_mon = get_digits(&pstr, 2);
    ts->tm_mday = get_digits(&pstr, 2);
    ts->tm_hour = get_digits(&pstr, 2);
    ts->tm_min = get_digits(&pstr, 2);
    ts->tm_year -= 1900;
    ts->tm_mon -= 1;
    ts->tm_isdst = isdst;
    current_time = mktime(ts);
  } else {
    current_time = time(NULL);
  }
  if (rounding_time) {
    current_time -= current_time % tosec(rounding_time);
  }
  current_time += time_adjust_sec;
  while (ndate--) {
    ts = localtime(&current_time);
    result = strftime(timestr, 1024, date_format, ts);
    if (result == 0) {
      fprintf(stderr, "ERROR: pdate could not produce the requested time "
                      "string.  Either the\n");
      fprintf(stderr,
              "       resulting string exceeded the pre-programmed limit of %d "
              "or you\n",
              1024);
      fprintf(stderr,
              "       requested a time format that yielded an empty string.\n");
      return 1;
    }
    printf("%s%s%s", prefix, timestr, suffix);
    if (!ndate)
      break;
    printf(" ");
    current_time += tosec(time_interval);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    0xee2(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xee6(%rip),%rax
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
movq   $0x0,-0x60(%rbp)
lea    0xec8(%rip),%rax
mov    %rax,-0x478(%rbp)
lea    0xeba(%rip),%rax
mov    %rax,-0x480(%rbp)
movl   $0x1,-0x484(%rbp)
movl   $0x0,-0x48c(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x48d(%rbp)
jle    12b4 <main+0xe4>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe59(%rip),%rdx
call   10d0 <getopt@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
setne  %al
mov    %al,-0x48d(%rbp)
mov    -0x48d(%rbp),%al
test   $0x1,%al
jne    12c7 <main+0xf7>
jmp    143f <main+0x26f>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
movsbl -0x11(%rbp),%eax
add    $0xffffffc1,%eax
mov    %eax,%ecx
mov    %rcx,-0x498(%rbp)
sub    $0x37,%eax
ja     142e <main+0x25e>
mov    -0x498(%rbp),%rax
lea    0xd09(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    1670 <main+0x4a0>
mov    0x2ce5(%rip),%rax
mov    (%rax),%rdi
call   10c0 <tosec@plt>
add    -0x48c(%rbp),%eax
mov    %eax,-0x48c(%rbp)
jmp    143a <main+0x26a>
mov    0x2cc5(%rip),%rax
mov    (%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x58(%rbp)
jmp    143a <main+0x26a>
mov    $0x0,%al
call   1050 <Usage@plt>
movl   $0x0,-0x4(%rbp)
jmp    1670 <main+0x4a0>
lea    0xdaa(%rip),%rdi
lea    0xdb5(%rip),%rsi
lea    0xdb9(%rip),%rdx
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1670 <main+0x4a0>
mov    0x2c73(%rip),%rax
mov    (%rax),%rdi
call   10f0 <strdup@plt>
mov    %rax,-0x28(%rbp)
jmp    143a <main+0x26a>
mov    0x2c5b(%rip),%rax
mov    (%rax),%rdi
call   10f0 <strdup@plt>
mov    %rax,-0x30(%rbp)
jmp    143a <main+0x26a>
mov    0x2c43(%rip),%rax
mov    (%rax),%rdi
call   10f0 <strdup@plt>
mov    %rax,-0x40(%rbp)
jmp    143a <main+0x26a>
mov    0x2c2b(%rip),%rax
mov    (%rax),%rdi
call   10f0 <strdup@plt>
mov    %rax,-0x38(%rbp)
jmp    143a <main+0x26a>
mov    0x2c13(%rip),%rax
mov    (%rax),%rdi
call   10f0 <strdup@plt>
mov    %rax,-0x478(%rbp)
jmp    143a <main+0x26a>
mov    0x2bf8(%rip),%rax
mov    (%rax),%rdi
call   10f0 <strdup@plt>
mov    %rax,-0x480(%rbp)
jmp    143a <main+0x26a>
mov    0x2bdd(%rip),%rax
mov    (%rax),%rdi
call   10e0 <atoi@plt>
mov    %eax,-0x484(%rbp)
jmp    143a <main+0x26a>
movl   $0x1,-0x4(%rbp)
jmp    1670 <main+0x4a0>
jmp    1279 <main+0xa9>
cmpq   $0x0,-0x40(%rbp)
je     1513 <main+0x343>
mov    $0x1,%edi
mov    $0x28,%esi
call   1060 <calloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x48(%rbp),%rdi
mov    $0x4,%esi
call   1080 <get_digits@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%rax
mov    %ecx,(%rax)
lea    -0x48(%rbp),%rdi
mov    $0x2,%esi
call   1080 <get_digits@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%rax
mov    %ecx,0x4(%rax)
lea    -0x48(%rbp),%rdi
mov    $0x2,%esi
call   1080 <get_digits@plt>
mov    %rax,%rcx
mov    -0x60(%rbp),%rax
mov    %rcx,0x20(%rax)
lea    -0x48(%rbp),%rdi
mov    $0x2,%esi
call   1080 <get_digits@plt>
mov    %rax,%rcx
mov    -0x60(%rbp),%rax
mov    %rcx,0x18(%rax)
lea    -0x48(%rbp),%rdi
mov    $0x2,%esi
call   1080 <get_digits@plt>
mov    %rax,%rcx
mov    -0x60(%rbp),%rax
mov    %rcx,0x10(%rax)
mov    -0x60(%rbp),%rax
mov    (%rax),%ecx
sub    $0x76c,%ecx
mov    %ecx,(%rax)
mov    -0x60(%rbp),%rax
mov    0x4(%rax),%ecx
sub    $0x1,%ecx
mov    %ecx,0x4(%rax)
mov    -0x58(%rbp),%ecx
mov    -0x60(%rbp),%rax
mov    %ecx,0x8(%rax)
mov    -0x60(%rbp),%rdi
call   10a0 <mktime@plt>
mov    %eax,-0x4c(%rbp)
jmp    151f <main+0x34f>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,-0x4c(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     154f <main+0x37f>
mov    -0x4c(%rbp),%eax
mov    %eax,-0x49c(%rbp)
mov    -0x38(%rbp),%rdi
call   10c0 <tosec@plt>
mov    %eax,%ecx
mov    -0x49c(%rbp),%eax
cltd
idiv   %ecx
mov    -0x4c(%rbp),%eax
sub    %edx,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x48c(%rbp),%eax
add    -0x4c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x484(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x484(%rbp)
cmp    $0x0,%eax
je     165b <main+0x48b>
lea    -0x4c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x60(%rbp)
lea    -0x470(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    -0x60(%rbp),%rcx
mov    $0x400,%esi
call   10b0 <strftime@plt>
mov    %eax,-0x488(%rbp)
cmpl   $0x0,-0x488(%rbp)
jne    1604 <main+0x434>
mov    0x2a23(%rip),%rax
mov    (%rax),%edi
lea    0xb72(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x2a0c(%rip),%rax
mov    (%rax),%edi
lea    0xba2(%rip),%rsi
mov    $0x400,%edx
mov    $0x0,%al
call   1070 <fprintf@plt>
mov    0x29f0(%rip),%rax
mov    (%rax),%edi
lea    0xbce(%rip),%rsi
mov    $0x0,%al
call   1070 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1670 <main+0x4a0>
mov    -0x478(%rbp),%rsi
lea    -0x470(%rbp),%rdx
mov    -0x480(%rbp),%rcx
lea    0xbdd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x484(%rbp)
jne    1639 <main+0x469>
jmp    165b <main+0x48b>
lea    0xbc4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
call   10c0 <tosec@plt>
add    -0x4c(%rbp),%eax
mov    %eax,-0x4c(%rbp)
jmp    155b <main+0x38b>
lea    0xab5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x448,%rsp
movq   $0x0,0x38(%rsp)
cmp    $0x2,%edi
jl     1373 <main+0x193>
mov    %rsi,%r13
mov    %edi,%r14d
lea    0xe5a(%rip),%rdx
call   10e0 <getopt@plt>
cmp    $0xff,%al
je     13a5 <main+0x1c5>
mov    $0x1,%ebp
lea    0xe67(%rip),%r15
xor    %ecx,%ecx
mov    %rcx,0x20(%rsp)
lea    0xe21(%rip),%rcx
mov    %rcx,0x18(%rsp)
lea    0xe24(%rip),%rcx
mov    %rcx,0x28(%rsp)
lea    0xdb1(%rip),%rbx
xor    %ecx,%ecx
mov    %rcx,0x30(%rsp)
movl   $0x0,0x8(%rsp)
mov    %r15,%r12
xor    %ecx,%ecx
mov    %rcx,0x10(%rsp)
jmp    129a <main+0xba>
mov    0x2d87(%rip),%rax
mov    (%rax),%rdi
call   10f0 <atoi@plt>
mov    %eax,%ebp
nopl   0x0(%rax,%rax,1)
mov    %r14d,%edi
mov    %r13,%rsi
lea    0xddd(%rip),%rdx
call   10e0 <getopt@plt>
cmp    $0xff,%al
je     13e9 <main+0x209>
movsbl %al,%eax
add    $0xffffff9f,%eax
cmp    $0x15,%eax
ja     158d <main+0x3ad>
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
mov    0x2d3f(%rip),%rax
mov    (%rax),%rdi
call   10d0 <tosec@plt>
mov    0x10(%rsp),%rcx
add    %eax,%ecx
mov    %rcx,0x10(%rsp)
jmp    1280 <main+0xa0>
mov    0x2d22(%rip),%rax
mov    (%rax),%rdi
call   10f0 <atoi@plt>
mov    %eax,0x8(%rsp)
jmp    1280 <main+0xa0>
mov    0x2d0d(%rip),%rax
mov    (%rax),%rdi
call   1100 <strdup@plt>
mov    %rax,0x18(%rsp)
jmp    1280 <main+0xa0>
mov    0x2cf7(%rip),%rax
mov    (%rax),%rdi
call   1100 <strdup@plt>
mov    %rax,0x28(%rsp)
jmp    1280 <main+0xa0>
mov    0x2cde(%rip),%rax
mov    (%rax),%rdi
call   1100 <strdup@plt>
mov    %rax,%r15
jmp    1280 <main+0xa0>
mov    0x2cc7(%rip),%rax
mov    (%rax),%rdi
call   1100 <strdup@plt>
mov    %rax,0x20(%rsp)
jmp    1280 <main+0xa0>
mov    0x2cae(%rip),%rax
mov    (%rax),%rdi
call   1100 <strdup@plt>
mov    %rax,%r12
jmp    1280 <main+0xa0>
mov    0x2c97(%rip),%rax
mov    (%rax),%rdi
call   1100 <strdup@plt>
mov    %rax,0x30(%rsp)
jmp    1280 <main+0xa0>
lea    0xced(%rip),%rax
mov    %rax,0x28(%rsp)
lea    0xcd2(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xcfe(%rip),%r12
mov    $0x1,%ebp
xor    %r14d,%r14d
mov    %r12,%r15
xor    %r13d,%r13d
jmp    149b <main+0x2bb>
lea    0xcbb(%rip),%rax
mov    %rax,0x28(%rsp)
lea    0xca0(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xccc(%rip),%r12
mov    $0x1,%ebp
xor    %eax,%eax
mov    %rax,0x10(%rsp)
mov    %r12,%r15
movl   $0x0,0x8(%rsp)
xor    %eax,%eax
mov    %rax,0x30(%rsp)
xor    %eax,%eax
mov    %rax,0x20(%rsp)
mov    0x30(%rsp),%r14
test   %r14,%r14
je     1491 <main+0x2b1>
mov    $0x1,%edi
mov    $0x28,%esi
call   1070 <calloc@plt>
mov    %rax,%rbx
mov    %r14,0x38(%rsp)
lea    0x38(%rsp),%r14
mov    %r14,%rdi
mov    $0x4,%esi
call   1090 <get_digits@plt>
mov    %eax,(%rbx)
mov    %r14,%rdi
mov    $0x2,%esi
call   1090 <get_digits@plt>
mov    %eax,0x4(%rbx)
mov    %r14,%rdi
mov    $0x2,%esi
call   1090 <get_digits@plt>
mov    %rax,0x20(%rbx)
mov    %r14,%rdi
mov    $0x2,%esi
call   1090 <get_digits@plt>
mov    %rax,0x18(%rbx)
mov    %r14,%rdi
mov    $0x2,%esi
call   1090 <get_digits@plt>
mov    %rax,0x10(%rbx)
addl   $0xfffff894,(%rbx)
addl   $0xffffffff,0x4(%rbx)
mov    0x8(%rsp),%eax
mov    %eax,0x8(%rbx)
mov    %rbx,%rdi
call   10b0 <mktime@plt>
mov    %eax,%ebx
mov    0x10(%rsp),%r14
mov    0x20(%rsp),%r13
test   %r13,%r13
jne    14a9 <main+0x2c9>
jmp    14ba <main+0x2da>
mov    0x10(%rsp),%r14
mov    0x20(%rsp),%r13
xor    %edi,%edi
call   10a0 <time@plt>
mov    %eax,%ebx
test   %r13,%r13
je     14ba <main+0x2da>
mov    %r13,%rdi
call   10d0 <tosec@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
sub    %edx,%ebx
add    %r14d,%ebx
mov    %ebx,0xc(%rsp)
test   %ebp,%ebp
je     1594 <main+0x3b4>
lea    0xc(%rsp),%rdi
call   1040 <localtime@plt>
lea    0x40(%rsp),%rdi
mov    $0x400,%esi
mov    0x18(%rsp),%rdx
mov    %rax,%rcx
call   10c0 <strftime@plt>
test   %eax,%eax
je     1551 <main+0x371>
lea    0xc80(%rip),%r14
lea    0x40(%rsp),%rbx
lea    0xc(%rsp),%r13
nop
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffff,%ebp
je     1594 <main+0x3b4>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    0x28(%rsp),%rdi
call   10d0 <tosec@plt>
add    %eax,0xc(%rsp)
mov    %r13,%rdi
call   1040 <localtime@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    0x18(%rsp),%rdx
mov    %rax,%rcx
call   10c0 <strftime@plt>
test   %eax,%eax
jne    1500 <main+0x320>
mov    0x2a80(%rip),%rbx
mov    (%rbx),%edi
lea    0xb47(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%rbx),%edi
lea    0xb7e(%rip),%rsi
mov    $0x400,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    (%rbx),%edi
lea    0xbb1(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%ebx
jmp    15a0 <main+0x3c0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x448,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
xor    %eax,%eax
call   1060 <Usage@plt>
jmp    15a0 <main+0x3c0>
lea    0xab9(%rip),%rdi
lea    0xac4(%rip),%rsi
lea    0xac8(%rip),%rdx
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <printf@plt>
jmp    15a0 <main+0x3c0>

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i8*, i8*, i8* }
@.str = [15 x i8] c"%Y-%m-%d-%H:%M\00"
@.str.1 = [3 x i8] c"1d\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [21 x i8] c"a:d:f:hi:n:p:r:s:t:v\00"
@optarg = global i8* null
@.str.4 = [18 x i8] c"%s (compiled %s)\0A\00"
@.str.5 = [11 x i8] c"pdate 0.91\00"
@.str.6 = [12 x i8] c"Mar 16 2022\00"
@stderr = global i32 0
@.str.7 = [71 x i8] c"ERROR: pdate could not produce the requested time string. Either the\0A\00"
@.str.8 = [72 x i8] c" resulting string exceeded the pre-programmed limit of %d or you\0A\00"
@.str.9 = [62 x i8] c" requested a time format that yielded an empty string.\0A\00"
@.str.10 = [7 x i8] c"%s%s%s\00"
@.str.11 = [2 x i8] c" \00"
@.str.12 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca %struct.tm*
%19 = alloca [1025 x i8]
%20 = alloca i8*
%21 = alloca i8*
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %9
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %10
store i8* null, i8** %11
store i8* null, i8** %12
store i8* null, i8** %13
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
store i32 0, i32* %17
store %struct.tm* null, %struct.tm** %18
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %20
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8** %21
store i32 1, i32* %22
store i32 0, i32* %24
br label %25
25: ; preds = %76, %2
%26 = load i32, i32* %4
%27 = icmp sgt i32 %26, 1
br i1 %27, label %28, label %34
28: ; preds = %25
%29 = load i32, i32* %4
%30 = load i8**, i8*** %5
%31 = call signext i8 @getopt(i32 %29, i8** %30, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
store i8 %31, i8* %6
%32 = sext i8 %31 to i32
%33 = icmp ne i32 -1, %32
br label %34
34: ; preds = %28, %25
%35 = phi i1 [ false, %25 ], [ %33, %28 ]
br i1 %35, label %36, label %77
36: ; preds = %34
%37 = load i32, i32* %7
%38 = add nsw i32 %37, 1
store i32 %38, i32* %7
%39 = load i8, i8* %6
%40 = sext i8 %39 to i32
switch i32 %40, label %75 [
i32 63, label %41
i32 97, label %42
i32 100, label %47
i32 104, label %50
i32 118, label %52
i32 102, label %54
i32 105, label %57
i32 116, label %60
i32 114, label %63
i32 112, label %66
i32 115, label %69
i32 110, label %72
]
41: ; preds = %36
store i32 1, i32* %3
br label %165
42: ; preds = %36
%43 = load i8*, i8** @optarg
%44 = call i32 @tosec(i8* %43)
%45 = load i32, i32* %24
%46 = add nsw i32 %45, %44
store i32 %46, i32* %24
br label %76
47: ; preds = %36
%48 = load i8*, i8** @optarg
%49 = call i32 @atoi(i8* %48)
store i32 %49, i32* %17
br label %76
50: ; preds = %36
%51 = call i32 (...) @Usage()
store i32 0, i32* %3
br label %165
52: ; preds = %36
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %3
br label %165
54: ; preds = %36
%55 = load i8*, i8** @optarg
%56 = call i8* @strdup(i8* %55)
store i8* %56, i8** %9
br label %76
57: ; preds = %36
%58 = load i8*, i8** @optarg
%59 = call i8* @strdup(i8* %58)
store i8* %59, i8** %10
br label %76
60: ; preds = %36
%61 = load i8*, i8** @optarg
%62 = call i8* @strdup(i8* %61)
store i8* %62, i8** %12
br label %76
63: ; preds = %36
%64 = load i8*, i8** @optarg
%65 = call i8* @strdup(i8* %64)
store i8* %65, i8** %11
br label %76
66: ; preds = %36
%67 = load i8*, i8** @optarg
%68 = call i8* @strdup(i8* %67)
store i8* %68, i8** %20
br label %76
69: ; preds = %36
%70 = load i8*, i8** @optarg
%71 = call i8* @strdup(i8* %70)
store i8* %71, i8** %21
br label %76
72: ; preds = %36
%73 = load i8*, i8** @optarg
%74 = call i32 @atoi(i8* %73)
store i32 %74, i32* %22
br label %76
75: ; preds = %36
store i32 1, i32* %3
br label %165
76: ; preds = %72, %69, %66, %63, %60, %57, %54, %47, %42
br label %25
77: ; preds = %34
%78 = load i8*, i8** %12
%79 = icmp ne i8* %78, null
br i1 %79, label %80, label %114
80: ; preds = %77
%81 = call i64 @calloc(i32 1, i32 40)
%82 = inttoptr i64 %81 to %struct.tm*
store %struct.tm* %82, %struct.tm** %18
%83 = load i8*, i8** %12
store i8* %83, i8** %13
%84 = call i8* @get_digits(i8** %13, i32 4)
%85 = ptrtoint i8* %84 to i32
%86 = load %struct.tm*, %struct.tm** %18
%87 = getelementptr inbounds %struct.tm, %struct.tm* %86, i32 0, i32 0
store i32 %85, i32* %87
%88 = call i8* @get_digits(i8** %13, i32 2)
%89 = ptrtoint i8* %88 to i32
%90 = load %struct.tm*, %struct.tm** %18
%91 = getelementptr inbounds %struct.tm, %struct.tm* %90, i32 0, i32 1
store i32 %89, i32* %91
%92 = call i8* @get_digits(i8** %13, i32 2)
%93 = load %struct.tm*, %struct.tm** %18
%94 = getelementptr inbounds %struct.tm, %struct.tm* %93, i32 0, i32 5
store i8* %92, i8** %94
%95 = call i8* @get_digits(i8** %13, i32 2)
%96 = load %struct.tm*, %struct.tm** %18
%97 = getelementptr inbounds %struct.tm, %struct.tm* %96, i32 0, i32 4
store i8* %95, i8** %97
%98 = call i8* @get_digits(i8** %13, i32 2)
%99 = load %struct.tm*, %struct.tm** %18
%100 = getelementptr inbounds %struct.tm, %struct.tm* %99, i32 0, i32 3
store i8* %98, i8** %100
%101 = load %struct.tm*, %struct.tm** %18
%102 = getelementptr inbounds %struct.tm, %struct.tm* %101, i32 0, i32 0
%103 = load i32, i32* %102
%104 = sub nsw i32 %103, 1900
store i32 %104, i32* %102
%105 = load %struct.tm*, %struct.tm** %18
%106 = getelementptr inbounds %struct.tm, %struct.tm* %105, i32 0, i32 1
%107 = load i32, i32* %106
%108 = sub nsw i32 %107, 1
store i32 %108, i32* %106
%109 = load i32, i32* %17
%110 = load %struct.tm*, %struct.tm** %18
%111 = getelementptr inbounds %struct.tm, %struct.tm* %110, i32 0, i32 2
store i32 %109, i32* %111
%112 = load %struct.tm*, %struct.tm** %18
%113 = call i32 @mktime(%struct.tm* %112)
store i32 %113, i32* %14
br label %116
114: ; preds = %77
%115 = call i32 @time(i32* null)
store i32 %115, i32* %14
br label %116
116: ; preds = %114, %80
%117 = load i8*, i8** %11
%118 = icmp ne i8* %117, null
br i1 %118, label %119, label %126
119: ; preds = %116
%120 = load i32, i32* %14
%121 = load i8*, i8** %11
%122 = call i32 @tosec(i8* %121)
%123 = srem i32 %120, %122
%124 = load i32, i32* %14
%125 = sub nsw i32 %124, %123
store i32 %125, i32* %14
br label %126
126: ; preds = %119, %116
%127 = load i32, i32* %24
%128 = load i32, i32* %14
%129 = add nsw i32 %128, %127
store i32 %129, i32* %14
br label %130
130: ; preds = %157, %126
%131 = load i32, i32* %22
%132 = add nsw i32 %131, -1
store i32 %132, i32* %22
%133 = icmp ne i32 %131, 0
br i1 %133, label %134, label %163
134: ; preds = %130
%135 = call %struct.tm* @localtime(i32* %14)
store %struct.tm* %135, %struct.tm** %18
%136 = getelementptr inbounds [1025 x i8], [1025 x i8]* %19, i64 0, i64 0
%137 = load i8*, i8** %9
%138 = load %struct.tm*, %struct.tm** %18
%139 = call i32 @strftime(i8* %136, i32 1024, i8* %137, %struct.tm* %138)
store i32 %139, i32* %23
%140 = load i32, i32* %23
%141 = icmp eq i32 %140, 0
br i1 %141, label %142, label %149
142: ; preds = %134
%143 = load i32, i32* @stderr
%144 = call i32 (i32, i8*, ...) @fprintf(i32 %143, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.7, i64 0, i64 0))
%145 = load i32, i32* @stderr
%146 = call i32 (i32, i8*, ...) @fprintf(i32 %145, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.8, i64 0, i64 0), i32 1024)
%147 = load i32, i32* @stderr
%148 = call i32 (i32, i8*, ...) @fprintf(i32 %147, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.9, i64 0, i64 0))
store i32 1, i32* %3
br label %165
149: ; preds = %134
%150 = load i8*, i8** %20
%151 = getelementptr inbounds [1025 x i8], [1025 x i8]* %19, i64 0, i64 0
%152 = load i8*, i8** %21
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i8* %150, i8* %151, i8* %152)
%154 = load i32, i32* %22
%155 = icmp ne i32 %154, 0
br i1 %155, label %157, label %156
156: ; preds = %149
br label %163
157: ; preds = %149
%158 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%159 = load i8*, i8** %10
%160 = call i32 @tosec(i8* %159)
%161 = load i32, i32* %14
%162 = add nsw i32 %161, %160
store i32 %162, i32* %14
br label %130
163: ; preds = %156, %130
%164 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i64 0, i64 0))
store i32 0, i32* %3
br label %165
165: ; preds = %163, %142, %75, %52, %50, %41
%166 = load i32, i32* %3
ret i32 %166
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i8*, i8*, i8* }
@.str = [15 x i8] c"%Y-%m-%d-%H:%M\00"
@.str.1 = [3 x i8] c"1d\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [21 x i8] c"a:d:f:hi:n:p:r:s:t:v\00"
@optarg = global i8* null
@.str.4 = [18 x i8] c"%s (compiled %s)\0A\00"
@.str.5 = [11 x i8] c"pdate 0.91\00"
@.str.6 = [12 x i8] c"Mar 16 2022\00"
@stderr = global i32 0
@.str.7 = [71 x i8] c"ERROR: pdate could not produce the requested time string. Either the\0A\00"
@.str.8 = [72 x i8] c" resulting string exceeded the pre-programmed limit of %d or you\0A\00"
@.str.9 = [62 x i8] c" requested a time format that yielded an empty string.\0A\00"
@.str.10 = [7 x i8] c"%s%s%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [1025 x i8]
%6 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%7 = bitcast i32* %4 to i8*
%8 = getelementptr inbounds [1025 x i8], [1025 x i8]* %5, i64 0, i64 0
%9 = icmp sgt i32 %0, 1
br i1 %9, label %10, label %103
10: ; preds = %2
%11 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i8 %11, -1
br i1 %12, label %69, label %13
13: ; preds = %10, %57
%14 = phi i8 [ %67, %57 ], [ %11, %10 ]
%15 = phi i8* [ %58, %57 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %10 ]
%16 = phi i8* [ %59, %57 ], [ null, %10 ]
%17 = phi i8* [ %60, %57 ], [ null, %10 ]
%18 = phi i8* [ %61, %57 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %10 ]
%19 = phi i32 [ %62, %57 ], [ 0, %10 ]
%20 = phi i8* [ %63, %57 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %10 ]
%21 = phi i8* [ %64, %57 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %10 ]
%22 = phi i32 [ %65, %57 ], [ 1, %10 ]
%23 = phi i32 [ %66, %57 ], [ 0, %10 ]
%24 = sext i8 %14 to i32
switch i32 %24, label %156 [
i32 110, label %54
i32 97, label %25
i32 100, label %29
i32 104, label %32
i32 118, label %34
i32 102, label %36
i32 105, label %39
i32 116, label %42
i32 114, label %45
i32 112, label %48
i32 115, label %51
]
25: ; preds = %13
%26 = load i8*, i8** @optarg
%27 = tail call i32 @tosec(i8* %26)
%28 = add nsw i32 %27, %23
br label %57
29: ; preds = %13
%30 = load i8*, i8** @optarg
%31 = tail call i32 @atoi(i8* %30)
br label %57
32: ; preds = %13
%33 = tail call i32 (...) @Usage()
br label %156
34: ; preds = %13
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %156
36: ; preds = %13
%37 = load i8*, i8** @optarg
%38 = tail call i8* @strdup(i8* %37)
br label %57
39: ; preds = %13
%40 = load i8*, i8** @optarg
%41 = tail call i8* @strdup(i8* %40)
br label %57
42: ; preds = %13
%43 = load i8*, i8** @optarg
%44 = tail call i8* @strdup(i8* %43)
br label %57
45: ; preds = %13
%46 = load i8*, i8** @optarg
%47 = tail call i8* @strdup(i8* %46)
br label %57
48: ; preds = %13
%49 = load i8*, i8** @optarg
%50 = tail call i8* @strdup(i8* %49)
br label %57
51: ; preds = %13
%52 = load i8*, i8** @optarg
%53 = tail call i8* @strdup(i8* %52)
br label %57
54: ; preds = %13
%55 = load i8*, i8** @optarg
%56 = tail call i32 @atoi(i8* %55)
br label %57
57: ; preds = %54, %51, %48, %45, %42, %39, %36, %29, %25
%58 = phi i8* [ %15, %54 ], [ %15, %51 ], [ %15, %48 ], [ %15, %45 ], [ %15, %42 ], [ %41, %39 ], [ %15, %36 ], [ %15, %29 ], [ %15, %25 ]
%59 = phi i8* [ %16, %54 ], [ %16, %51 ], [ %16, %48 ], [ %47, %45 ], [ %16, %42 ], [ %16, %39 ], [ %16, %36 ], [ %16, %29 ], [ %16, %25 ]
%60 = phi i8* [ %17, %54 ], [ %17, %51 ], [ %17, %48 ], [ %17, %45 ], [ %44, %42 ], [ %17, %39 ], [ %17, %36 ], [ %17, %29 ], [ %17, %25 ]
%61 = phi i8* [ %18, %54 ], [ %18, %51 ], [ %18, %48 ], [ %18, %45 ], [ %18, %42 ], [ %18, %39 ], [ %38, %36 ], [ %18, %29 ], [ %18, %25 ]
%62 = phi i32 [ %19, %54 ], [ %19, %51 ], [ %19, %48 ], [ %19, %45 ], [ %19, %42 ], [ %19, %39 ], [ %19, %36 ], [ %31, %29 ], [ %19, %25 ]
%63 = phi i8* [ %20, %54 ], [ %20, %51 ], [ %50, %48 ], [ %20, %45 ], [ %20, %42 ], [ %20, %39 ], [ %20, %36 ], [ %20, %29 ], [ %20, %25 ]
%64 = phi i8* [ %21, %54 ], [ %53, %51 ], [ %21, %48 ], [ %21, %45 ], [ %21, %42 ], [ %21, %39 ], [ %21, %36 ], [ %21, %29 ], [ %21, %25 ]
%65 = phi i32 [ %56, %54 ], [ %22, %51 ], [ %22, %48 ], [ %22, %45 ], [ %22, %42 ], [ %22, %39 ], [ %22, %36 ], [ %22, %29 ], [ %22, %25 ]
%66 = phi i32 [ %23, %54 ], [ %23, %51 ], [ %23, %48 ], [ %23, %45 ], [ %23, %42 ], [ %23, %39 ], [ %23, %36 ], [ %23, %29 ], [ %28, %25 ]
%67 = tail call signext i8 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%68 = icmp eq i8 %67, -1
br i1 %68, label %69, label %13
69: ; preds = %57, %10
%70 = phi i32 [ 0, %10 ], [ %66, %57 ]
%71 = phi i32 [ 1, %10 ], [ %65, %57 ]
%72 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %10 ], [ %64, %57 ]
%73 = phi i8* [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %10 ], [ %63, %57 ]
%74 = phi i32 [ 0, %10 ], [ %62, %57 ]
%75 = phi i8* [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %10 ], [ %61, %57 ]
%76 = phi i8* [ null, %10 ], [ %60, %57 ]
%77 = phi i8* [ null, %10 ], [ %59, %57 ]
%78 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %10 ], [ %58, %57 ]
%79 = icmp eq i8* %76, null
br i1 %79, label %103, label %80
80: ; preds = %69
%81 = tail call i64 @calloc(i32 1, i32 40)
%82 = inttoptr i64 %81 to %struct.tm*
store i8* %76, i8** %3
%83 = call i8* @get_digits(i8** %3, i32 4)
%84 = ptrtoint i8* %83 to i64
%85 = trunc i64 %84 to i32
%86 = getelementptr inbounds %struct.tm, %struct.tm* %82, i64 0, i32 0
store i32 %85, i32* %86
%87 = call i8* @get_digits(i8** %3, i32 2)
%88 = ptrtoint i8* %87 to i64
%89 = trunc i64 %88 to i32
%90 = getelementptr inbounds %struct.tm, %struct.tm* %82, i64 0, i32 1
store i32 %89, i32* %90
%91 = call i8* @get_digits(i8** %3, i32 2)
%92 = getelementptr inbounds %struct.tm, %struct.tm* %82, i64 0, i32 5
store i8* %91, i8** %92
%93 = call i8* @get_digits(i8** %3, i32 2)
%94 = getelementptr inbounds %struct.tm, %struct.tm* %82, i64 0, i32 4
store i8* %93, i8** %94
%95 = call i8* @get_digits(i8** %3, i32 2)
%96 = getelementptr inbounds %struct.tm, %struct.tm* %82, i64 0, i32 3
store i8* %95, i8** %96
%97 = load i32, i32* %86
%98 = add nsw i32 %97, -1900
store i32 %98, i32* %86
%99 = load i32, i32* %90
%100 = add nsw i32 %99, -1
store i32 %100, i32* %90
%101 = getelementptr inbounds %struct.tm, %struct.tm* %82, i64 0, i32 2
store i32 %74, i32* %101
%102 = call i32 @mktime(%struct.tm* %82)
br label %112
103: ; preds = %2, %69
%104 = phi i32 [ %70, %69 ], [ 0, %2 ]
%105 = phi i32 [ %71, %69 ], [ 1, %2 ]
%106 = phi i8* [ %72, %69 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %2 ]
%107 = phi i8* [ %73, %69 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), %2 ]
%108 = phi i8* [ %75, %69 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %2 ]
%109 = phi i8* [ %77, %69 ], [ null, %2 ]
%110 = phi i8* [ %78, %69 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %2 ]
%111 = tail call i32 @time(i32* null)
br label %112
112: ; preds = %103, %80
%113 = phi i32 [ %104, %103 ], [ %70, %80 ]
%114 = phi i32 [ %105, %103 ], [ %71, %80 ]
%115 = phi i8* [ %106, %103 ], [ %72, %80 ]
%116 = phi i8* [ %107, %103 ], [ %73, %80 ]
%117 = phi i8* [ %108, %103 ], [ %75, %80 ]
%118 = phi i8* [ %109, %103 ], [ %77, %80 ]
%119 = phi i8* [ %110, %103 ], [ %78, %80 ]
%120 = phi i32 [ %111, %103 ], [ %102, %80 ]
%121 = icmp eq i8* %118, null
br i1 %121, label %126, label %122
122: ; preds = %112
%123 = call i32 @tosec(i8* %118)
%124 = srem i32 %120, %123
%125 = sub nsw i32 %120, %124
br label %126
126: ; preds = %122, %112
%127 = phi i32 [ %125, %122 ], [ %120, %112 ]
%128 = add nsw i32 %127, %113
store i32 %128, i32* %4
%129 = icmp eq i32 %114, 0
br i1 %129, label %154, label %130
130: ; preds = %126
%131 = call %struct.tm* @localtime(i32* %4)
%132 = call i32 @strftime(i8* %8, i32 1024, i8* %117, %struct.tm* %131)
%133 = icmp eq i32 %132, 0
br i1 %133, label %134, label %141
134: ; preds = %146, %130
%135 = load i32, i32* @stderr
%136 = call i32 (i32, i8*, ...) @fprintf(i32 %135, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.7, i64 0, i64 0))
%137 = load i32, i32* @stderr
%138 = call i32 (i32, i8*, ...) @fprintf(i32 %137, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.8, i64 0, i64 0), i32 1024)
%139 = load i32, i32* @stderr
%140 = call i32 (i32, i8*, ...) @fprintf(i32 %139, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.9, i64 0, i64 0))
br label %156
141: ; preds = %130, %146
%142 = phi i32 [ %143, %146 ], [ %114, %130 ]
%143 = add nsw i32 %142, -1
%144 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i8* %116, i8* %8, i8* %115)
%145 = icmp eq i32 %143, 0
br i1 %145, label %154, label %146
146: ; preds = %141
%147 = call i32 @putchar(i32 32)
%148 = call i32 @tosec(i8* %119)
%149 = load i32, i32* %4
%150 = add nsw i32 %149, %148
store i32 %150, i32* %4
%151 = call %struct.tm* @localtime(i32* %4)
%152 = call i32 @strftime(i8* %8, i32 1024, i8* %117, %struct.tm* %151)
%153 = icmp eq i32 %152, 0
br i1 %153, label %134, label %141
154: ; preds = %141, %126
%155 = call i32 @putchar(i32 10)
br label %156
156: ; preds = %13, %154, %134, %34, %32
%157 = phi i32 [ 0, %34 ], [ 0, %32 ], [ 1, %134 ], [ 0, %154 ], [ 1, %13 ]
ret i32 %157
}