#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 *);
char *strdup(char *);
int strlen(char *);
void get_table_title_string(char **table_title, char *station, char *datatype,
                            char *begin_measurement_date,
                            char *end_measurement_date) {
  char title[1024];
  char buffer1[512];
  char buffer2[512];
  sprintf(title, "Validate %s/%s<br>", format_initial_capital(buffer1, station),
          format_initial_capital(buffer2, datatype));
  sprintf(title + strlen(title), "Beginning: %s Ending: %s",
          begin_measurement_date, end_measurement_date);
  *table_title = strdup(title);
}


x86 assembly (clang, -O0):
<get_table_title_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x850,%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,-0x848(%rbp)
lea    -0x630(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <format_initial_capital@plt>
mov    %rax,-0x840(%rbp)
lea    -0x830(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <format_initial_capital@plt>
mov    -0x848(%rbp),%rdi
mov    -0x840(%rbp),%rdx
mov    %rax,%rcx
lea    0xe54(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x430(%rbp),%rax
mov    %rax,-0x838(%rbp)
lea    -0x430(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x838(%rbp),%rdi
cltq
add    %rax,%rdi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
lea    0xe2d(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x430(%rbp),%rdi
call   1060 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x850,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_table_title_string>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x800,%rsp
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%rbx
mov    %rdi,%r14
lea    0x200(%rsp),%rdi
call   1040 <format_initial_capital@plt>
mov    %rax,%r13
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1040 <format_initial_capital@plt>
lea    0xe82(%rip),%rsi
lea    0x400(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13,%rdx
mov    %rax,%rcx
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rdi
add    $0x400,%rdi
lea    0xe63(%rip),%rsi
mov    %r12,%rdx
mov    %r15,%rcx
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1060 <strdup@plt>
mov    %rax,(%r14)
add    $0x800,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Validate %s/%s<br>\00"
@.str.1 = [25 x i8] c"Beginning: %s Ending: %s\00"
define void @get_table_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 [512 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]* %12, i64 0, i64 0
%16 = load i8*, i8** %7
%17 = call i8* @format_initial_capital(i8* %15, i8* %16)
%18 = getelementptr inbounds [512 x i8], [512 x i8]* %13, i64 0, i64 0
%19 = load i8*, i8** %8
%20 = call i8* @format_initial_capital(i8* %18, i8* %19)
%21 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %17, i8* %20)
%22 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%24 = call i32 @strlen(i8* %23)
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %22, i64 %25
%27 = load i8*, i8** %9
%28 = load i8*, i8** %10
%29 = call i32 @sprintf(i8* %26, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %27, i8* %28)
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%31 = call i8* @strdup(i8* %30)
%32 = load i8**, i8*** %6
store i8* %31, i8** %32
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"Validate %s/%s<br>\00"
@.str.1 = [25 x i8] c"Beginning: %s Ending: %s\00"
define void @get_table_title_string(i8** nocapture writeonly %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca [1024 x i8]
%7 = alloca [512 x i8]
%8 = alloca [512 x i8]
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%10 = getelementptr inbounds [512 x i8], [512 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* %10, i8* %1)
%13 = call i8* @format_initial_capital(i8* %11, i8* %2)
%14 = call i32 @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13)
%15 = call i32 @strlen(i8* %9)
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 %16
%18 = call i32 @sprintf(i8* %17, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %3, i8* %4)
%19 = call i8* @strdup(i8* %9)
store i8* %19, i8** %0
ret void
}