#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 *, char *);
FILE *measurement_backup_open_insert_pipe(char *application_name) {
  char sys_string[1024];
  char *table_name;
  table_name = get_table_name(application_name, "measurement_backup");
  sprintf(sys_string,
          "insert_statement.e %s %s | sql.e 2>&1 | grep -v Duplicate",
          table_name,
          "station,datatype,measurement_date,measurement_time,measurement_"
          "update_date,measurement_update_time,measurement_update_method,login_"
          "name,original_value");
  return popen(sys_string, "w");
}


x86 assembly (clang, -O0):
<measurement_backup_open_insert_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    0xea8(%rip),%rsi
lea    0xedb(%rip),%rcx
call   1050 <sprintf@plt>
lea    -0x410(%rbp),%rdi
lea    0xf5f(%rip),%rsi
call   1040 <popen@plt>
add    $0x420,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [19 x i8] c"measurement_backup\00"
@.str.1 = [58 x i8] c"insert_statement.e %s %s | sql.e 2>&1 | grep -v Duplicate\00"
@.str.2 = [151 x i8] c"station,datatype,measurement_date,measurement_time,measurement_update_date,measurement_update_time,measurement_update_method,login_name,original_value\00"
@.str.3 = [2 x i8] c"w\00"
define i32* @measurement_backup_open_insert_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 ([19 x i8], [19 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 ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i8* %8, i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.2, i64 0, i64 0))
%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.3, i64 0, i64 0))
ret i32* %11
}

LLVM IR (-O2):
@.str = [19 x i8] c"measurement_backup\00"
@.str.1 = [58 x i8] c"insert_statement.e %s %s | sql.e 2>&1 | grep -v Duplicate\00"
@.str.2 = [151 x i8] c"station,datatype,measurement_date,measurement_time,measurement_update_date,measurement_update_time,measurement_update_method,login_name,original_value\00"
@.str.3 = [2 x i8] c"w\00"
define noalias i32* @measurement_backup_open_insert_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 ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([151 x i8], [151 x i8]* @.str.2, i64 0, i64 0))
%6 = call i32* @popen(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32* %6
}