#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 *hydrology_library_get_expected_count_list_string(char *, char *, char *,
                                                       char);
scalar_t__ piece(char *, char, char *, int);
void hydrology_library_output_data_collection_frequency_text_file(
    FILE *output_file, char *application_name, char *station_name,
    char *datatype_name) {
  char *data_collection_frequency_list_string;
  char delimiter = '|';
  char piece_buffer[128];
  int p;
  data_collection_frequency_list_string =
      hydrology_library_get_expected_count_list_string(
          application_name, station_name, datatype_name, delimiter);
  for (p = 0;
       piece(piece_buffer, delimiter, data_collection_frequency_list_string, p);
       p++) {
    fprintf(output_file, "#%s\n", piece_buffer);
  }
  fprintf(output_file, "\n");
}


x86 assembly (clang, -O0):
<hydrology_library_output_data_collection_frequency_text_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movb   $0x7c,-0x29(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
movsbl -0x29(%rbp),%ecx
call   1030 <hydrology_library_get_expected_count_list_string@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0xb4(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0x29(%rbp),%al
mov    -0x28(%rbp),%rdx
mov    -0xb4(%rbp),%ecx
movsbl %al,%esi
call   1050 <piece@plt>
cmp    $0x0,%rax
je     11c5 <hydrology_library_output_data_collection_frequency_text_file+0x95>
mov    -0x8(%rbp),%rdi
lea    -0xb0(%rbp),%rdx
lea    0xe56(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1172 <hydrology_library_output_data_collection_frequency_text_file+0x42>
mov    -0x8(%rbp),%rdi
lea    0xe33(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hydrology_library_output_data_collection_frequency_text_file>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x80,%rsp
mov    %rdi,%r14
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rcx,%rdx
mov    $0x7c,%ecx
call   1030 <hydrology_library_get_expected_count_list_string@plt>
mov    %rax,%r12
mov    %rsp,%rdi
mov    $0x7c,%esi
mov    %rax,%rdx
xor    %ecx,%ecx
call   1060 <piece@plt>
test   %rax,%rax
je     11ba <hydrology_library_output_data_collection_frequency_text_file+0x7a>
mov    $0x1,%ebp
lea    0xe75(%rip),%r15
mov    %rsp,%rbx
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %rbx,%rdi
mov    $0x7c,%esi
mov    %r12,%rdx
mov    %ebp,%ecx
call   1060 <piece@plt>
add    $0x1,%ebp
test   %rax,%rax
jne    1190 <hydrology_library_output_data_collection_frequency_text_file+0x50>
mov    $0xa,%edi
mov    %r14,%rsi
call   1040 <fputc@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"#%s\0A\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @hydrology_library_output_data_collection_frequency_text_file(i32* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8
%11 = alloca [128 x i8]
%12 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
store i8 124, i8* %10
%13 = load i8*, i8** %6
%14 = load i8*, i8** %7
%15 = load i8*, i8** %8
%16 = load i8, i8* %10
%17 = call i8* @hydrology_library_get_expected_count_list_string(i8* %13, i8* %14, i8* %15, i8 signext %16)
store i8* %17, i8** %9
store i32 0, i32* %12
br label %18
18: ; preds = %29, %4
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%20 = load i8, i8* %10
%21 = load i8*, i8** %9
%22 = load i32, i32* %12
%23 = call i64 @piece(i8* %19, i8 signext %20, i8* %21, i32 %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %32
25: ; preds = %18
%26 = load i32*, i32** %5
%27 = getelementptr inbounds [128 x i8], [128 x i8]* %11, i64 0, i64 0
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %25
%30 = load i32, i32* %12
%31 = add nsw i32 %30, 1
store i32 %31, i32* %12
br label %18
32: ; preds = %18
%33 = load i32*, i32** %5
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"#%s\0A\00"
define void @hydrology_library_output_data_collection_frequency_text_file(i32* nocapture %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca [128 x i8]
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%7 = tail call i8* @hydrology_library_get_expected_count_list_string(i8* %1, i8* %2, i8* %3, i8 signext 124)
%8 = call i64 @piece(i8* %6, i8 signext 124, i8* %7, i32 0)
%9 = icmp eq i64 %8, 0
br i1 %9, label %16, label %10
10: ; preds = %4, %10
%11 = phi i32 [ %13, %10 ], [ 0, %4 ]
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6)
%13 = add nuw nsw i32 %11, 1
%14 = call i64 @piece(i8* %6, i8 signext 124, i8* %7, i32 %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %10
16: ; preds = %10, %4
%17 = call i32 @fputc(i32 10, i32* %0)
ret void
}