#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 {
  int tm_wday;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
  int /*<<< orphan*/ tm_year;
  int /*<<< orphan*/ tm_mon;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char const *);
void ResolveMacros(time_t tTime, const char *filename, const char *template,
                   char *output, int maxsize) {
  struct tm *tm;
  int i = 0;
  int j = 0;
  tm = localtime(&tTime);
  for (i = 0; i < strlen(template); i++) {
    if (template[i] == '%') {
      switch (template[++i]) {
      case 'a':
        if ((j + 4) > maxsize) {
          output[j] = 0;
          return;
        }
        switch (tm->tm_wday) {
        case 0:
          strcat(output, "sun");
          break;
        case 1:
          strcat(output, "mon");
          break;
        case 2:
          strcat(output, "tue");
          break;
        case 3:
          strcat(output, "wed");
          break;
        case 4:
          strcat(output, "thu");
          break;
        case 5:
          strcat(output, "fri");
          break;
        case 6:
          strcat(output, "sat");
          break;
        }
        j += 3;
        break;
      case 'b':
        if ((j + 4) > maxsize) {
          output[j] = 0;
          return;
        }
        switch (tm->tm_mon) {
        case 0:
          strcat(output, "jan");
          break;
        case 1:
          strcat(output, "feb");
          break;
        case 2:
          strcat(output, "mar");
          break;
        case 3:
          strcat(output, "apr");
          break;
        case 4:
          strcat(output, "may");
          break;
        case 5:
          strcat(output, "jun");
          break;
        case 6:
          strcat(output, "jul");
          break;
        case 7:
          strcat(output, "aug");
          break;
        case 8:
          strcat(output, "sep");
          break;
        case 9:
          strcat(output, "oct");
          break;
        case 10:
          strcat(output, "nov");
          break;
        case 11:
          strcat(output, "dec");
          break;
        }
        j += 3;
        break;
      case 'd':
        if ((j + 3) > maxsize) {
          output[j] = 0;
          return;
        }
        sprintf(output + j, "%02d", tm->tm_mday);
        j += 2;
        break;
      case 'f':
        if ((j + strlen(filename) + 1) > maxsize) {
          output[j] = 0;
          return;
        }
        sprintf(output + j, "%s", filename);
        j += strlen(filename);
        break;
      case 'k':
        if ((j + 3) > maxsize) {
          output[j] = 0;
          return;
        }
        sprintf(output + j, "%02d", tm->tm_hour);
        j += 2;
        break;
      case 'm':
        if ((j + 3) > maxsize) {
          output[j] = 0;
          return;
        }
        sprintf(output + j, "%02d", tm->tm_mon + 1);
        j += 2;
        break;
      case 'M':
        if ((j + 3) > maxsize) {
          output[j] = 0;
          return;
        }
        sprintf(output + j, "%02d", tm->tm_min);
        j += 2;
        break;
      case 'S':
        if ((j + 3) > maxsize) {
          output[j] = 0;
          return;
        }
        sprintf(output + j, "%02d", tm->tm_sec);
        j += 2;
        break;
      case 'w':
        if ((j + 3) > maxsize) {
          output[j] = 0;
          return;
        }
        sprintf(output + j, "%02d", tm->tm_wday);
        j += 2;
        break;
      case 'Y':
        if ((j + 5) > maxsize) {
          output[j] = 0;
          return;
        }
        sprintf(output + j, "%04d", tm->tm_year + 1900);
        j += 4;
        break;
      case '%':
        if ((j + 2) > maxsize) {
          output[j] = 0;
          return;
        }
        sprintf(output + j, "%%");
        j += 1;
        break;
      }
    } else {
      if ((j + 2) > maxsize) {
        output[j] = 0;
        return;
      }
      output[j++] = template[i];
    }
  }
}


x86 assembly (clang, -O0):
<ResolveMacros>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
cmp    %ecx,%eax
jge    1743 <ResolveMacros+0x603>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x25,%eax
jne    16f0 <ResolveMacros+0x5b0>
mov    -0x18(%rbp),%rcx
movslq -0x34(%rbp),%rax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x34(%rbp)
movsbl 0x1(%rax,%rcx,1),%eax
add    $0xffffffdb,%eax
mov    %eax,%ecx
mov    %rcx,-0x48(%rbp)
sub    $0x52,%eax
ja     16eb <ResolveMacros+0x5ab>
mov    -0x48(%rbp),%rax
lea    0xe20(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x38(%rbp),%eax
add    $0x4,%eax
cmp    -0x24(%rbp),%eax
jle    1209 <ResolveMacros+0xc9>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1743 <ResolveMacros+0x603>
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    %rax,-0x50(%rbp)
sub    $0x6,%rax
ja     12bf <ResolveMacros+0x17f>
mov    -0x50(%rbp),%rax
lea    0xf54(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x20(%rbp),%rdi
lea    0xf5c(%rip),%rsi
call   1050 <strcat@plt>
jmp    12bf <ResolveMacros+0x17f>
mov    -0x20(%rbp),%rdi
lea    0xf4b(%rip),%rsi
call   1050 <strcat@plt>
jmp    12bf <ResolveMacros+0x17f>
mov    -0x20(%rbp),%rdi
lea    0xf3a(%rip),%rsi
call   1050 <strcat@plt>
jmp    12bf <ResolveMacros+0x17f>
mov    -0x20(%rbp),%rdi
lea    0xf29(%rip),%rsi
call   1050 <strcat@plt>
jmp    12bf <ResolveMacros+0x17f>
mov    -0x20(%rbp),%rdi
lea    0xf18(%rip),%rsi
call   1050 <strcat@plt>
jmp    12bf <ResolveMacros+0x17f>
mov    -0x20(%rbp),%rdi
lea    0xf07(%rip),%rsi
call   1050 <strcat@plt>
jmp    12bf <ResolveMacros+0x17f>
mov    -0x20(%rbp),%rdi
lea    0xef6(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x38(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x38(%rbp)
jmp    16eb <ResolveMacros+0x5ab>
mov    -0x38(%rbp),%eax
add    $0x4,%eax
cmp    -0x24(%rbp),%eax
jle    12ed <ResolveMacros+0x1ad>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1743 <ResolveMacros+0x603>
mov    -0x30(%rbp),%rax
mov    0x18(%rax),%eax
mov    %rax,-0x58(%rbp)
sub    $0xb,%rax
ja     140d <ResolveMacros+0x2cd>
mov    -0x58(%rbp),%rax
lea    0xe3f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x20(%rbp),%rdi
lea    0xe93(%rip),%rsi
call   1050 <strcat@plt>
jmp    140d <ResolveMacros+0x2cd>
mov    -0x20(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1050 <strcat@plt>
jmp    140d <ResolveMacros+0x2cd>
mov    -0x20(%rbp),%rdi
lea    0xe71(%rip),%rsi
call   1050 <strcat@plt>
jmp    140d <ResolveMacros+0x2cd>
mov    -0x20(%rbp),%rdi
lea    0xe60(%rip),%rsi
call   1050 <strcat@plt>
jmp    140d <ResolveMacros+0x2cd>
mov    -0x20(%rbp),%rdi
lea    0xe4f(%rip),%rsi
call   1050 <strcat@plt>
jmp    140d <ResolveMacros+0x2cd>
mov    -0x20(%rbp),%rdi
lea    0xe3e(%rip),%rsi
call   1050 <strcat@plt>
jmp    140d <ResolveMacros+0x2cd>
mov    -0x20(%rbp),%rdi
lea    0xe2d(%rip),%rsi
call   1050 <strcat@plt>
jmp    140d <ResolveMacros+0x2cd>
mov    -0x20(%rbp),%rdi
lea    0xe1c(%rip),%rsi
call   1050 <strcat@plt>
jmp    140d <ResolveMacros+0x2cd>
mov    -0x20(%rbp),%rdi
lea    0xe0b(%rip),%rsi
call   1050 <strcat@plt>
jmp    140d <ResolveMacros+0x2cd>
mov    -0x20(%rbp),%rdi
lea    0xdfa(%rip),%rsi
call   1050 <strcat@plt>
jmp    140d <ResolveMacros+0x2cd>
mov    -0x20(%rbp),%rdi
lea    0xde9(%rip),%rsi
call   1050 <strcat@plt>
jmp    140d <ResolveMacros+0x2cd>
mov    -0x20(%rbp),%rdi
lea    0xdd8(%rip),%rsi
call   1050 <strcat@plt>
mov    -0x38(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x38(%rbp)
jmp    16eb <ResolveMacros+0x5ab>
mov    -0x38(%rbp),%eax
add    $0x3,%eax
cmp    -0x24(%rbp),%eax
jle    143b <ResolveMacros+0x2fb>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1743 <ResolveMacros+0x603>
mov    -0x20(%rbp),%rdi
movslq -0x38(%rbp),%rax
add    %rax,%rdi
mov    -0x30(%rbp),%rax
mov    0x4(%rax),%edx
lea    0xd90(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    -0x38(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x38(%rbp)
jmp    16eb <ResolveMacros+0x5ab>
mov    -0x38(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
cmp    -0x24(%rbp),%eax
jle    149c <ResolveMacros+0x35c>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1743 <ResolveMacros+0x603>
mov    -0x20(%rbp),%rdi
movslq -0x38(%rbp),%rax
add    %rax,%rdi
mov    -0x10(%rbp),%rdx
lea    0xd37(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
add    -0x38(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    16eb <ResolveMacros+0x5ab>
mov    -0x38(%rbp),%eax
add    $0x3,%eax
cmp    -0x24(%rbp),%eax
jle    14ed <ResolveMacros+0x3ad>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1743 <ResolveMacros+0x603>
mov    -0x20(%rbp),%rdi
movslq -0x38(%rbp),%rax
add    %rax,%rdi
mov    -0x30(%rbp),%rax
mov    0x8(%rax),%edx
lea    0xcde(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    -0x38(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x38(%rbp)
jmp    16eb <ResolveMacros+0x5ab>
mov    -0x38(%rbp),%eax
add    $0x3,%eax
cmp    -0x24(%rbp),%eax
jle    153b <ResolveMacros+0x3fb>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1743 <ResolveMacros+0x603>
mov    -0x20(%rbp),%rdi
movslq -0x38(%rbp),%rax
add    %rax,%rdi
mov    -0x30(%rbp),%rax
mov    0x18(%rax),%edx
add    $0x1,%edx
lea    0xc8d(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    -0x38(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x38(%rbp)
jmp    16eb <ResolveMacros+0x5ab>
mov    -0x38(%rbp),%eax
add    $0x3,%eax
cmp    -0x24(%rbp),%eax
jle    158c <ResolveMacros+0x44c>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1743 <ResolveMacros+0x603>
mov    -0x20(%rbp),%rdi
movslq -0x38(%rbp),%rax
add    %rax,%rdi
mov    -0x30(%rbp),%rax
mov    0xc(%rax),%edx
lea    0xc3f(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    -0x38(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x38(%rbp)
jmp    16eb <ResolveMacros+0x5ab>
mov    -0x38(%rbp),%eax
add    $0x3,%eax
cmp    -0x24(%rbp),%eax
jle    15da <ResolveMacros+0x49a>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1743 <ResolveMacros+0x603>
mov    -0x20(%rbp),%rdi
movslq -0x38(%rbp),%rax
add    %rax,%rdi
mov    -0x30(%rbp),%rax
mov    0x10(%rax),%edx
lea    0xbf1(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    -0x38(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x38(%rbp)
jmp    16eb <ResolveMacros+0x5ab>
mov    -0x38(%rbp),%eax
add    $0x3,%eax
cmp    -0x24(%rbp),%eax
jle    1628 <ResolveMacros+0x4e8>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1743 <ResolveMacros+0x603>
mov    -0x20(%rbp),%rdi
movslq -0x38(%rbp),%rax
add    %rax,%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
lea    0xba4(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    -0x38(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x38(%rbp)
jmp    16eb <ResolveMacros+0x5ab>
mov    -0x38(%rbp),%eax
add    $0x5,%eax
cmp    -0x24(%rbp),%eax
jle    1675 <ResolveMacros+0x535>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1743 <ResolveMacros+0x603>
mov    -0x20(%rbp),%rdi
movslq -0x38(%rbp),%rax
add    %rax,%rdi
mov    -0x30(%rbp),%rax
mov    0x14(%rax),%edx
add    $0x76c,%edx
lea    0xb58(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    -0x38(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x38(%rbp)
jmp    16eb <ResolveMacros+0x5ab>
mov    -0x38(%rbp),%eax
add    $0x2,%eax
cmp    -0x24(%rbp),%eax
jle    16c9 <ResolveMacros+0x589>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1743 <ResolveMacros+0x603>
mov    -0x20(%rbp),%rdi
movslq -0x38(%rbp),%rax
add    %rax,%rdi
lea    0xb16(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1730 <ResolveMacros+0x5f0>
mov    -0x38(%rbp),%eax
add    $0x2,%eax
cmp    -0x24(%rbp),%eax
jle    1710 <ResolveMacros+0x5d0>
mov    -0x20(%rbp),%rax
movslq -0x38(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1743 <ResolveMacros+0x603>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x20(%rbp),%rax
mov    -0x38(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x38(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    1735 <ResolveMacros+0x5f5>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    117d <ResolveMacros+0x3d>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ResolveMacros>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,%ebp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,0x8(%rsp)
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%r13
mov    %rbx,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    139f <ResolveMacros+0x24f>
xor    %r15d,%r15d
xor    %r12d,%r12d
jmp    11d7 <ResolveMacros+0x87>
lea    0x3(%r15),%eax
cmp    %ebp,%eax
jg     1397 <ResolveMacros+0x247>
movslq %r15d,%rdi
add    %r14,%rdi
mov    0x0(%r13),%edx
nopl   0x0(%rax,%rax,1)
lea    0x102d(%rip),%rsi
xor    %eax,%eax
call   1070 <sprintf@plt>
add    $0x2,%r15d
add    $0x1,%r12d
mov    %rbx,%rdi
call   1050 <strlen@plt>
cmp    %eax,%r12d
jge    139f <ResolveMacros+0x24f>
movslq %r12d,%rcx
movzbl (%rbx,%rcx,1),%eax
cmp    $0x25,%al
jne    1230 <ResolveMacros+0xe0>
movsbl 0x1(%rbx,%rcx,1),%eax
add    $0x1,%rcx
mov    %ecx,%r12d
add    $0xffffffdb,%eax
cmp    $0x52,%eax
ja     11c2 <ResolveMacros+0x72>
lea    0xe03(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x2(%r15),%eax
cmp    %ebp,%eax
jg     1397 <ResolveMacros+0x247>
movslq %r15d,%rdi
add    %r14,%rdi
lea    0xfcf(%rip),%rsi
xor    %eax,%eax
call   1070 <sprintf@plt>
add    $0x1,%r15d
jmp    11c2 <ResolveMacros+0x72>
nopl   0x0(%rax)
lea    0x2(%r15),%ecx
cmp    %ebp,%ecx
jg     1397 <ResolveMacros+0x247>
movslq %r15d,%rcx
add    $0x1,%r15d
mov    %al,(%r14,%rcx,1)
jmp    11c2 <ResolveMacros+0x72>
lea    0x3(%r15),%eax
cmp    %ebp,%eax
jg     1397 <ResolveMacros+0x247>
movslq %r15d,%rdi
add    %r14,%rdi
mov    0xc(%r13),%edx
jmp    11b0 <ResolveMacros+0x60>
lea    0x3(%r15),%eax
cmp    %ebp,%eax
jg     1397 <ResolveMacros+0x247>
movslq %r15d,%rdi
add    %r14,%rdi
mov    0x10(%r13),%edx
jmp    11b0 <ResolveMacros+0x60>
lea    0x5(%r15),%eax
cmp    %ebp,%eax
jg     1397 <ResolveMacros+0x247>
movslq %r15d,%rdi
add    %r14,%rdi
mov    0x14(%r13),%edx
mov    $0x76c,%eax
add    %eax,%edx
lea    0xf43(%rip),%rsi
xor    %eax,%eax
call   1070 <sprintf@plt>
add    $0x4,%r15d
jmp    11c2 <ResolveMacros+0x72>
lea    0x4(%r15),%eax
cmp    %ebp,%eax
jg     1397 <ResolveMacros+0x247>
movslq 0x0(%r13),%rax
cmp    $0x6,%rax
ja     1301 <ResolveMacros+0x1b1>
lea    0xe79(%rip),%rcx
jmp    12f2 <ResolveMacros+0x1a2>
lea    0x4(%r15),%eax
cmp    %ebp,%eax
jg     1397 <ResolveMacros+0x247>
movslq 0x18(%r13),%rax
cmp    $0xb,%rax
ja     1301 <ResolveMacros+0x1b1>
lea    0xe76(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
mov    %r14,%rdi
call   1060 <strcat@plt>
add    $0x3,%r15d
jmp    11c2 <ResolveMacros+0x72>
lea    0x3(%r15),%eax
cmp    %ebp,%eax
jg     1397 <ResolveMacros+0x247>
movslq %r15d,%rdi
add    %r14,%rdi
mov    0x4(%r13),%edx
jmp    11b0 <ResolveMacros+0x60>
mov    0x8(%rsp),%rdi
call   1050 <strlen@plt>
add    %r15d,%eax
cmp    %ebp,%eax
jge    1397 <ResolveMacros+0x247>
movslq %r15d,%rdi
add    %r14,%rdi
mov    %r13,0x10(%rsp)
mov    0x8(%rsp),%r13
mov    %r13,%rsi
call   1040 <strcpy@plt>
mov    %r13,%rdi
mov    0x10(%rsp),%r13
call   1050 <strlen@plt>
add    %r15d,%eax
mov    %eax,%r15d
jmp    11c2 <ResolveMacros+0x72>
lea    0x3(%r15),%eax
cmp    %ebp,%eax
jg     1397 <ResolveMacros+0x247>
movslq %r15d,%rdi
add    %r14,%rdi
mov    0x8(%r13),%edx
jmp    11b0 <ResolveMacros+0x60>
lea    0x3(%r15),%eax
cmp    %ebp,%eax
jg     1397 <ResolveMacros+0x247>
movslq %r15d,%rdi
add    %r14,%rdi
mov    0x18(%r13),%edx
add    $0x1,%edx
jmp    11b0 <ResolveMacros+0x60>
movslq %r15d,%rax
movb   $0x0,(%r14,%rax,1)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32, 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 = [4 x i8] c"jan\00"
@.str.8 = [4 x i8] c"feb\00"
@.str.9 = [4 x i8] c"mar\00"
@.str.10 = [4 x i8] c"apr\00"
@.str.11 = [4 x i8] c"may\00"
@.str.12 = [4 x i8] c"jun\00"
@.str.13 = [4 x i8] c"jul\00"
@.str.14 = [4 x i8] c"aug\00"
@.str.15 = [4 x i8] c"sep\00"
@.str.16 = [4 x i8] c"oct\00"
@.str.17 = [4 x i8] c"nov\00"
@.str.18 = [4 x i8] c"dec\00"
@.str.19 = [5 x i8] c"%02d\00"
@.str.20 = [3 x i8] c"%s\00"
@.str.21 = [5 x i8] c"%04d\00"
@.str.22 = [3 x i8] c"%%\00"
define void @ResolveMacros(i32 %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca %struct.tm*
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
store i32 0, i32* %12
store i32 0, i32* %13
%14 = call %struct.tm* @localtime(i32* %6)
store %struct.tm* %14, %struct.tm** %11
store i32 0, i32* %12
br label %15
15: ; preds = %341, %5
%16 = load i32, i32* %12
%17 = load i8*, i8** %8
%18 = call i32 @strlen(i8* %17)
%19 = icmp slt i32 %16, %18
br i1 %19, label %20, label %344
20: ; preds = %15
%21 = load i8*, i8** %8
%22 = load i32, i32* %12
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 37
br i1 %27, label %28, label %319
28: ; preds = %20
%29 = load i8*, i8** %8
%30 = load i32, i32* %12
%31 = add nsw i32 %30, 1
store i32 %31, i32* %12
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %29, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
switch i32 %35, label %318 [
i32 97, label %36
i32 98, label %74
i32 100, label %127
i32 102, label %148
i32 107, label %172
i32 109, label %193
i32 77, label %215
i32 83, label %236
i32 119, label %257
i32 89, label %278
i32 37, label %300
]
36: ; preds = %28
%37 = load i32, i32* %13
%38 = add nsw i32 %37, 4
%39 = load i32, i32* %10
%40 = icmp sgt i32 %38, %39
br i1 %40, label %41, label %46
41: ; preds = %36
%42 = load i8*, i8** %9
%43 = load i32, i32* %13
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
store i8 0, i8* %45
br label %344
46: ; preds = %36
%47 = load %struct.tm*, %struct.tm** %11
%48 = getelementptr inbounds %struct.tm, %struct.tm* %47, i32 0, i32 0
%49 = load i32, i32* %48
switch i32 %49, label %71 [
i32 0, label %50
i32 1, label %53
i32 2, label %56
i32 3, label %59
i32 4, label %62
i32 5, label %65
i32 6, label %68
]
50: ; preds = %46
%51 = load i8*, i8** %9
%52 = call i32 @strcat(i8* %51, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %71
53: ; preds = %46
%54 = load i8*, i8** %9
%55 = call i32 @strcat(i8* %54, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
br label %71
56: ; preds = %46
%57 = load i8*, i8** %9
%58 = call i32 @strcat(i8* %57, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %71
59: ; preds = %46
%60 = load i8*, i8** %9
%61 = call i32 @strcat(i8* %60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %71
62: ; preds = %46
%63 = load i8*, i8** %9
%64 = call i32 @strcat(i8* %63, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %71
65: ; preds = %46
%66 = load i8*, i8** %9
%67 = call i32 @strcat(i8* %66, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
br label %71
68: ; preds = %46
%69 = load i8*, i8** %9
%70 = call i32 @strcat(i8* %69, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %71
71: ; preds = %46, %68, %65, %62, %59, %56, %53, %50
%72 = load i32, i32* %13
%73 = add nsw i32 %72, 3
store i32 %73, i32* %13
br label %318
74: ; preds = %28
%75 = load i32, i32* %13
%76 = add nsw i32 %75, 4
%77 = load i32, i32* %10
%78 = icmp sgt i32 %76, %77
br i1 %78, label %79, label %84
79: ; preds = %74
%80 = load i8*, i8** %9
%81 = load i32, i32* %13
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8, i8* %80, i64 %82
store i8 0, i8* %83
br label %344
84: ; preds = %74
%85 = load %struct.tm*, %struct.tm** %11
%86 = getelementptr inbounds %struct.tm, %struct.tm* %85, i32 0, i32 6
%87 = load i32, i32* %86
switch i32 %87, label %124 [
i32 0, label %88
i32 1, label %91
i32 2, label %94
i32 3, label %97
i32 4, label %100
i32 5, label %103
i32 6, label %106
i32 7, label %109
i32 8, label %112
i32 9, label %115
i32 10, label %118
i32 11, label %121
]
88: ; preds = %84
%89 = load i8*, i8** %9
%90 = call i32 @strcat(i8* %89, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
br label %124
91: ; preds = %84
%92 = load i8*, i8** %9
%93 = call i32 @strcat(i8* %92, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0))
br label %124
94: ; preds = %84
%95 = load i8*, i8** %9
%96 = call i32 @strcat(i8* %95, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0))
br label %124
97: ; preds = %84
%98 = load i8*, i8** %9
%99 = call i32 @strcat(i8* %98, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
br label %124
100: ; preds = %84
%101 = load i8*, i8** %9
%102 = call i32 @strcat(i8* %101, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
br label %124
103: ; preds = %84
%104 = load i8*, i8** %9
%105 = call i32 @strcat(i8* %104, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
br label %124
106: ; preds = %84
%107 = load i8*, i8** %9
%108 = call i32 @strcat(i8* %107, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0))
br label %124
109: ; preds = %84
%110 = load i8*, i8** %9
%111 = call i32 @strcat(i8* %110, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.14, i64 0, i64 0))
br label %124
112: ; preds = %84
%113 = load i8*, i8** %9
%114 = call i32 @strcat(i8* %113, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0))
br label %124
115: ; preds = %84
%116 = load i8*, i8** %9
%117 = call i32 @strcat(i8* %116, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0))
br label %124
118: ; preds = %84
%119 = load i8*, i8** %9
%120 = call i32 @strcat(i8* %119, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0))
br label %124
121: ; preds = %84
%122 = load i8*, i8** %9
%123 = call i32 @strcat(i8* %122, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0))
br label %124
124: ; preds = %84, %121, %118, %115, %112, %109, %106, %103, %100, %97, %94, %91, %88
%125 = load i32, i32* %13
%126 = add nsw i32 %125, 3
store i32 %126, i32* %13
br label %318
127: ; preds = %28
%128 = load i32, i32* %13
%129 = add nsw i32 %128, 3
%130 = load i32, i32* %10
%131 = icmp sgt i32 %129, %130
br i1 %131, label %132, label %137
132: ; preds = %127
%133 = load i8*, i8** %9
%134 = load i32, i32* %13
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i8, i8* %133, i64 %135
store i8 0, i8* %136
br label %344
137: ; preds = %127
%138 = load i8*, i8** %9
%139 = load i32, i32* %13
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i8, i8* %138, i64 %140
%142 = load %struct.tm*, %struct.tm** %11
%143 = getelementptr inbounds %struct.tm, %struct.tm* %142, i32 0, i32 1
%144 = load i32, i32* %143
%145 = call i32 (i8*, i8*, ...) @sprintf(i8* %141, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 %144)
%146 = load i32, i32* %13
%147 = add nsw i32 %146, 2
store i32 %147, i32* %13
br label %318
148: ; preds = %28
%149 = load i32, i32* %13
%150 = load i8*, i8** %7
%151 = call i32 @strlen(i8* %150)
%152 = add nsw i32 %149, %151
%153 = add nsw i32 %152, 1
%154 = load i32, i32* %10
%155 = icmp sgt i32 %153, %154
br i1 %155, label %156, label %161
156: ; preds = %148
%157 = load i8*, i8** %9
%158 = load i32, i32* %13
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds i8, i8* %157, i64 %159
store i8 0, i8* %160
br label %344
161: ; preds = %148
%162 = load i8*, i8** %9
%163 = load i32, i32* %13
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds i8, i8* %162, i64 %164
%166 = load i8*, i8** %7
%167 = call i32 (i8*, i8*, ...) @sprintf(i8* %165, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), i8* %166)
%168 = load i8*, i8** %7
%169 = call i32 @strlen(i8* %168)
%170 = load i32, i32* %13
%171 = add nsw i32 %170, %169
store i32 %171, i32* %13
br label %318
172: ; preds = %28
%173 = load i32, i32* %13
%174 = add nsw i32 %173, 3
%175 = load i32, i32* %10
%176 = icmp sgt i32 %174, %175
br i1 %176, label %177, label %182
177: ; preds = %172
%178 = load i8*, i8** %9
%179 = load i32, i32* %13
%180 = sext i32 %179 to i64
%181 = getelementptr inbounds i8, i8* %178, i64 %180
store i8 0, i8* %181
br label %344
182: ; preds = %172
%183 = load i8*, i8** %9
%184 = load i32, i32* %13
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds i8, i8* %183, i64 %185
%187 = load %struct.tm*, %struct.tm** %11
%188 = getelementptr inbounds %struct.tm, %struct.tm* %187, i32 0, i32 2
%189 = load i32, i32* %188
%190 = call i32 (i8*, i8*, ...) @sprintf(i8* %186, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 %189)
%191 = load i32, i32* %13
%192 = add nsw i32 %191, 2
store i32 %192, i32* %13
br label %318
193: ; preds = %28
%194 = load i32, i32* %13
%195 = add nsw i32 %194, 3
%196 = load i32, i32* %10
%197 = icmp sgt i32 %195, %196
br i1 %197, label %198, label %203
198: ; preds = %193
%199 = load i8*, i8** %9
%200 = load i32, i32* %13
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds i8, i8* %199, i64 %201
store i8 0, i8* %202
br label %344
203: ; preds = %193
%204 = load i8*, i8** %9
%205 = load i32, i32* %13
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds i8, i8* %204, i64 %206
%208 = load %struct.tm*, %struct.tm** %11
%209 = getelementptr inbounds %struct.tm, %struct.tm* %208, i32 0, i32 6
%210 = load i32, i32* %209
%211 = add nsw i32 %210, 1
%212 = call i32 (i8*, i8*, ...) @sprintf(i8* %207, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 %211)
%213 = load i32, i32* %13
%214 = add nsw i32 %213, 2
store i32 %214, i32* %13
br label %318
215: ; preds = %28
%216 = load i32, i32* %13
%217 = add nsw i32 %216, 3
%218 = load i32, i32* %10
%219 = icmp sgt i32 %217, %218
br i1 %219, label %220, label %225
220: ; preds = %215
%221 = load i8*, i8** %9
%222 = load i32, i32* %13
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds i8, i8* %221, i64 %223
store i8 0, i8* %224
br label %344
225: ; preds = %215
%226 = load i8*, i8** %9
%227 = load i32, i32* %13
%228 = sext i32 %227 to i64
%229 = getelementptr inbounds i8, i8* %226, i64 %228
%230 = load %struct.tm*, %struct.tm** %11
%231 = getelementptr inbounds %struct.tm, %struct.tm* %230, i32 0, i32 3
%232 = load i32, i32* %231
%233 = call i32 (i8*, i8*, ...) @sprintf(i8* %229, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 %232)
%234 = load i32, i32* %13
%235 = add nsw i32 %234, 2
store i32 %235, i32* %13
br label %318
236: ; preds = %28
%237 = load i32, i32* %13
%238 = add nsw i32 %237, 3
%239 = load i32, i32* %10
%240 = icmp sgt i32 %238, %239
br i1 %240, label %241, label %246
241: ; preds = %236
%242 = load i8*, i8** %9
%243 = load i32, i32* %13
%244 = sext i32 %243 to i64
%245 = getelementptr inbounds i8, i8* %242, i64 %244
store i8 0, i8* %245
br label %344
246: ; preds = %236
%247 = load i8*, i8** %9
%248 = load i32, i32* %13
%249 = sext i32 %248 to i64
%250 = getelementptr inbounds i8, i8* %247, i64 %249
%251 = load %struct.tm*, %struct.tm** %11
%252 = getelementptr inbounds %struct.tm, %struct.tm* %251, i32 0, i32 4
%253 = load i32, i32* %252
%254 = call i32 (i8*, i8*, ...) @sprintf(i8* %250, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 %253)
%255 = load i32, i32* %13
%256 = add nsw i32 %255, 2
store i32 %256, i32* %13
br label %318
257: ; preds = %28
%258 = load i32, i32* %13
%259 = add nsw i32 %258, 3
%260 = load i32, i32* %10
%261 = icmp sgt i32 %259, %260
br i1 %261, label %262, label %267
262: ; preds = %257
%263 = load i8*, i8** %9
%264 = load i32, i32* %13
%265 = sext i32 %264 to i64
%266 = getelementptr inbounds i8, i8* %263, i64 %265
store i8 0, i8* %266
br label %344
267: ; preds = %257
%268 = load i8*, i8** %9
%269 = load i32, i32* %13
%270 = sext i32 %269 to i64
%271 = getelementptr inbounds i8, i8* %268, i64 %270
%272 = load %struct.tm*, %struct.tm** %11
%273 = getelementptr inbounds %struct.tm, %struct.tm* %272, i32 0, i32 0
%274 = load i32, i32* %273
%275 = call i32 (i8*, i8*, ...) @sprintf(i8* %271, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 %274)
%276 = load i32, i32* %13
%277 = add nsw i32 %276, 2
store i32 %277, i32* %13
br label %318
278: ; preds = %28
%279 = load i32, i32* %13
%280 = add nsw i32 %279, 5
%281 = load i32, i32* %10
%282 = icmp sgt i32 %280, %281
br i1 %282, label %283, label %288
283: ; preds = %278
%284 = load i8*, i8** %9
%285 = load i32, i32* %13
%286 = sext i32 %285 to i64
%287 = getelementptr inbounds i8, i8* %284, i64 %286
store i8 0, i8* %287
br label %344
288: ; preds = %278
%289 = load i8*, i8** %9
%290 = load i32, i32* %13
%291 = sext i32 %290 to i64
%292 = getelementptr inbounds i8, i8* %289, i64 %291
%293 = load %struct.tm*, %struct.tm** %11
%294 = getelementptr inbounds %struct.tm, %struct.tm* %293, i32 0, i32 5
%295 = load i32, i32* %294
%296 = add nsw i32 %295, 1900
%297 = call i32 (i8*, i8*, ...) @sprintf(i8* %292, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i64 0, i64 0), i32 %296)
%298 = load i32, i32* %13
%299 = add nsw i32 %298, 4
store i32 %299, i32* %13
br label %318
300: ; preds = %28
%301 = load i32, i32* %13
%302 = add nsw i32 %301, 2
%303 = load i32, i32* %10
%304 = icmp sgt i32 %302, %303
br i1 %304, label %305, label %310
305: ; preds = %300
%306 = load i8*, i8** %9
%307 = load i32, i32* %13
%308 = sext i32 %307 to i64
%309 = getelementptr inbounds i8, i8* %306, i64 %308
store i8 0, i8* %309
br label %344
310: ; preds = %300
%311 = load i8*, i8** %9
%312 = load i32, i32* %13
%313 = sext i32 %312 to i64
%314 = getelementptr inbounds i8, i8* %311, i64 %313
%315 = call i32 (i8*, i8*, ...) @sprintf(i8* %314, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0))
%316 = load i32, i32* %13
%317 = add nsw i32 %316, 1
store i32 %317, i32* %13
br label %318
318: ; preds = %28, %310, %288, %267, %246, %225, %203, %182, %161, %137, %124, %71
br label %340
319: ; preds = %20
%320 = load i32, i32* %13
%321 = add nsw i32 %320, 2
%322 = load i32, i32* %10
%323 = icmp sgt i32 %321, %322
br i1 %323, label %324, label %329
324: ; preds = %319
%325 = load i8*, i8** %9
%326 = load i32, i32* %13
%327 = sext i32 %326 to i64
%328 = getelementptr inbounds i8, i8* %325, i64 %327
store i8 0, i8* %328
br label %344
329: ; preds = %319
%330 = load i8*, i8** %8
%331 = load i32, i32* %12
%332 = sext i32 %331 to i64
%333 = getelementptr inbounds i8, i8* %330, i64 %332
%334 = load i8, i8* %333
%335 = load i8*, i8** %9
%336 = load i32, i32* %13
%337 = add nsw i32 %336, 1
store i32 %337, i32* %13
%338 = sext i32 %336 to i64
%339 = getelementptr inbounds i8, i8* %335, i64 %338
store i8 %334, i8* %339
br label %340
340: ; preds = %329, %318
br label %341
341: ; preds = %340
%342 = load i32, i32* %12
%343 = add nsw i32 %342, 1
store i32 %343, i32* %12
br label %15
344: ; preds = %41, %79, %132, %156, %177, %198, %220, %241, %262, %283, %305, %324, %15
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32, 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 = [4 x i8] c"jan\00"
@.str.8 = [4 x i8] c"feb\00"
@.str.9 = [4 x i8] c"mar\00"
@.str.10 = [4 x i8] c"apr\00"
@.str.11 = [4 x i8] c"may\00"
@.str.12 = [4 x i8] c"jun\00"
@.str.13 = [4 x i8] c"jul\00"
@.str.14 = [4 x i8] c"aug\00"
@.str.15 = [4 x i8] c"sep\00"
@.str.16 = [4 x i8] c"oct\00"
@.str.17 = [4 x i8] c"nov\00"
@.str.18 = [4 x i8] c"dec\00"
@.str.19 = [5 x i8] c"%02d\00"
@.str.21 = [5 x i8] c"%04d\00"
@.str.22 = [3 x i8] c"%%\00"
@reltable.ResolveMacros = [7 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([7 x i32]* @reltable.ResolveMacros to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([7 x i32]* @reltable.ResolveMacros to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([7 x i32]* @reltable.ResolveMacros to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.3 to i64), i64 ptrtoint ([7 x i32]* @reltable.ResolveMacros to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([7 x i32]* @reltable.ResolveMacros to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.5 to i64), i64 ptrtoint ([7 x i32]* @reltable.ResolveMacros to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.6 to i64), i64 ptrtoint ([7 x i32]* @reltable.ResolveMacros to i64)) to i32)]
@reltable.ResolveMacros.24 = [12 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.7 to i64), i64 ptrtoint ([12 x i32]* @reltable.ResolveMacros.24 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.8 to i64), i64 ptrtoint ([12 x i32]* @reltable.ResolveMacros.24 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.9 to i64), i64 ptrtoint ([12 x i32]* @reltable.ResolveMacros.24 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.10 to i64), i64 ptrtoint ([12 x i32]* @reltable.ResolveMacros.24 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.11 to i64), i64 ptrtoint ([12 x i32]* @reltable.ResolveMacros.24 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.12 to i64), i64 ptrtoint ([12 x i32]* @reltable.ResolveMacros.24 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.13 to i64), i64 ptrtoint ([12 x i32]* @reltable.ResolveMacros.24 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.14 to i64), i64 ptrtoint ([12 x i32]* @reltable.ResolveMacros.24 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.15 to i64), i64 ptrtoint ([12 x i32]* @reltable.ResolveMacros.24 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.16 to i64), i64 ptrtoint ([12 x i32]* @reltable.ResolveMacros.24 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.17 to i64), i64 ptrtoint ([12 x i32]* @reltable.ResolveMacros.24 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.18 to i64), i64 ptrtoint ([12 x i32]* @reltable.ResolveMacros.24 to i64)) to i32)]
define void @ResolveMacros(i32 %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i32
store i32 %0, i32* %6
%7 = call %struct.tm* @localtime(i32* %6)
%8 = call i32 @strlen(i8* %2)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %156
10: ; preds = %5
%11 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 5
%12 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 0
%13 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 4
%14 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 3
%15 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 6
%16 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 2
%17 = getelementptr inbounds %struct.tm, %struct.tm* %7, i64 0, i32 1
br label %18
18: ; preds = %10, %147
%19 = phi i32 [ 0, %10 ], [ %149, %147 ]
%20 = phi i32 [ 0, %10 ], [ %150, %147 ]
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %2, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 37
br i1 %24, label %25, label %140
25: ; preds = %18
%26 = add nsw i32 %20, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %2, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
switch i32 %30, label %147 [
i32 97, label %31
i32 98, label %44
i32 100, label %57
i32 102, label %66
i32 107, label %76
i32 109, label %85
i32 77, label %95
i32 83, label %104
i32 119, label %113
i32 89, label %122
i32 37, label %132
]
31: ; preds = %25
%32 = add nsw i32 %19, 4
%33 = icmp sgt i32 %32, %4
br i1 %33, label %153, label %34
34: ; preds = %31
%35 = load i32, i32* %12
%36 = icmp ult i32 %35, 7
br i1 %36, label %37, label %42
37: ; preds = %34
%38 = sext i32 %35 to i64
%39 = shl i64 %38, 2
%40 = call i8* @llvm.load.relative.i64(i8* bitcast ([7 x i32]* @reltable.ResolveMacros to i8*), i64 %39)
%41 = call i32 @strcat(i8* %3, i8* %40)
br label %42
42: ; preds = %34, %37
%43 = add nsw i32 %19, 3
br label %147
44: ; preds = %25
%45 = add nsw i32 %19, 4
%46 = icmp sgt i32 %45, %4
br i1 %46, label %153, label %47
47: ; preds = %44
%48 = load i32, i32* %15
%49 = icmp ult i32 %48, 12
br i1 %49, label %50, label %55
50: ; preds = %47
%51 = sext i32 %48 to i64
%52 = shl i64 %51, 2
%53 = call i8* @llvm.load.relative.i64(i8* bitcast ([12 x i32]* @reltable.ResolveMacros.24 to i8*), i64 %52)
%54 = call i32 @strcat(i8* %3, i8* %53)
br label %55
55: ; preds = %47, %50
%56 = add nsw i32 %19, 3
br label %147
57: ; preds = %25
%58 = add nsw i32 %19, 3
%59 = icmp sgt i32 %58, %4
br i1 %59, label %153, label %60
60: ; preds = %57
%61 = sext i32 %19 to i64
%62 = getelementptr inbounds i8, i8* %3, i64 %61
%63 = load i32, i32* %17
%64 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %62, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 %63)
%65 = add nsw i32 %19, 2
br label %147
66: ; preds = %25
%67 = call i32 @strlen(i8* %1)
%68 = add nsw i32 %67, %19
%69 = icmp slt i32 %68, %4
br i1 %69, label %70, label %153
70: ; preds = %66
%71 = sext i32 %19 to i64
%72 = getelementptr inbounds i8, i8* %3, i64 %71
%73 = call i8* @strcpy(i8* dereferenceable(1) %72, i8* dereferenceable(1) %1)
%74 = call i32 @strlen(i8* %1)
%75 = add nsw i32 %74, %19
br label %147
76: ; preds = %25
%77 = add nsw i32 %19, 3
%78 = icmp sgt i32 %77, %4
br i1 %78, label %153, label %79
79: ; preds = %76
%80 = sext i32 %19 to i64
%81 = getelementptr inbounds i8, i8* %3, i64 %80
%82 = load i32, i32* %16
%83 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %81, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 %82)
%84 = add nsw i32 %19, 2
br label %147
85: ; preds = %25
%86 = add nsw i32 %19, 3
%87 = icmp sgt i32 %86, %4
br i1 %87, label %153, label %88
88: ; preds = %85
%89 = sext i32 %19 to i64
%90 = getelementptr inbounds i8, i8* %3, i64 %89
%91 = load i32, i32* %15
%92 = add nsw i32 %91, 1
%93 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %90, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 %92)
%94 = add nsw i32 %19, 2
br label %147
95: ; preds = %25
%96 = add nsw i32 %19, 3
%97 = icmp sgt i32 %96, %4
br i1 %97, label %153, label %98
98: ; preds = %95
%99 = sext i32 %19 to i64
%100 = getelementptr inbounds i8, i8* %3, i64 %99
%101 = load i32, i32* %14
%102 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %100, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 %101)
%103 = add nsw i32 %19, 2
br label %147
104: ; preds = %25
%105 = add nsw i32 %19, 3
%106 = icmp sgt i32 %105, %4
br i1 %106, label %153, label %107
107: ; preds = %104
%108 = sext i32 %19 to i64
%109 = getelementptr inbounds i8, i8* %3, i64 %108
%110 = load i32, i32* %13
%111 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %109, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 %110)
%112 = add nsw i32 %19, 2
br label %147
113: ; preds = %25
%114 = add nsw i32 %19, 3
%115 = icmp sgt i32 %114, %4
br i1 %115, label %153, label %116
116: ; preds = %113
%117 = sext i32 %19 to i64
%118 = getelementptr inbounds i8, i8* %3, i64 %117
%119 = load i32, i32* %12
%120 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %118, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.19, i64 0, i64 0), i32 %119)
%121 = add nsw i32 %19, 2
br label %147
122: ; preds = %25
%123 = add nsw i32 %19, 5
%124 = icmp sgt i32 %123, %4
br i1 %124, label %153, label %125
125: ; preds = %122
%126 = sext i32 %19 to i64
%127 = getelementptr inbounds i8, i8* %3, i64 %126
%128 = load i32, i32* %11
%129 = add nsw i32 %128, 1900
%130 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %127, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i64 0, i64 0), i32 %129)
%131 = add nsw i32 %19, 4
br label %147
132: ; preds = %25
%133 = add nsw i32 %19, 2
%134 = icmp sgt i32 %133, %4
br i1 %134, label %153, label %135
135: ; preds = %132
%136 = sext i32 %19 to i64
%137 = getelementptr inbounds i8, i8* %3, i64 %136
%138 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %137, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0))
%139 = add nsw i32 %19, 1
br label %147
140: ; preds = %18
%141 = add nsw i32 %19, 2
%142 = icmp sgt i32 %141, %4
br i1 %142, label %153, label %143
143: ; preds = %140
%144 = add nsw i32 %19, 1
%145 = sext i32 %19 to i64
%146 = getelementptr inbounds i8, i8* %3, i64 %145
store i8 %23, i8* %146
br label %147
147: ; preds = %143, %25, %135, %125, %116, %107, %98, %88, %79, %70, %60, %55, %42
%148 = phi i32 [ %26, %25 ], [ %26, %135 ], [ %26, %125 ], [ %26, %116 ], [ %26, %107 ], [ %26, %98 ], [ %26, %88 ], [ %26, %79 ], [ %26, %70 ], [ %26, %60 ], [ %26, %55 ], [ %26, %42 ], [ %20, %143 ]
%149 = phi i32 [ %19, %25 ], [ %139, %135 ], [ %131, %125 ], [ %121, %116 ], [ %112, %107 ], [ %103, %98 ], [ %94, %88 ], [ %84, %79 ], [ %75, %70 ], [ %65, %60 ], [ %56, %55 ], [ %43, %42 ], [ %144, %143 ]
%150 = add nsw i32 %148, 1
%151 = call i32 @strlen(i8* %2)
%152 = icmp slt i32 %150, %151
br i1 %152, label %18, label %156
153: ; preds = %140, %132, %122, %113, %104, %95, %85, %76, %66, %57, %44, %31
%154 = sext i32 %19 to i64
%155 = getelementptr inbounds i8, i8* %3, i64 %154
store i8 0, i8* %155
br label %156
156: ; preds = %147, %153, %5
ret void
}