#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 */
scalar_t__ get_line(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
char *strdup(char *);
void parse_begin_end_dates(char **begin_date_string, char **end_date_string,
                           char *filename, char *station) {
  char sys_string[1024];
  FILE *input_pipe;
  char input_buffer[128];
  sprintf(sys_string, "cr10_parse \"%s\" \"%s\" y", filename, station);
  input_pipe = popen(sys_string, "r");
  if (get_line(input_buffer, input_pipe)) {
    *begin_date_string = strdup(input_buffer);
  }
  if (get_line(input_buffer, input_pipe)) {
    *end_date_string = strdup(input_buffer);
  }
  pclose(input_pipe);
}


x86 assembly (clang, -O0):
<parse_begin_end_dates>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4b0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x420(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe7f(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0x420(%rbp),%rdi
lea    0xe83(%rip),%rsi
call   1050 <popen@plt>
mov    %rax,-0x428(%rbp)
lea    -0x4b0(%rbp),%rdi
mov    -0x428(%rbp),%rsi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     11d3 <parse_begin_end_dates+0x83>
lea    -0x4b0(%rbp),%rdi
call   1070 <strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
lea    -0x4b0(%rbp),%rdi
mov    -0x428(%rbp),%rsi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     1206 <parse_begin_end_dates+0xb6>
lea    -0x4b0(%rbp),%rdi
call   1070 <strdup@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x428(%rbp),%rdi
call   1040 <pclose@plt>
add    $0x4b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_begin_end_dates>:
push   %r15
push   %r14
push   %rbx
sub    $0x480,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xe97(%rip),%rsi
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <sprintf@plt>
lea    0xe97(%rip),%rsi
mov    %rbx,%rdi
call   1050 <popen@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    %rax,%rsi
call   1030 <get_line@plt>
test   %rax,%rax
je     11a6 <parse_begin_end_dates+0x56>
mov    %rsp,%rdi
call   1070 <strdup@plt>
mov    %rax,(%r15)
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1030 <get_line@plt>
test   %rax,%rax
je     11c1 <parse_begin_end_dates+0x71>
mov    %rsp,%rdi
call   1070 <strdup@plt>
mov    %rax,(%r14)
mov    %rbx,%rdi
call   1040 <pclose@plt>
add    $0x480,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"cr10_parse \22%s\22 \22%s\22 y\00"
@.str.1 = [2 x i8] c"r\00"
define void @parse_begin_end_dates(i8** %0, i8** %1, i8* %2, i8* %3) {
%5 = alloca i8**
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [1024 x i8]
%10 = alloca i32*
%11 = alloca [128 x i8]
store i8** %0, i8*** %5
store i8** %1, i8*** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%13 = load i8*, i8** %7
%14 = load i8*, i8** %8
%15 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %13, i8* %14)
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%17 = call i32* @popen(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %17, i32** %10
%18 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%19 = load i32*, i32** %10
%20 = call i64 @get_line(i8* %18, i32* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %26
22: ; preds = %4
%23 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%24 = call i8* @strdup(i8* %23)
%25 = load i8**, i8*** %5
store i8* %24, i8** %25
br label %26
26: ; preds = %22, %4
%27 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%28 = load i32*, i32** %10
%29 = call i64 @get_line(i8* %27, i32* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %26
%32 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%33 = call i8* @strdup(i8* %32)
%34 = load i8**, i8*** %6
store i8* %33, i8** %34
br label %35
35: ; preds = %31, %26
%36 = load i32*, i32** %10
%37 = call i32 @pclose(i32* %36)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"cr10_parse \22%s\22 \22%s\22 y\00"
@.str.1 = [2 x i8] c"r\00"
define void @parse_begin_end_dates(i8** nocapture writeonly %0, i8** nocapture writeonly %1, i8* %2, i8* %3) {
%5 = alloca [1024 x i8]
%6 = alloca [128 x i8]
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%9 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %3)
%10 = call i32* @popen(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = call i64 @get_line(i8* %8, i32* %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %4
%14 = call i8* @strdup(i8* %8)
store i8* %14, i8** %0
br label %15
15: ; preds = %13, %4
%16 = call i64 @get_line(i8* %8, i32* %10)
%17 = icmp eq i64 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = call i8* @strdup(i8* %8)
store i8* %19, i8** %1
br label %20
20: ; preds = %18, %15
%21 = call i32 @pclose(i32* %10)
ret void
}