#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 */

/* Variables and functions */
int atoi(char *);
size_t isLeapYear(int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int CalNewDate(char *srcDate, int days, char *desDate) {
  if (days == 0) {
    strcpy(desDate, srcDate);
  } else {
    char tmpYear[5];
    char tmpMonth[3];
    char tmpDay[3];
    int year = 0;
    int month = 0;
    int day = 0;
    int monthDays[2][13] = {365, 31, 28, 31, 30,  31, 30, 31, 31,
                            30,  31, 30, 31, 366, 31, 29, 31, 30,
                            31,  30, 31, 31, 30,  31, 30, 31};
    strncpy(tmpYear, srcDate, 4);
    strncpy(tmpMonth, srcDate + 4, 2);
    strncpy(tmpDay, srcDate + 4 + 2, 2);
    tmpYear[4] = '\0';
    tmpMonth[2] = '\0';
    tmpDay[2] = '\0';
    year = atoi(tmpYear);
    month = atoi(tmpMonth);
    day = atoi(tmpDay);
    day += days;
    if (days > 0) {
      while (day > monthDays[isLeapYear(year)][month]) {
        day -= monthDays[isLeapYear(year)][month];
        month += 1;
        if (month > 12) {
          year += 1;
          month = 1;
        }
      }
    } else {
      while (day <= 0) {
        month -= 1;
        if (month < 1) {
          year -= 1;
          month = 12;
        }
        day += monthDays[isLeapYear(year)][month];
      }
    }
    sprintf(tmpYear, "%d", year);
    month < 10 ? sprintf(tmpMonth, "0%d", month)
               : sprintf(tmpMonth, "%d", month);
    day < 10 ? sprintf(tmpDay, "0%d", day) : sprintf(tmpDay, "%d", day);
    strcpy(desDate, tmpYear);
    strcat(desDate, tmpMonth);
    strcat(desDate, tmpDay);
    desDate[8] = '\0';
  }
  return 0;
}


x86 assembly (clang, -O0):
<CalNewDate>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    11a2 <CalNewDate+0x32>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcpy@plt>
jmp    13f1 <CalNewDate+0x281>
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
lea    -0xa0(%rbp),%rdi
lea    0xe3b(%rip),%rsi
mov    $0x68,%edx
call   1050 <memcpy@plt>
lea    -0x1d(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
lea    -0x23(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
add    $0x2,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x19(%rbp)
movb   $0x0,-0x1e(%rbp)
movb   $0x0,-0x21(%rbp)
lea    -0x1d(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x28(%rbp)
lea    -0x20(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x2c(%rbp)
lea    -0x23(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x30(%rbp)
mov    -0xc(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    12e3 <CalNewDate+0x173>
jmp    1259 <CalNewDate+0xe9>
mov    -0x30(%rbp),%eax
mov    %eax,-0xa4(%rbp)
mov    -0x28(%rbp),%edi
call   1060 <isLeapYear@plt>
mov    %rax,%rdx
mov    -0xa4(%rbp),%eax
lea    -0xa0(%rbp),%rcx
imul   $0x34,%rdx,%rdx
add    %rdx,%rcx
movslq -0x2c(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jle    12de <CalNewDate+0x16e>
mov    -0x28(%rbp),%edi
call   1060 <isLeapYear@plt>
mov    %rax,%rcx
lea    -0xa0(%rbp),%rax
imul   $0x34,%rcx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
mov    -0x30(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0xc,-0x2c(%rbp)
jle    12d9 <CalNewDate+0x169>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
jmp    1259 <CalNewDate+0xe9>
jmp    1345 <CalNewDate+0x1d5>
jmp    12e8 <CalNewDate+0x178>
cmpl   $0x0,-0x30(%rbp)
jg     1340 <CalNewDate+0x1d0>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x1,-0x2c(%rbp)
jge    1315 <CalNewDate+0x1a5>
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x28(%rbp)
movl   $0xc,-0x2c(%rbp)
mov    -0x28(%rbp),%edi
call   1060 <isLeapYear@plt>
mov    %rax,%rcx
lea    -0xa0(%rbp),%rax
imul   $0x34,%rcx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
jmp    12e8 <CalNewDate+0x178>
jmp    1345 <CalNewDate+0x1d5>
lea    -0x1d(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0xd16(%rip),%rsi
call   1090 <sprintf@plt>
cmpl   $0xa,-0x2c(%rbp)
jge    137a <CalNewDate+0x20a>
lea    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%edx
lea    0xcf8(%rip),%rsi
call   1090 <sprintf@plt>
jmp    138d <CalNewDate+0x21d>
lea    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%edx
lea    0xce1(%rip),%rsi
call   1090 <sprintf@plt>
cmpl   $0xa,-0x30(%rbp)
jge    13af <CalNewDate+0x23f>
lea    -0x23(%rbp),%rdi
mov    -0x30(%rbp),%edx
lea    0xcc3(%rip),%rsi
call   1090 <sprintf@plt>
jmp    13c2 <CalNewDate+0x252>
lea    -0x23(%rbp),%rdi
mov    -0x30(%rbp),%edx
lea    0xcac(%rip),%rsi
call   1090 <sprintf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x1d(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    -0x23(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x18(%rbp),%rax
movb   $0x0,0x8(%rax)
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CalNewDate>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
test   %esi,%esi
je     1265 <CalNewDate+0x105>
mov    %esi,%ebp
mov    %rdx,0x10(%rsp)
lea    0xb(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1030 <strncpy@plt>
lea    0x4(%rbx),%rsi
lea    0x8(%rsp),%r13
mov    %r13,%rdi
mov    $0x2,%edx
call   1030 <strncpy@plt>
add    $0x6,%rbx
lea    0x5(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1030 <strncpy@plt>
movb   $0x0,0xf(%rsp)
movb   $0x0,0xa(%rsp)
movb   $0x0,0x7(%rsp)
mov    %r15,%rdi
call   1060 <atoi@plt>
mov    %eax,%r12d
mov    %r13,%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1060 <atoi@plt>
mov    %eax,%r15d
add    %ebp,%r15d
test   %ebp,%ebp
jle    1275 <CalNewDate+0x115>
mov    %r12d,%edi
call   1050 <isLeapYear@plt>
movslq %ebx,%r13
imul   $0x34,%rax,%rax
lea    0xdf0(%rip),%r14
add    %r14,%rax
cmp    (%rax,%r13,4),%r15d
jle    127e <CalNewDate+0x11e>
nopl   0x0(%rax)
mov    %r12d,%edi
call   1050 <isLeapYear@plt>
imul   $0x34,%rax,%rax
add    %r14,%rax
sub    (%rax,%r13,4),%r15d
lea    0x1(%rbx),%ebp
xor    %eax,%eax
cmp    $0xc,%ebx
setge  %al
mov    $0x1,%ecx
cmovge %ecx,%ebp
add    %eax,%r12d
mov    %r12d,%edi
call   1050 <isLeapYear@plt>
movslq %ebp,%r13
imul   $0x34,%rax,%rax
add    %r14,%rax
mov    %ebp,%ebx
cmp    (%rax,%r13,4),%r15d
jg     1220 <CalNewDate+0xc0>
jmp    1280 <CalNewDate+0x120>
mov    %rdx,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
jmp    12ff <CalNewDate+0x19f>
test   %r15d,%r15d
jle    1310 <CalNewDate+0x1b0>
mov    %ebx,%ebp
lea    0xde2(%rip),%rbx
lea    0xb(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12d,%edx
call   1080 <sprintf@plt>
cmp    $0xa,%ebp
lea    0xdc4(%rip),%r13
mov    %rbx,%rsi
cmovl  %r13,%rsi
lea    0x8(%rsp),%r12
mov    %r12,%rdi
mov    %ebp,%edx
call   1080 <sprintf@plt>
cmp    $0xa,%r15d
cmovl  %r13,%rbx
lea    0x5(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r15d,%edx
call   1080 <sprintf@plt>
mov    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1070 <strcat@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1070 <strcat@plt>
movb   $0x0,0x8(%rbx)
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0xc,%r14d
lea    0xce3(%rip),%r13
nopl   (%rax)
lea    -0x1(%rbx),%ebp
xor    %eax,%eax
cmp    $0x2,%ebx
setl   %al
cmovl  %r14d,%ebp
sub    %eax,%r12d
mov    %r12d,%edi
call   1050 <isLeapYear@plt>
imul   $0x34,%rax,%rax
add    %r13,%rax
mov    %ebp,%ebx
add    (%rax,%rbp,4),%r15d
jle    1320 <CalNewDate+0x1c0>
jmp    1280 <CalNewDate+0x120>

LLVM IR (-O0):
@__const.CalNewDate.monthDays = [2 x [13 x i32]] [[13 x i32] [i32 365, i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31], [13 x i32] [i32 366, i32 31, i32 29, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]]
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"0%d\00"
define i32 @CalNewDate(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca [5 x i8]
%8 = alloca [3 x i8]
%9 = alloca [3 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [2 x [13 x i32]]
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%14 = load i32, i32* %5
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %20
16: ; preds = %3
%17 = load i8*, i8** %6
%18 = load i8*, i8** %4
%19 = call i32 @strcpy(i8* %17, i8* %18)
br label %140
20: ; preds = %3
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
%21 = bitcast [2 x [13 x i32]]* %13 to i8*
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%23 = load i8*, i8** %4
%24 = call i32 @strncpy(i8* %22, i8* %23, i32 4)
%25 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i64 4
%28 = call i32 @strncpy(i8* %25, i8* %27, i32 2)
%29 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%30 = load i8*, i8** %4
%31 = getelementptr inbounds i8, i8* %30, i64 4
%32 = getelementptr inbounds i8, i8* %31, i64 2
%33 = call i32 @strncpy(i8* %29, i8* %32, i32 2)
%34 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 4
store i8 0, i8* %34
%35 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 2
store i8 0, i8* %35
%36 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 2
store i8 0, i8* %36
%37 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%38 = call i32 @atoi(i8* %37)
store i32 %38, i32* %10
%39 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%40 = call i32 @atoi(i8* %39)
store i32 %40, i32* %11
%41 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%42 = call i32 @atoi(i8* %41)
store i32 %42, i32* %12
%43 = load i32, i32* %5
%44 = load i32, i32* %12
%45 = add nsw i32 %44, %43
store i32 %45, i32* %12
%46 = load i32, i32* %5
%47 = icmp sgt i32 %46, 0
br i1 %47, label %48, label %78
48: ; preds = %20
br label %49
49: ; preds = %76, %48
%50 = load i32, i32* %12
%51 = load i32, i32* %10
%52 = call i64 @isLeapYear(i32 %51)
%53 = getelementptr inbounds [2 x [13 x i32]], [2 x [13 x i32]]* %13, i64 0, i64 %52
%54 = load i32, i32* %11
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [13 x i32], [13 x i32]* %53, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = icmp sgt i32 %50, %57
br i1 %58, label %59, label %77
59: ; preds = %49
%60 = load i32, i32* %10
%61 = call i64 @isLeapYear(i32 %60)
%62 = getelementptr inbounds [2 x [13 x i32]], [2 x [13 x i32]]* %13, i64 0, i64 %61
%63 = load i32, i32* %11
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [13 x i32], [13 x i32]* %62, i64 0, i64 %64
%66 = load i32, i32* %65
%67 = load i32, i32* %12
%68 = sub nsw i32 %67, %66
store i32 %68, i32* %12
%69 = load i32, i32* %11
%70 = add nsw i32 %69, 1
store i32 %70, i32* %11
%71 = load i32, i32* %11
%72 = icmp sgt i32 %71, 12
br i1 %72, label %73, label %76
73: ; preds = %59
%74 = load i32, i32* %10
%75 = add nsw i32 %74, 1
store i32 %75, i32* %10
store i32 1, i32* %11
br label %76
76: ; preds = %73, %59
br label %49
77: ; preds = %49
br label %101
78: ; preds = %20
br label %79
79: ; preds = %90, %78
%80 = load i32, i32* %12
%81 = icmp sle i32 %80, 0
br i1 %81, label %82, label %100
82: ; preds = %79
%83 = load i32, i32* %11
%84 = sub nsw i32 %83, 1
store i32 %84, i32* %11
%85 = load i32, i32* %11
%86 = icmp slt i32 %85, 1
br i1 %86, label %87, label %90
87: ; preds = %82
%88 = load i32, i32* %10
%89 = sub nsw i32 %88, 1
store i32 %89, i32* %10
store i32 12, i32* %11
br label %90
90: ; preds = %87, %82
%91 = load i32, i32* %10
%92 = call i64 @isLeapYear(i32 %91)
%93 = getelementptr inbounds [2 x [13 x i32]], [2 x [13 x i32]]* %13, i64 0, i64 %92
%94 = load i32, i32* %11
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [13 x i32], [13 x i32]* %93, i64 0, i64 %95
%97 = load i32, i32* %96
%98 = load i32, i32* %12
%99 = add nsw i32 %98, %97
store i32 %99, i32* %12
br label %79
100: ; preds = %79
br label %101
101: ; preds = %100, %77
%102 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%103 = load i32, i32* %10
%104 = call i32 @sprintf(i8* %102, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %103)
%105 = load i32, i32* %11
%106 = icmp slt i32 %105, 10
br i1 %106, label %107, label %111
107: ; preds = %101
%108 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%109 = load i32, i32* %11
%110 = call i32 @sprintf(i8* %108, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %109)
br label %115
111: ; preds = %101
%112 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%113 = load i32, i32* %11
%114 = call i32 @sprintf(i8* %112, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %113)
br label %115
115: ; preds = %111, %107
%116 = phi i32 [ %110, %107 ], [ %114, %111 ]
%117 = load i32, i32* %12
%118 = icmp slt i32 %117, 10
br i1 %118, label %119, label %123
119: ; preds = %115
%120 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%121 = load i32, i32* %12
%122 = call i32 @sprintf(i8* %120, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %121)
br label %127
123: ; preds = %115
%124 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%125 = load i32, i32* %12
%126 = call i32 @sprintf(i8* %124, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %125)
br label %127
127: ; preds = %123, %119
%128 = phi i32 [ %122, %119 ], [ %126, %123 ]
%129 = load i8*, i8** %6
%130 = getelementptr inbounds [5 x i8], [5 x i8]* %7, i64 0, i64 0
%131 = call i32 @strcpy(i8* %129, i8* %130)
%132 = load i8*, i8** %6
%133 = getelementptr inbounds [3 x i8], [3 x i8]* %8, i64 0, i64 0
%134 = call i32 @strcat(i8* %132, i8* %133)
%135 = load i8*, i8** %6
%136 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%137 = call i32 @strcat(i8* %135, i8* %136)
%138 = load i8*, i8** %6
%139 = getelementptr inbounds i8, i8* %138, i64 8
store i8 0, i8* %139
br label %140
140: ; preds = %127, %16
ret i32 0
}

LLVM IR (-O2):
@__const.CalNewDate.monthDays = [2 x [13 x i32]] [[13 x i32] [i32 365, i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31], [13 x i32] [i32 366, i32 31, i32 29, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]]
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"0%d\00"
define i32 @CalNewDate(i8* %0, i32 %1, i8* %2) {
%4 = alloca [5 x i8]
%5 = alloca [3 x i8]
%6 = alloca [3 x i8]
%7 = icmp eq i32 %1, 0
br i1 %7, label %8, label %10
8: ; preds = %3
%9 = tail call i32 @strcpy(i8* %2, i8* %0)
br label %84
10: ; preds = %3
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 0
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%13 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%14 = call i32 @strncpy(i8* %11, i8* %0, i32 4)
%15 = getelementptr inbounds i8, i8* %0, i64 4
%16 = call i32 @strncpy(i8* %12, i8* %15, i32 2)
%17 = getelementptr inbounds i8, i8* %0, i64 6
%18 = call i32 @strncpy(i8* %13, i8* %17, i32 2)
%19 = getelementptr inbounds [5 x i8], [5 x i8]* %4, i64 0, i64 4
store i8 0, i8* %19
%20 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 2
store i8 0, i8* %20
%21 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 2
store i8 0, i8* %21
%22 = call i32 @atoi(i8* %11)
%23 = call i32 @atoi(i8* %12)
%24 = call i32 @atoi(i8* %13)
%25 = add nsw i32 %24, %1
%26 = icmp sgt i32 %1, 0
br i1 %26, label %29, label %27
27: ; preds = %10
%28 = icmp slt i32 %25, 1
br i1 %28, label %54, label %69
29: ; preds = %10
%30 = call i64 @isLeapYear(i32 %22)
%31 = sext i32 %23 to i64
%32 = getelementptr inbounds [2 x [13 x i32]], [2 x [13 x i32]]* @__const.CalNewDate.monthDays, i64 0, i64 %30, i64 %31
%33 = load i32, i32* %32
%34 = icmp sgt i32 %25, %33
br i1 %34, label %35, label %69
35: ; preds = %29, %35
%36 = phi i64 [ %50, %35 ], [ %31, %29 ]
%37 = phi i32 [ %43, %35 ], [ %25, %29 ]
%38 = phi i32 [ %48, %35 ], [ %23, %29 ]
%39 = phi i32 [ %47, %35 ], [ %22, %29 ]
%40 = call i64 @isLeapYear(i32 %39)
%41 = getelementptr inbounds [2 x [13 x i32]], [2 x [13 x i32]]* @__const.CalNewDate.monthDays, i64 0, i64 %40, i64 %36
%42 = load i32, i32* %41
%43 = sub nsw i32 %37, %42
%44 = add nsw i32 %38, 1
%45 = icmp sgt i32 %38, 11
%46 = zext i1 %45 to i32
%47 = add nsw i32 %39, %46
%48 = select i1 %45, i32 1, i32 %44
%49 = call i64 @isLeapYear(i32 %47)
%50 = sext i32 %48 to i64
%51 = getelementptr inbounds [2 x [13 x i32]], [2 x [13 x i32]]* @__const.CalNewDate.monthDays, i64 0, i64 %49, i64 %50
%52 = load i32, i32* %51
%53 = icmp sgt i32 %43, %52
br i1 %53, label %35, label %69
54: ; preds = %27, %54
%55 = phi i32 [ %67, %54 ], [ %25, %27 ]
%56 = phi i32 [ %62, %54 ], [ %23, %27 ]
%57 = phi i32 [ %61, %54 ], [ %22, %27 ]
%58 = add nsw i32 %56, -1
%59 = icmp slt i32 %56, 2
%60 = sext i1 %59 to i32
%61 = add nsw i32 %57, %60
%62 = select i1 %59, i32 12, i32 %58
%63 = call i64 @isLeapYear(i32 %61)
%64 = zext i32 %62 to i64
%65 = getelementptr inbounds [2 x [13 x i32]], [2 x [13 x i32]]* @__const.CalNewDate.monthDays, i64 0, i64 %63, i64 %64
%66 = load i32, i32* %65
%67 = add nsw i32 %66, %55
%68 = icmp slt i32 %67, 1
br i1 %68, label %54, label %69
69: ; preds = %54, %35, %27, %29
%70 = phi i32 [ %22, %29 ], [ %22, %27 ], [ %47, %35 ], [ %61, %54 ]
%71 = phi i32 [ %23, %29 ], [ %23, %27 ], [ %48, %35 ], [ %62, %54 ]
%72 = phi i32 [ %25, %29 ], [ %25, %27 ], [ %43, %35 ], [ %67, %54 ]
%73 = call i32 @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %70)
%74 = icmp slt i32 %71, 10
%75 = select i1 %74, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
%76 = call i32 @sprintf(i8* %12, i8* dereferenceable(1) %75, i32 %71)
%77 = icmp slt i32 %72, 10
%78 = select i1 %77, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
%79 = call i32 @sprintf(i8* %13, i8* dereferenceable(1) %78, i32 %72)
%80 = call i32 @strcpy(i8* %2, i8* %11)
%81 = call i32 @strcat(i8* %2, i8* %12)
%82 = call i32 @strcat(i8* %2, i8* %13)
%83 = getelementptr inbounds i8, i8* %2, i64 8
store i8 0, i8* %83
br label %84
84: ; preds = %69, %8
ret i32 0
}