#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *);
char *get_table_name(char *, char *);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
void insert_station_datatype(char *application_name, char *station,
                             char *oxygen_solubility_datatype) {
  char sys_string[1024];
  char *table_name;
  char *field_list_string;
  FILE *output_pipe;
  table_name = get_table_name(application_name, "station_datatype");
  field_list_string = "station,datatype";
  sprintf(
      sys_string,
      "insert_statement.e table=%s field=%s | sql.e 2>&1 | grep -vi duplicate",
      table_name, field_list_string);
  output_pipe = popen(sys_string, "w");
  fprintf(output_pipe, "%s|%s\n", station, oxygen_solubility_datatype);
  pclose(output_pipe);
}


x86 assembly (clang, -O0):
<insert_station_datatype>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe8e(%rip),%rsi
call   1050 <get_table_name@plt>
mov    %rax,-0x428(%rbp)
lea    0xe8c(%rip),%rax
mov    %rax,-0x430(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x428(%rbp),%rdx
mov    -0x430(%rbp),%rcx
lea    0xe7a(%rip),%rsi
call   1070 <sprintf@plt>
lea    -0x420(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1060 <popen@plt>
mov    %rax,-0x438(%rbp)
mov    -0x438(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe8e(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x438(%rbp),%rdi
call   1030 <pclose@plt>
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_station_datatype>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
lea    0xe97(%rip),%rsi
call   1050 <get_table_name@plt>
lea    0xead(%rip),%rsi
lea    0xe95(%rip),%rcx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rax,%rdx
call   1070 <sprintf@plt>
lea    0xed8(%rip),%rsi
mov    %rbx,%rdi
call   1060 <popen@plt>
mov    %rax,%rbx
lea    0xec8(%rip),%rsi
mov    %rax,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <pclose@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"station_datatype\00"
@.str.1 = [17 x i8] c"station,datatype\00"
@.str.2 = [71 x i8] c"insert_statement.e table=%s field=%s | sql.e 2>&1 | grep -vi duplicate\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [7 x i8] c"%s|%s\0A\00"
define void @insert_station_datatype(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [1024 x i8]
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%11 = load i8*, i8** %4
%12 = call i8* @get_table_name(i8* %11, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i8* %12, i8** %8
store i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i8** %9
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%14 = load i8*, i8** %8
%15 = load i8*, i8** %9
%16 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0), i8* %14, i8* %15)
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%18 = call i32* @popen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %18, i32** %10
%19 = load i32*, i32** %10
%20 = load i8*, i8** %5
%21 = load i8*, i8** %6
%22 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %20, i8* %21)
%23 = load i32*, i32** %10
%24 = call i32 @pclose(i32* %23)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"station_datatype\00"
@.str.1 = [17 x i8] c"station,datatype\00"
@.str.2 = [71 x i8] c"insert_statement.e table=%s field=%s | sql.e 2>&1 | grep -vi duplicate\00"
@.str.3 = [2 x i8] c"w\00"
@.str.4 = [7 x i8] c"%s|%s\0A\00"
define void @insert_station_datatype(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 ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32* @popen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%9 = tail call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %1, i8* %2)
%10 = tail call i32 @pclose(i32* %8)
ret void
}