#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 */
char *convertTOchar(int);
int sceKernelLibcTime(void *);
char *getDay() {
  int tempy = sceKernelLibcTime((void *)0);
  int days_this_year = (tempy - 1104537600) / (24 * 60 * 60);
  int day_of_month;
  static char *day;
  if (days_this_year <= 31) {
    day_of_month = 31 - days_this_year;
  } else if (days_this_year > 31 && days_this_year <= 59) {
    day_of_month = 59 - days_this_year;
  } else if (days_this_year > 59 && days_this_year <= 90) {
    day_of_month = 90 - days_this_year;
  } else if (days_this_year > 90 && days_this_year <= 120) {
    day_of_month = 120 - days_this_year;
  } else if (days_this_year > 120 && days_this_year <= 151) {
    day_of_month = 151 - days_this_year;
  } else if (days_this_year > 151 && days_this_year <= 181) {
    day_of_month = 181 - days_this_year;
  } else if (days_this_year > 181 && days_this_year <= 212) {
    day_of_month = 212 - days_this_year;
  } else if (days_this_year > 212 && days_this_year <= 243) {
    day_of_month = 243 - days_this_year;
  } else if (days_this_year > 243 && days_this_year <= 273) {
    day_of_month = 273 - days_this_year;
  } else if (days_this_year > 273 && days_this_year <= 304) {
    day_of_month = 304 - days_this_year;
  } else if (days_this_year > 304 && days_this_year <= 334) {
    day_of_month = 334 - days_this_year;
  } else if (days_this_year > 334 && days_this_year <= 365) {
    day_of_month = 365 - days_this_year;
  }
  day = convertTOchar(day_of_month);
  return day;
}


x86 assembly (clang, -O0):
<getDay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1030 <sceKernelLibcTime@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x41d5e800,%eax
mov    $0x15180,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
cmpl   $0x1f,-0x8(%rbp)
jg     1161 <getDay+0x41>
mov    $0x1f,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    134c <getDay+0x22c>
cmpl   $0x1f,-0x8(%rbp)
jle    1185 <getDay+0x65>
cmpl   $0x3b,-0x8(%rbp)
jg     1185 <getDay+0x65>
mov    $0x3b,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1347 <getDay+0x227>
cmpl   $0x3b,-0x8(%rbp)
jle    11a9 <getDay+0x89>
cmpl   $0x5a,-0x8(%rbp)
jg     11a9 <getDay+0x89>
mov    $0x5a,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1342 <getDay+0x222>
cmpl   $0x5a,-0x8(%rbp)
jle    11cd <getDay+0xad>
cmpl   $0x78,-0x8(%rbp)
jg     11cd <getDay+0xad>
mov    $0x78,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    133d <getDay+0x21d>
cmpl   $0x78,-0x8(%rbp)
jle    11f4 <getDay+0xd4>
cmpl   $0x97,-0x8(%rbp)
jg     11f4 <getDay+0xd4>
mov    $0x97,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1338 <getDay+0x218>
cmpl   $0x97,-0x8(%rbp)
jle    121e <getDay+0xfe>
cmpl   $0xb5,-0x8(%rbp)
jg     121e <getDay+0xfe>
mov    $0xb5,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1333 <getDay+0x213>
cmpl   $0xb5,-0x8(%rbp)
jle    1248 <getDay+0x128>
cmpl   $0xd4,-0x8(%rbp)
jg     1248 <getDay+0x128>
mov    $0xd4,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    132e <getDay+0x20e>
cmpl   $0xd4,-0x8(%rbp)
jle    1272 <getDay+0x152>
cmpl   $0xf3,-0x8(%rbp)
jg     1272 <getDay+0x152>
mov    $0xf3,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1329 <getDay+0x209>
cmpl   $0xf3,-0x8(%rbp)
jle    129c <getDay+0x17c>
cmpl   $0x111,-0x8(%rbp)
jg     129c <getDay+0x17c>
mov    $0x111,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1324 <getDay+0x204>
cmpl   $0x111,-0x8(%rbp)
jle    12c6 <getDay+0x1a6>
cmpl   $0x130,-0x8(%rbp)
jg     12c6 <getDay+0x1a6>
mov    $0x130,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    131f <getDay+0x1ff>
cmpl   $0x130,-0x8(%rbp)
jle    12f0 <getDay+0x1d0>
cmpl   $0x14e,-0x8(%rbp)
jg     12f0 <getDay+0x1d0>
mov    $0x14e,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    131a <getDay+0x1fa>
cmpl   $0x14e,-0x8(%rbp)
jle    1315 <getDay+0x1f5>
cmpl   $0x16d,-0x8(%rbp)
jg     1315 <getDay+0x1f5>
mov    $0x16d,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    131a <getDay+0x1fa>
jmp    131f <getDay+0x1ff>
jmp    1324 <getDay+0x204>
jmp    1329 <getDay+0x209>
jmp    132e <getDay+0x20e>
jmp    1333 <getDay+0x213>
jmp    1338 <getDay+0x218>
jmp    133d <getDay+0x21d>
jmp    1342 <getDay+0x222>
jmp    1347 <getDay+0x227>
jmp    134c <getDay+0x22c>
mov    -0xc(%rbp),%edi
call   1040 <convertTOchar@plt>
mov    %rax,0x2cdd(%rip)
mov    0x2cd6(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getDay>:
push   %rax
xor    %edi,%edi
call   1030 <sceKernelLibcTime@plt>
mov    $0x1f,%ecx
cmp    $0x42001800,%eax
jl     11b1 <getDay+0x91>
mov    $0x3b,%ecx
cmp    $0x42250200,%eax
jb     11b1 <getDay+0x91>
mov    $0x5a,%ecx
cmp    $0x424de080,%eax
jb     11b1 <getDay+0x91>
mov    $0x78,%ecx
cmp    $0x42756d80,%eax
jb     11b1 <getDay+0x91>
mov    $0x97,%ecx
cmp    $0x429e4c00,%eax
jb     11b1 <getDay+0x91>
mov    $0xb5,%ecx
cmp    $0x42c5d900,%eax
jb     11b1 <getDay+0x91>
mov    $0xd4,%ecx
cmp    $0x42eeb780,%eax
jb     11b1 <getDay+0x91>
mov    $0xf3,%ecx
cmp    $0x43179600,%eax
jb     11b1 <getDay+0x91>
mov    $0x111,%ecx
cmp    $0x433f2300,%eax
jb     11b1 <getDay+0x91>
mov    $0x130,%ecx
cmp    $0x43680180,%eax
jb     11b1 <getDay+0x91>
mov    $0x14e,%ecx
cmp    $0x438f8e80,%eax
jb     11b1 <getDay+0x91>
mov    $0x16d,%ecx
add    $0xbe2a1800,%eax
cltq
imul   $0x3dd1baf9,%rax,%rdi
shr    $0x20,%rdi
sub    %eax,%edi
mov    %edi,%eax
shr    $0x1f,%eax
sar    $0x10,%edi
add    %eax,%edi
add    %ecx,%edi
call   1040 <convertTOchar@plt>
mov    %rax,0x2e5b(%rip)
pop    %rcx
ret

LLVM IR (-O0):
@getDay.day = internal global i8* null
define i8* @getDay() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @sceKernelLibcTime(i8* null)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = sub nsw i32 %5, 1104537600
%7 = sdiv i32 %6, 86400
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 31
br i1 %9, label %10, label %13
10: ; preds = %0
%11 = load i32, i32* %2
%12 = sub nsw i32 31, %11
store i32 %12, i32* %3
br label %123
13: ; preds = %0
%14 = load i32, i32* %2
%15 = icmp sgt i32 %14, 31
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load i32, i32* %2
%18 = icmp sle i32 %17, 59
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %2
%21 = sub nsw i32 59, %20
store i32 %21, i32* %3
br label %122
22: ; preds = %16, %13
%23 = load i32, i32* %2
%24 = icmp sgt i32 %23, 59
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = load i32, i32* %2
%27 = icmp sle i32 %26, 90
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %2
%30 = sub nsw i32 90, %29
store i32 %30, i32* %3
br label %121
31: ; preds = %25, %22
%32 = load i32, i32* %2
%33 = icmp sgt i32 %32, 90
br i1 %33, label %34, label %40
34: ; preds = %31
%35 = load i32, i32* %2
%36 = icmp sle i32 %35, 120
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i32, i32* %2
%39 = sub nsw i32 120, %38
store i32 %39, i32* %3
br label %120
40: ; preds = %34, %31
%41 = load i32, i32* %2
%42 = icmp sgt i32 %41, 120
br i1 %42, label %43, label %49
43: ; preds = %40
%44 = load i32, i32* %2
%45 = icmp sle i32 %44, 151
br i1 %45, label %46, label %49
46: ; preds = %43
%47 = load i32, i32* %2
%48 = sub nsw i32 151, %47
store i32 %48, i32* %3
br label %119
49: ; preds = %43, %40
%50 = load i32, i32* %2
%51 = icmp sgt i32 %50, 151
br i1 %51, label %52, label %58
52: ; preds = %49
%53 = load i32, i32* %2
%54 = icmp sle i32 %53, 181
br i1 %54, label %55, label %58
55: ; preds = %52
%56 = load i32, i32* %2
%57 = sub nsw i32 181, %56
store i32 %57, i32* %3
br label %118
58: ; preds = %52, %49
%59 = load i32, i32* %2
%60 = icmp sgt i32 %59, 181
br i1 %60, label %61, label %67
61: ; preds = %58
%62 = load i32, i32* %2
%63 = icmp sle i32 %62, 212
br i1 %63, label %64, label %67
64: ; preds = %61
%65 = load i32, i32* %2
%66 = sub nsw i32 212, %65
store i32 %66, i32* %3
br label %117
67: ; preds = %61, %58
%68 = load i32, i32* %2
%69 = icmp sgt i32 %68, 212
br i1 %69, label %70, label %76
70: ; preds = %67
%71 = load i32, i32* %2
%72 = icmp sle i32 %71, 243
br i1 %72, label %73, label %76
73: ; preds = %70
%74 = load i32, i32* %2
%75 = sub nsw i32 243, %74
store i32 %75, i32* %3
br label %116
76: ; preds = %70, %67
%77 = load i32, i32* %2
%78 = icmp sgt i32 %77, 243
br i1 %78, label %79, label %85
79: ; preds = %76
%80 = load i32, i32* %2
%81 = icmp sle i32 %80, 273
br i1 %81, label %82, label %85
82: ; preds = %79
%83 = load i32, i32* %2
%84 = sub nsw i32 273, %83
store i32 %84, i32* %3
br label %115
85: ; preds = %79, %76
%86 = load i32, i32* %2
%87 = icmp sgt i32 %86, 273
br i1 %87, label %88, label %94
88: ; preds = %85
%89 = load i32, i32* %2
%90 = icmp sle i32 %89, 304
br i1 %90, label %91, label %94
91: ; preds = %88
%92 = load i32, i32* %2
%93 = sub nsw i32 304, %92
store i32 %93, i32* %3
br label %114
94: ; preds = %88, %85
%95 = load i32, i32* %2
%96 = icmp sgt i32 %95, 304
br i1 %96, label %97, label %103
97: ; preds = %94
%98 = load i32, i32* %2
%99 = icmp sle i32 %98, 334
br i1 %99, label %100, label %103
100: ; preds = %97
%101 = load i32, i32* %2
%102 = sub nsw i32 334, %101
store i32 %102, i32* %3
br label %113
103: ; preds = %97, %94
%104 = load i32, i32* %2
%105 = icmp sgt i32 %104, 334
br i1 %105, label %106, label %112
106: ; preds = %103
%107 = load i32, i32* %2
%108 = icmp sle i32 %107, 365
br i1 %108, label %109, label %112
109: ; preds = %106
%110 = load i32, i32* %2
%111 = sub nsw i32 365, %110
store i32 %111, i32* %3
br label %112
112: ; preds = %109, %106, %103
br label %113
113: ; preds = %112, %100
br label %114
114: ; preds = %113, %91
br label %115
115: ; preds = %114, %82
br label %116
116: ; preds = %115, %73
br label %117
117: ; preds = %116, %64
br label %118
118: ; preds = %117, %55
br label %119
119: ; preds = %118, %46
br label %120
120: ; preds = %119, %37
br label %121
121: ; preds = %120, %28
br label %122
122: ; preds = %121, %19
br label %123
123: ; preds = %122, %10
%124 = load i32, i32* %3
%125 = call i8* @convertTOchar(i32 %124)
store i8* %125, i8** @getDay.day
%126 = load i8*, i8** @getDay.day
ret i8* %126
}

LLVM IR (-O2):
@getDay.day = internal unnamed_addr global i8* null
define i8* @getDay() {
%1 = tail call i32 @sceKernelLibcTime(i8* null)
%2 = icmp slt i32 %1, 1107302400
br i1 %2, label %25, label %3
3: ; preds = %0
%4 = icmp ult i32 %1, 1109721600
br i1 %4, label %25, label %5
5: ; preds = %3
%6 = icmp ult i32 %1, 1112400000
br i1 %6, label %25, label %7
7: ; preds = %5
%8 = icmp ult i32 %1, 1114992000
br i1 %8, label %25, label %9
9: ; preds = %7
%10 = icmp ult i32 %1, 1117670400
br i1 %10, label %25, label %11
11: ; preds = %9
%12 = icmp ult i32 %1, 1120262400
br i1 %12, label %25, label %13
13: ; preds = %11
%14 = icmp ult i32 %1, 1122940800
br i1 %14, label %25, label %15
15: ; preds = %13
%16 = icmp ult i32 %1, 1125619200
br i1 %16, label %25, label %17
17: ; preds = %15
%18 = icmp ult i32 %1, 1128211200
br i1 %18, label %25, label %19
19: ; preds = %17
%20 = icmp ult i32 %1, 1130889600
br i1 %20, label %25, label %21
21: ; preds = %19
%22 = icmp ult i32 %1, 1133481600
br i1 %22, label %25, label %23
23: ; preds = %21
%24 = icmp ult i32 %1, 1136160000
tail call void @llvm.assume(i1 %24)
br label %25
25: ; preds = %21, %19, %17, %15, %13, %11, %9, %7, %5, %3, %0, %23
%26 = phi i32 [ 365, %23 ], [ 31, %0 ], [ 59, %3 ], [ 90, %5 ], [ 120, %7 ], [ 151, %9 ], [ 181, %11 ], [ 212, %13 ], [ 243, %15 ], [ 273, %17 ], [ 304, %19 ], [ 334, %21 ]
%27 = add nsw i32 %1, -1104537600
%28 = sdiv i32 %27, -86400
%29 = add nsw i32 %26, %28
%30 = tail call i8* @convertTOchar(i32 %29)
store i8* %30, i8** @getDay.day
ret i8* %30
}