#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*/ *popen(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, char, char);
FILE *measurement_open_input_pipe(char *application_name, char *where_clause,
                                  char delimiter) {
  char sys_string[65536];
  sprintf(
      sys_string,
      "get_folder_data	application=%s		 "
      "			folder=measurement	 "
      "			select=%s		 "
      "			where=\"%s\"		 "
      "			order=select		|"
      "tr '%c' '%c'					 ",
      application_name,
      "station,datatype,measurement_date,measurement_time,measurement_value",
      where_clause, '^', delimiter);
  return popen(sys_string, "r");
}


x86 assembly (clang, -O0):
<measurement_open_input_pipe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10030,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
lea    -0x10020(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%r8
lea    0xeb2(%rip),%rsi
lea    0xf27(%rip),%rcx
mov    $0x5e,%r9d
movsbl -0x11(%rbp),%eax
mov    %eax,(%rsp)
call   1040 <sprintf@plt>
lea    -0x10020(%rbp),%rdi
lea    0xf4c(%rip),%rsi
call   1030 <popen@plt>
add    $0x10030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<measurement_open_input_pipe>:
push   %rbx
sub    $0x10010,%rsp
mov    %rsi,%r8
mov    %rdi,%rax
mov    %edx,(%rsp)
lea    0xec8(%rip),%rsi
lea    0xf3d(%rip),%rcx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %rax,%rdx
mov    $0x5e,%r9d
call   1040 <sprintf@plt>
lea    0xf65(%rip),%rsi
mov    %rbx,%rdi
call   1030 <popen@plt>
add    $0x10010,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [124 x i8] c"get_folder_data\09application=%s\09\09 \09\09\09folder=measurement\09 \09\09\09select=%s\09\09 \09\09\09where=\22%s\22\09\09 \09\09\09order=select\09\09|tr '%c' '%c'\09\09\09\09\09 \00"
@.str.1 = [69 x i8] c"station,datatype,measurement_date,measurement_time,measurement_value\00"
@.str.2 = [2 x i8] c"r\00"
define i32* @measurement_open_input_pipe(i8* %0, i8* %1, i8 signext %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8
%7 = alloca [65536 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8 %2, i8* %6
%8 = getelementptr inbounds [65536 x i8], [65536 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = load i8, i8* %6
%12 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([124 x i8], [124 x i8]* @.str, i64 0, i64 0), i8* %9, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8 signext 94, i8 signext %11)
%13 = getelementptr inbounds [65536 x i8], [65536 x i8]* %7, i64 0, i64 0
%14 = call i32* @popen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32* %14
}

LLVM IR (-O2):
@.str = [124 x i8] c"get_folder_data\09application=%s\09\09 \09\09\09folder=measurement\09 \09\09\09select=%s\09\09 \09\09\09where=\22%s\22\09\09 \09\09\09order=select\09\09|tr '%c' '%c'\09\09\09\09\09 \00"
@.str.1 = [69 x i8] c"station,datatype,measurement_date,measurement_time,measurement_value\00"
@.str.2 = [2 x i8] c"r\00"
define noalias i32* @measurement_open_input_pipe(i8* %0, i8* %1, i8 signext %2) {
%4 = alloca [65536 x i8]
%5 = getelementptr inbounds [65536 x i8], [65536 x i8]* %4, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([124 x i8], [124 x i8]* @.str, i64 0, i64 0), i8* %0, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0), i8* %1, i8 signext 94, i8 signext %2)
%7 = call i32* @popen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret i32* %7
}