#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 /*<<< orphan*/ sprintf(char *, char *, int, char *, int);
char *prettydate(int oldd) {
  static char *months[] = {"Jan", "Feb", "Mar", "Apr", "Mai", "Jun",
                           "Jul", "Ago", "Sep", "Oct", "Nov", "Dec"};
  static char dd[12];
  int ano, mes, dia;
  ano = oldd / 10000;
  oldd -= ano * 10000;
  mes = oldd / 100;
  oldd -= mes * 100;
  dia = oldd;
  sprintf(dd, "%02d-%s-%04d", dia, months[mes - 1], ano);
  return dd;
}


x86 assembly (clang, -O0):
<prettydate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
imul   $0x2710,-0x8(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
imul   $0x64,-0xc(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
movslq %eax,%rcx
lea    0x2ec5(%rip),%rax
mov    (%rax,%rcx,8),%rcx
mov    -0x8(%rbp),%r8d
lea    0x2f17(%rip),%rdi
lea    0xeaf(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2f04(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prettydate>:
push   %rbx
movslq %edi,%rax
imul   $0x68db8bad,%rax,%r8
mov    %r8,%rcx
shr    $0x3f,%rcx
sar    $0x2c,%r8
add    %ecx,%r8d
imul   $0xffffd8f0,%r8d,%ecx
add    %ecx,%eax
movslq %eax,%rdx
imul   $0x51eb851f,%rdx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0xffffff9c,%eax,%ecx
add    %ecx,%edx
cltq
lea    0xea9(%rip),%rsi
movslq -0x4(%rsi,%rax,4),%rcx
add    %rsi,%rcx
lea    0x2ec3(%rip),%rbx
lea    0xef3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@prettydate.months = internal global [12 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i32 0, i32 0)]
@.str = [4 x i8] c"Jan\00"
@.str.1 = [4 x i8] c"Feb\00"
@.str.2 = [4 x i8] c"Mar\00"
@.str.3 = [4 x i8] c"Apr\00"
@.str.4 = [4 x i8] c"Mai\00"
@.str.5 = [4 x i8] c"Jun\00"
@.str.6 = [4 x i8] c"Jul\00"
@.str.7 = [4 x i8] c"Ago\00"
@.str.8 = [4 x i8] c"Sep\00"
@.str.9 = [4 x i8] c"Oct\00"
@.str.10 = [4 x i8] c"Nov\00"
@.str.11 = [4 x i8] c"Dec\00"
@prettydate.dd = internal global [12 x i8] zeroinitializer
@.str.12 = [13 x i8] c"%02d-%s-%04d\00"
define i8* @prettydate(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = sdiv i32 %6, 10000
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = mul nsw i32 %8, 10000
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, %9
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = sdiv i32 %12, 100
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = mul nsw i32 %14, 100
%16 = load i32, i32* %2
%17 = sub nsw i32 %16, %15
store i32 %17, i32* %2
%18 = load i32, i32* %2
store i32 %18, i32* %5
%19 = load i32, i32* %5
%20 = load i32, i32* %4
%21 = sub nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [12 x i8*], [12 x i8*]* @prettydate.months, i64 0, i64 %22
%24 = load i8*, i8** %23
%25 = load i32, i32* %3
%26 = call i32 @sprintf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @prettydate.dd, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i32 %19, i8* %24, i32 %25)
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @prettydate.dd, i64 0, i64 0)
}

LLVM IR (-O2):
@reltable.prettydate = internal unnamed_addr constant [12 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([12 x i32]* @reltable.prettydate to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([12 x i32]* @reltable.prettydate to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([12 x i32]* @reltable.prettydate to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.3 to i64), i64 ptrtoint ([12 x i32]* @reltable.prettydate to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([12 x i32]* @reltable.prettydate to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.5 to i64), i64 ptrtoint ([12 x i32]* @reltable.prettydate to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.6 to i64), i64 ptrtoint ([12 x i32]* @reltable.prettydate to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.7 to i64), i64 ptrtoint ([12 x i32]* @reltable.prettydate to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.8 to i64), i64 ptrtoint ([12 x i32]* @reltable.prettydate to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.9 to i64), i64 ptrtoint ([12 x i32]* @reltable.prettydate to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.10 to i64), i64 ptrtoint ([12 x i32]* @reltable.prettydate to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.11 to i64), i64 ptrtoint ([12 x i32]* @reltable.prettydate to i64)) to i32)]
@.str = [4 x i8] c"Jan\00"
@.str.1 = [4 x i8] c"Feb\00"
@.str.2 = [4 x i8] c"Mar\00"
@.str.3 = [4 x i8] c"Apr\00"
@.str.4 = [4 x i8] c"Mai\00"
@.str.5 = [4 x i8] c"Jun\00"
@.str.6 = [4 x i8] c"Jul\00"
@.str.7 = [4 x i8] c"Ago\00"
@.str.8 = [4 x i8] c"Sep\00"
@.str.9 = [4 x i8] c"Oct\00"
@.str.10 = [4 x i8] c"Nov\00"
@.str.11 = [4 x i8] c"Dec\00"
@prettydate.dd = internal global [12 x i8] zeroinitializer
@.str.12 = [13 x i8] c"%02d-%s-%04d\00"
define i8* @prettydate(i32 %0) {
%2 = sdiv i32 %0, 10000
%3 = mul nsw i32 %2, -10000
%4 = add i32 %3, %0
%5 = sdiv i32 %4, 100
%6 = mul nsw i32 %5, -100
%7 = add i32 %6, %4
%8 = add nsw i32 %5, -1
%9 = sext i32 %8 to i64
%10 = shl i64 %9, 2
%11 = call i8* @llvm.load.relative.i64(i8* bitcast ([12 x i32]* @reltable.prettydate to i8*), i64 %10)
%12 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @prettydate.dd, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i32 %7, i8* %11, i32 %2)
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @prettydate.dd, i64 0, i64 0)
}