#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 */
char *get_table_name(char *, char *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
FILE *measurement_open_delete_pipe(char *application_name) {
  char sys_string[1024];
  char *table_name;
  table_name = get_table_name(application_name, "measurement");
  sprintf(sys_string,
          "delete_statement.e %s "
          "station,datatype,measurement_date,measurement_time | sql.e",
          table_name);
  return popen(sys_string, "w");
}


x86 assembly (clang, -O0):
<measurement_open_delete_pipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1030 <get_table_name@plt>
mov    %rax,-0x418(%rbp)
lea    -0x410(%rbp),%rdi
mov    -0x418(%rbp),%rdx
lea    0xea1(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x410(%rbp),%rdi
lea    0xedf(%rip),%rsi
call   1040 <popen@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<measurement_open_delete_pipe>:
push   %rbx
sub    $0x400,%rsp
lea    0xec1(%rip),%rsi
call   1030 <get_table_name@plt>
lea    0xec1(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %rax,%rdx
call   1050 <sprintf@plt>
lea    0xefd(%rip),%rsi
mov    %rbx,%rdi
call   1040 <popen@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"measurement\00"
@.str.1 = [81 x i8] c"delete_statement.e %s station,datatype,measurement_date,measurement_time | sql.e\00"
@.str.2 = [2 x i8] c"w\00"
define i32* @measurement_open_delete_pipe(i8* %0) {
%2 = alloca i8*
%3 = alloca [1024 x i8]
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i8* @get_table_name(i8* %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
store i8* %6, i8** %4
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = load i8*, i8** %4
%9 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%11 = call i32* @popen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32* %11
}

LLVM IR (-O2):
@.str = [12 x i8] c"measurement\00"
@.str.1 = [81 x i8] c"delete_statement.e %s station,datatype,measurement_date,measurement_time | sql.e\00"
@.str.2 = [2 x i8] c"w\00"
define noalias i32* @measurement_open_delete_pipe(i8* %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = tail call i8* @get_table_name(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([81 x i8], [81 x i8]* @.str.1, i64 0, i64 0), i8* %4)
%6 = call i32* @popen(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32* %6
}