#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, int);
char *solve(int year) {
  char *s = (char *)malloc(sizeof(char) * 11);
  if (year < 1918 && year >= 1700) {
    if (year % 4 == 0) {
      sprintf(s, "12.09.%d", year);
    } else {
      sprintf(s, "13.09.%d", year);
    }
  } else if (year > 1918 && year <= 2700) {
    if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
      sprintf(s, "12.09.%d", year);
    } else {
      sprintf(s, "13.09.%d", year);
    }
  } else {
    sprintf(s, "26.09.%d", year);
  }
  return s;
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0xb,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x77e,-0x4(%rbp)
jge    1197 <solve+0x77>
cmpl   $0x6a4,-0x4(%rbp)
jl     1197 <solve+0x77>
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    117f <solve+0x5f>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe8b(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1192 <solve+0x72>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe7c(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1235 <solve+0x115>
cmpl   $0x77e,-0x4(%rbp)
jle    121d <solve+0xfd>
cmpl   $0xa8c,-0x4(%rbp)
jg     121d <solve+0xfd>
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11d9 <solve+0xb9>
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11ed <solve+0xcd>
mov    -0x4(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1205 <solve+0xe5>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe05(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1218 <solve+0xf8>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xdf6(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1230 <solve+0x110>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xde7(%rip),%rsi
call   1040 <sprintf@plt>
jmp    1235 <solve+0x115>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0xb,%edi
call   1030 <malloc@plt>
mov    %rax,%r14
lea    -0x6a4(%rbx),%eax
cmp    $0xd9,%eax
ja     1157 <solve+0x37>
test   $0x3,%bl
lea    0xeb6(%rip),%rax
lea    0xeb8(%rip),%rsi
cmove  %rax,%rsi
jmp    11ae <solve+0x8e>
lea    -0x77f(%rbx),%eax
cmp    $0x30d,%eax
ja     11a7 <solve+0x87>
imul   $0x5c29,%ebx,%eax
mov    %eax,%ecx
ror    $0x2,%cx
movzwl %cx,%ecx
ror    $0x4,%ax
cmp    $0x290,%ecx
lea    0xe7c(%rip),%rcx
lea    0xe7e(%rip),%rdx
mov    %rdx,%rsi
cmovae %rcx,%rsi
test   $0x3,%bl
cmovne %rdx,%rsi
movzwl %ax,%eax
cmp    $0xa4,%eax
cmovb  %rcx,%rsi
jmp    11ae <solve+0x8e>
lea    0xe64(%rip),%rsi
mov    %r14,%rdi
mov    %ebx,%edx
call   1040 <sprintf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"12.09.%d\00"
@.str.1 = [9 x i8] c"13.09.%d\00"
@.str.2 = [9 x i8] c"26.09.%d\00"
define i8* @solve(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = call i64 @malloc(i32 11)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %3
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 1918
br i1 %7, label %8, label %24
8: ; preds = %1
%9 = load i32, i32* %2
%10 = icmp sge i32 %9, 1700
br i1 %10, label %11, label %24
11: ; preds = %8
%12 = load i32, i32* %2
%13 = srem i32 %12, 4
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = load i32, i32* %2
%18 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %23
19: ; preds = %11
%20 = load i8*, i8** %3
%21 = load i32, i32* %2
%22 = call i32 @sprintf(i8* %20, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %19, %15
br label %56
24: ; preds = %8, %1
%25 = load i32, i32* %2
%26 = icmp sgt i32 %25, 1918
br i1 %26, label %27, label %51
27: ; preds = %24
%28 = load i32, i32* %2
%29 = icmp sle i32 %28, 2700
br i1 %29, label %30, label %51
30: ; preds = %27
%31 = load i32, i32* %2
%32 = srem i32 %31, 4
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %38
34: ; preds = %30
%35 = load i32, i32* %2
%36 = srem i32 %35, 100
%37 = icmp ne i32 %36, 0
br i1 %37, label %42, label %38
38: ; preds = %34, %30
%39 = load i32, i32* %2
%40 = srem i32 %39, 400
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %38, %34
%43 = load i8*, i8** %3
%44 = load i32, i32* %2
%45 = call i32 @sprintf(i8* %43, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %44)
br label %50
46: ; preds = %38
%47 = load i8*, i8** %3
%48 = load i32, i32* %2
%49 = call i32 @sprintf(i8* %47, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %46, %42
br label %55
51: ; preds = %27, %24
%52 = load i8*, i8** %3
%53 = load i32, i32* %2
%54 = call i32 @sprintf(i8* %52, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %53)
br label %55
55: ; preds = %51, %50
br label %56
56: ; preds = %55, %23
%57 = load i8*, i8** %3
ret i8* %57
}

LLVM IR (-O2):
@.str = [9 x i8] c"12.09.%d\00"
@.str.1 = [9 x i8] c"13.09.%d\00"
@.str.2 = [9 x i8] c"26.09.%d\00"
define i8* @solve(i32 %0) {
%2 = tail call i64 @malloc(i32 11)
%3 = inttoptr i64 %2 to i8*
%4 = add i32 %0, -1700
%5 = icmp ult i32 %4, 218
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = and i32 %0, 3
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0)
br label %24
10: ; preds = %1
%11 = add i32 %0, -1919
%12 = icmp ult i32 %11, 782
br i1 %12, label %13, label %24
13: ; preds = %10
%14 = and i32 %0, 3
%15 = icmp eq i32 %14, 0
%16 = trunc i32 %0 to i16
%17 = urem i16 %16, 100
%18 = icmp ne i16 %17, 0
%19 = and i1 %15, %18
%20 = urem i16 %16, 400
%21 = icmp eq i16 %20, 0
%22 = or i1 %21, %19
%23 = select i1 %22, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0)
br label %24
24: ; preds = %10, %13, %6
%25 = phi i8* [ %9, %6 ], [ %23, %13 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), %10 ]
%26 = tail call i32 @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) %25, i32 %0)
ret i8* %3
}