#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 get_english_ordinal(int);
char *short_month_to_long_month(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, int, int, int);
int sscanf(char const *, char *, char *, int *, int *);
char *date_macro_to_nice_date(char *string, const char *d) {
  int day, year;
  char month[16];
  string[0] = '\0';
  if (sscanf(d, "%s %d %d", month, &day, &year) == 3)
    sprintf(string, "%s %d%s, %d", short_month_to_long_month(month), day,
            get_english_ordinal(day), year);
  return string;
}


x86 assembly (clang, -O0):
<date_macro_to_nice_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rdx
lea    0xe9a(%rip),%rsi
lea    -0x14(%rbp),%rcx
lea    -0x18(%rbp),%r8
call   1040 <sscanf@plt>
cmp    $0x3,%eax
jne    11bd <date_macro_to_nice_date+0x7d>
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x30(%rbp),%rdi
call   1050 <short_month_to_long_month@plt>
mov    %rax,-0x40(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <get_english_ordinal@plt>
mov    -0x48(%rbp),%rdi
mov    -0x40(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    %eax,%r8d
mov    -0x18(%rbp),%r9d
lea    0xe51(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_macro_to_nice_date>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rax
mov    %rdi,%rbx
movb   $0x0,(%rdi)
lea    0xea8(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
mov    %rax,%rdi
call   1040 <sscanf@plt>
cmp    $0x3,%eax
jne    11a8 <date_macro_to_nice_date+0x68>
lea    0x10(%rsp),%rdi
call   1050 <short_month_to_long_month@plt>
mov    %rax,%r14
mov    0xc(%rsp),%ebp
mov    %ebp,%edi
call   1030 <get_english_ordinal@plt>
mov    0x8(%rsp),%r9d
lea    0xe71(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %ebp,%ecx
mov    %eax,%r8d
call   1060 <sprintf@plt>
mov    %rbx,%rax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%s %d %d\00"
@.str.1 = [12 x i8] c"%s %d%s, %d\00"
define i8* @date_macro_to_nice_date(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [16 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 0, i8* %9
%10 = load i8*, i8** %4
%11 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%12 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %11, i32* %5, i32* %6)
%13 = icmp eq i32 %12, 3
br i1 %13, label %14, label %23
14: ; preds = %2
%15 = load i8*, i8** %3
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%17 = call i8* @short_month_to_long_month(i8* %16)
%18 = load i32, i32* %5
%19 = load i32, i32* %5
%20 = call i32 @get_english_ordinal(i32 %19)
%21 = load i32, i32* %6
%22 = call i32 @sprintf(i8* %15, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %17, i32 %18, i32 %20, i32 %21)
br label %23
23: ; preds = %14, %2
%24 = load i8*, i8** %3
ret i8* %24
}

LLVM IR (-O2):
@.str = [9 x i8] c"%s %d %d\00"
@.str.1 = [12 x i8] c"%s %d%s, %d\00"
define i8* @date_macro_to_nice_date(i8* returned writeonly %0, i8* nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [16 x i8]
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
store i8 0, i8* %0
%9 = call i32 @sscanf(i8* %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8, i32* %3, i32* %4)
%10 = icmp eq i32 %9, 3
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = call i8* @short_month_to_long_month(i8* %8)
%13 = load i32, i32* %3
%14 = call i32 @get_english_ordinal(i32 %13)
%15 = load i32, i32* %4
%16 = call i32 @sprintf(i8* %0, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %12, i32 %13, i32 %14, i32 %15)
br label %17
17: ; preds = %11, %2
ret i8* %0
}