#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 *format_initial_capital(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
char *strdup(char *);
void get_chart_title_string(char **chart_title, char **chart_sub_title,
                            char *station, char *begin_measurement_date,
                            char *end_measurement_date) {
  char title[1024];
  char sub_title[1024];
  char buffer[512];
  sprintf(title, "Validate %s", format_initial_capital(buffer, station));
  sprintf(sub_title, "Beginning: %s Ending: %s", begin_measurement_date,
          end_measurement_date);
  *chart_title = strdup(title);
  *chart_sub_title = strdup(sub_title);
}


x86 assembly (clang, -O0):
<get_chart_title_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
lea    -0x430(%rbp),%rax
mov    %rax,-0xa38(%rbp)
lea    -0xa30(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <format_initial_capital@plt>
mov    -0xa38(%rbp),%rdi
mov    %rax,%rdx
lea    0xe82(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x830(%rbp),%rdi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xe71(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x430(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
lea    -0x830(%rbp),%rdi
call   1050 <strdup@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0xa40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_chart_title_string>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa08,%rsp
mov    %r8,%r12
mov    %rcx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rsp,%rdi
mov    %rdx,%rsi
call   1030 <format_initial_capital@plt>
lea    0xea1(%rip),%rsi
lea    0x600(%rsp),%r13
mov    %r13,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
lea    0xe91(%rip),%rsi
lea    0x200(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %r13,%rdi
call   1050 <strdup@plt>
mov    %rax,(%r15)
mov    %rbp,%rdi
call   1050 <strdup@plt>
mov    %rax,(%r14)
add    $0xa08,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Validate %s\00"
@.str.1 = [25 x i8] c"Beginning: %s Ending: %s\00"
define void @get_chart_title_string(i8** %0, i8** %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [1024 x i8]
%12 = alloca [1024 x i8]
%13 = alloca [512 x i8]
store i8** %0, i8*** %6
store i8** %1, i8*** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%15 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%16 = load i8*, i8** %8
%17 = call i8* @format_initial_capital(i8* %15, i8* %16)
%18 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %14, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%20 = load i8*, i8** %9
%21 = load i8*, i8** %10
%22 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %19, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %20, i8* %21)
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%24 = call i8* @strdup(i8* %23)
%25 = load i8**, i8*** %6
store i8* %24, i8** %25
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%27 = call i8* @strdup(i8* %26)
%28 = load i8**, i8*** %7
store i8* %27, i8** %28
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Validate %s\00"
@.str.1 = [25 x i8] c"Beginning: %s Ending: %s\00"
define void @get_chart_title_string(i8** nocapture writeonly %0, i8** nocapture writeonly %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
%8 = alloca [512 x i8]
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%11 = getelementptr inbounds [512 x i8], [512 x i8]* %8, i64 0, i64 0
%12 = call i8* @format_initial_capital(i8* %11, i8* %2)
%13 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* %4)
%15 = call i8* @strdup(i8* %9)
store i8* %15, i8** %0
%16 = call i8* @strdup(i8* %10)
store i8* %16, i8** %1
ret void
}