#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 *date_macro_to_nice_date(char *, char const *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
size_t strlen(char *);
char *sprint_compile_date_fullarg(char *string, const char *location,
                                  const char *d, const char *t) {
  char nice_date[32];
  sprintf(string, "Compiled on %s at %s", date_macro_to_nice_date(nice_date, d),
          t);
  if (location)
    sprintf(&string[strlen(string)], " in %s", location);
  sprintf(&string[strlen(string)], "\n\nC standard %ld\n", 201710L);
  sprintf(&string[strlen(string)], "GCC %s\n", "9.4.0");
  return string;
}


x86 assembly (clang, -O0):
<sprint_compile_date_fullarg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <date_macro_to_nice_date@plt>
mov    -0x48(%rbp),%rdi
mov    %rax,%rdx
mov    -0x20(%rbp),%rcx
lea    0xe91(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
cmpq   $0x0,-0x10(%rbp)
je     11ab <sprint_compile_date_fullarg+0x7b>
mov    -0x8(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x50(%rbp),%rdi
add    %rax,%rdi
mov    -0x10(%rbp),%rdx
lea    0xe71(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x60(%rbp),%rdi
add    %rax,%rdi
lea    0xe52(%rip),%rsi
mov    $0x313ee,%edx
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x58(%rbp),%rdi
add    %rax,%rdi
lea    0xe39(%rip),%rsi
lea    0xe3a(%rip),%rdx
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sprint_compile_date_fullarg>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rcx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsp,%rdi
mov    %rdx,%rsi
call   1030 <date_macro_to_nice_date@plt>
lea    0xeac(%rip),%rsi
mov    %rbx,%rdi
mov    %rax,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1050 <sprintf@plt>
test   %r14,%r14
je     1186 <sprint_compile_date_fullarg+0x56>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    (%rax,%rbx,1),%rdi
lea    0xe99(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    (%rax,%rbx,1),%rdi
lea    0xe83(%rip),%rsi
mov    $0x313ee,%edx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    (%rax,%rbx,1),%rdi
lea    0xe76(%rip),%rsi
lea    0xe77(%rip),%rdx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Compiled on %s at %s\00"
@.str.1 = [7 x i8] c" in %s\00"
@.str.2 = [18 x i8] c"\0A\0AC standard %ld\0A\00"
@.str.3 = [8 x i8] c"GCC %s\0A\00"
@.str.4 = [6 x i8] c"9.4.0\00"
define i8* @sprint_compile_date_fullarg(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [32 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %5
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %9, i64 0, i64 0
%12 = load i8*, i8** %7
%13 = call i8* @date_macro_to_nice_date(i8* %11, i8* %12)
%14 = load i8*, i8** %8
%15 = call i32 (i8*, i8*, ...) @sprintf(i8* %10, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
%16 = load i8*, i8** %6
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %25
18: ; preds = %4
%19 = load i8*, i8** %5
%20 = load i8*, i8** %5
%21 = call i64 @strlen(i8* %20)
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8*, i8** %6
%24 = call i32 (i8*, i8*, ...) @sprintf(i8* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %18, %4
%26 = load i8*, i8** %5
%27 = load i8*, i8** %5
%28 = call i64 @strlen(i8* %27)
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = call i32 (i8*, i8*, ...) @sprintf(i8* %29, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 201710)
%31 = load i8*, i8** %5
%32 = load i8*, i8** %5
%33 = call i64 @strlen(i8* %32)
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = call i32 (i8*, i8*, ...) @sprintf(i8* %34, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%36 = load i8*, i8** %5
ret i8* %36
}

LLVM IR (-O2):
@.str = [21 x i8] c"Compiled on %s at %s\00"
@.str.1 = [7 x i8] c" in %s\00"
@.str.2 = [18 x i8] c"\0A\0AC standard %ld\0A\00"
@.str.3 = [8 x i8] c"GCC %s\0A\00"
@.str.4 = [6 x i8] c"9.4.0\00"
define i8* @sprint_compile_date_fullarg(i8* returned %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca [32 x i8]
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %5, i64 0, i64 0
%7 = call i8* @date_macro_to_nice_date(i8* %6, i8* %2)
%8 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %3)
%9 = icmp eq i8* %1, null
br i1 %9, label %14, label %10
10: ; preds = %4
%11 = call i64 @strlen(i8* dereferenceable(1) %0)
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %12, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %14
14: ; preds = %10, %4
%15 = call i64 @strlen(i8* dereferenceable(1) %0)
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %16, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i64 201710)
%18 = call i64 @strlen(i8* dereferenceable(1) %0)
%19 = getelementptr inbounds i8, i8* %0, i64 %18
%20 = call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %19, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i8* %0
}