#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 *get_table_name(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, char *,
                           char *, char *, char *, char *, char *, char *,
                           char *, char *, char *, char *);
char *strdup(char *);
char *get_infrastructure_process(char *application_name, char *station,
                                 char *datatype) {
  char *datatype_table;
  char *station_datatype_table;
  char infrastructure_process[1024];
  datatype_table = get_table_name(application_name, "datatype");
  station_datatype_table = get_table_name(application_name, "station_datatype");
  sprintf(infrastructure_process,
          "echo \"select 	%s.units,				 "
          "		%s.datatype,				 "
          "		%s.station,				 "
          "		%s.bar_graph_yn,			 "
          "		%s.scale_graph_to_zero_yn		 "
          "	from %s,%s					 "
          "	where %s.station = '%s'				 "
          "	  and %s.datatype = %s.datatype			 "
          "	  and %s.datatype = '%s'			 "
          "	order by units,%s.datatype;\"			|"
          "sql '|'						 ",
          datatype_table, station_datatype_table, station_datatype_table,
          datatype_table, datatype_table, station_datatype_table,
          datatype_table, station_datatype_table, station,
          station_datatype_table, datatype_table, datatype_table, datatype,
          station_datatype_table);
  return strdup(infrastructure_process);
}


x86 assembly (clang, -O0):
<get_infrastructure_process>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x488,%rsp
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xead(%rip),%rsi
call   1030 <get_table_name@plt>
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%rdi
lea    0xe91(%rip),%rsi
call   1030 <get_table_name@plt>
mov    %rax,-0x50(%rbp)
lea    -0x450(%rbp),%rdi
mov    -0x48(%rbp),%rdx
mov    -0x50(%rbp),%rcx
mov    -0x50(%rbp),%r8
mov    -0x48(%rbp),%r9
mov    -0x48(%rbp),%rax
mov    -0x50(%rbp),%rsi
mov    %rsi,-0x460(%rbp)
mov    -0x48(%rbp),%r13
mov    -0x50(%rbp),%r12
mov    -0x38(%rbp),%r15
mov    -0x50(%rbp),%r14
mov    -0x48(%rbp),%rbx
mov    -0x48(%rbp),%r11
mov    -0x40(%rbp),%r10
mov    -0x50(%rbp),%rsi
mov    %rsi,-0x458(%rbp)
lea    0xe45(%rip),%rsi
mov    %rax,(%rsp)
mov    -0x460(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0x458(%rbp),%rax
mov    %r13,0x10(%rsp)
mov    %r12,0x18(%rsp)
mov    %r15,0x20(%rsp)
mov    %r14,0x28(%rsp)
mov    %rbx,0x30(%rsp)
mov    %r11,0x38(%rsp)
mov    %r10,0x40(%rsp)
mov    %rax,0x48(%rsp)
call   1040 <sprintf@plt>
lea    -0x450(%rbp),%rdi
call   1050 <strdup@plt>
add    $0x488,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_infrastructure_process>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x408,%rsp
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%r12
lea    0xeba(%rip),%rsi
call   1030 <get_table_name@plt>
mov    %rax,%rbx
lea    0xea3(%rip),%rsi
mov    %r12,%rdi
call   1030 <get_table_name@plt>
lea    0xea5(%rip),%rsi
mov    %rsp,%r12
mov    %r12,%rdi
mov    %rbx,%rdx
mov    %rax,%rcx
mov    %rax,%r8
mov    %rbx,%r9
push   %rax
push   %r15
push   %rbx
push   %rbx
push   %rax
push   %r14
push   %rax
push   %rbx
push   %rax
push   %rbx
call   1040 <sprintf@plt>
add    $0x50,%rsp
mov    %r12,%rdi
call   1050 <strdup@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"datatype\00"
@.str.1 = [17 x i8] c"station_datatype\00"
@.str.2 = [276 x i8] c"echo \22select \09%s.units,\09\09\09\09 \09\09%s.datatype,\09\09\09\09 \09\09%s.station,\09\09\09\09 \09\09%s.bar_graph_yn,\09\09\09 \09\09%s.scale_graph_to_zero_yn\09\09 \09from %s,%s\09\09\09\09\09 \09where %s.station = '%s'\09\09\09\09 \09 and %s.datatype = %s.datatype\09\09\09 \09 and %s.datatype = '%s'\09\09\09 \09order by units,%s.datatype;\22\09\09\09|sql '|'\09\09\09\09\09\09 \00"
define i8* @get_infrastructure_process(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [1024 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%10 = load i8*, i8** %4
%11 = call i8* @get_table_name(i8* %10, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
store i8* %11, i8** %7
%12 = load i8*, i8** %4
%13 = call i8* @get_table_name(i8* %12, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
store i8* %13, i8** %8
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%15 = load i8*, i8** %7
%16 = load i8*, i8** %8
%17 = load i8*, i8** %8
%18 = load i8*, i8** %7
%19 = load i8*, i8** %7
%20 = load i8*, i8** %8
%21 = load i8*, i8** %7
%22 = load i8*, i8** %8
%23 = load i8*, i8** %5
%24 = load i8*, i8** %8
%25 = load i8*, i8** %7
%26 = load i8*, i8** %7
%27 = load i8*, i8** %6
%28 = load i8*, i8** %8
%29 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([276 x i8], [276 x i8]* @.str.2, i64 0, i64 0), i8* %15, i8* %16, i8* %17, i8* %18, i8* %19, i8* %20, i8* %21, i8* %22, i8* %23, i8* %24, i8* %25, i8* %26, i8* %27, i8* %28)
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%31 = call i8* @strdup(i8* %30)
ret i8* %31
}

LLVM IR (-O2):
@.str = [9 x i8] c"datatype\00"
@.str.1 = [17 x i8] c"station_datatype\00"
@.str.2 = [276 x i8] c"echo \22select \09%s.units,\09\09\09\09 \09\09%s.datatype,\09\09\09\09 \09\09%s.station,\09\09\09\09 \09\09%s.bar_graph_yn,\09\09\09 \09\09%s.scale_graph_to_zero_yn\09\09 \09from %s,%s\09\09\09\09\09 \09where %s.station = '%s'\09\09\09\09 \09 and %s.datatype = %s.datatype\09\09\09 \09 and %s.datatype = '%s'\09\09\09 \09order by units,%s.datatype;\22\09\09\09|sql '|'\09\09\09\09\09\09 \00"
define noalias i8* @get_infrastructure_process(i8* %0, i8* %1, i8* %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = tail call i8* @get_table_name(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = tail call i8* @get_table_name(i8* %0, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([276 x i8], [276 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* %7, i8* %7, i8* %6, i8* %6, i8* %7, i8* %6, i8* %7, i8* %1, i8* %7, i8* %6, i8* %6, i8* %2, i8* %7)
%9 = call i8* @strdup(i8* %5)
ret i8* %9
}