#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 *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int);
int gen_io_form_for_dataset(FILE *fp) {
  char *aux, *streamtype, streamno[5];
  int i;
  fprintf(fp, "    IF      ( DataSet .eq. 'RESTART' ) THEN\n");
  fprintf(fp, "      CALL nl_get_io_form_restart( 1, io_form )\n");
  fprintf(fp, "    ELSE IF ( DataSet .eq. 'INPUT' ) THEN\n");
  fprintf(fp, "      CALL nl_get_io_form_input( 1, io_form )\n");
  fprintf(fp, "    ELSE IF ( DataSet .eq. 'HISTORY' ) THEN\n");
  fprintf(fp, "      CALL nl_get_io_form_history( 1, io_form )\n");
  fprintf(fp, "    ELSE IF ( DataSet .eq. 'BOUNDARY' ) THEN\n");
  fprintf(fp, "      CALL nl_get_io_form_boundary( 1, io_form )\n");
  for (i = 1; i < 12; i++) {
    sprintf(streamno, "%d", i);
    fprintf(fp, "    ELSE IF ( DataSet .eq. 'AUXINPUT%s' ) THEN\n", streamno);
    fprintf(fp, "      CALL nl_get_io_form_auxinput%s( 1, io_form )\n",
            streamno);
    fprintf(fp, "    ELSE IF ( DataSet .eq. 'AUXHIST%s' ) THEN\n", streamno);
    fprintf(fp, "      CALL nl_get_io_form_auxhist%s( 1, io_form )\n",
            streamno);
  }
  fprintf(fp,
          "    ELSE  ! default if nothing is set in SysDepInfo; use history\n");
  fprintf(fp, "      CALL nl_get_io_form_history( 1, io_form )\n");
  fprintf(fp, "    ENDIF\n");
  return 0;
}


x86 assembly (clang, -O0):
<gen_io_form_for_dataset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xee4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf03(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf1c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf39(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf54(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf73(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf8f(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x24(%rbp)
cmpl   $0xc,-0x24(%rbp)
jge    1246 <gen_io_form_for_dataset+0x126>
lea    -0x1d(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xf9b(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1d(%rbp),%rdx
lea    0xf8a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1d(%rbp),%rdx
lea    0xfa4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1d(%rbp),%rdx
lea    0xfc2(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1d(%rbp),%rdx
lea    0xfdb(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11c3 <gen_io_form_for_dataset+0xa3>
mov    -0x8(%rbp),%rdi
lea    0xfee(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe82(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x100c(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_io_form_for_dataset>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
lea    0xebb(%rip),%rdi
mov    $0x2c,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xecf(%rip),%rdi
mov    $0x30,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xee7(%rip),%rdi
mov    $0x2a,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xef9(%rip),%rdi
mov    $0x2e,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xf0f(%rip),%rdi
mov    $0x2c,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xf23(%rip),%rdi
mov    $0x30,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xf3b(%rip),%rdi
mov    $0x2d,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xf50(%rip),%rdi
mov    $0x31,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
mov    $0x1,%ebp
lea    0x3(%rsp),%rbx
lea    0xf92(%rip),%r13
lea    0xfbf(%rip),%r14
lea    0xfe7(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
lea    0xf3c(%rip),%rsi
mov    %ebp,%edx
call   1040 <sprintf@plt>
mov    %r15,%rdi
lea    0xf2e(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%ebp
cmp    $0xc,%ebp
jne    1230 <gen_io_form_for_dataset+0x100>
lea    0xfab(%rip),%rdi
mov    $0x41,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xe38(%rip),%rdi
mov    $0x30,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xfbb(%rip),%rdi
mov    $0xa,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [45 x i8] c" IF ( DataSet .eq. 'RESTART' ) THEN\0A\00"
@.str.1 = [49 x i8] c" CALL nl_get_io_form_restart( 1, io_form )\0A\00"
@.str.2 = [43 x i8] c" ELSE IF ( DataSet .eq. 'INPUT' ) THEN\0A\00"
@.str.3 = [47 x i8] c" CALL nl_get_io_form_input( 1, io_form )\0A\00"
@.str.4 = [45 x i8] c" ELSE IF ( DataSet .eq. 'HISTORY' ) THEN\0A\00"
@.str.5 = [49 x i8] c" CALL nl_get_io_form_history( 1, io_form )\0A\00"
@.str.6 = [46 x i8] c" ELSE IF ( DataSet .eq. 'BOUNDARY' ) THEN\0A\00"
@.str.7 = [50 x i8] c" CALL nl_get_io_form_boundary( 1, io_form )\0A\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [48 x i8] c" ELSE IF ( DataSet .eq. 'AUXINPUT%s' ) THEN\0A\00"
@.str.10 = [52 x i8] c" CALL nl_get_io_form_auxinput%s( 1, io_form )\0A\00"
@.str.11 = [47 x i8] c" ELSE IF ( DataSet .eq. 'AUXHIST%s' ) THEN\0A\00"
@.str.12 = [51 x i8] c" CALL nl_get_io_form_auxhist%s( 1, io_form )\0A\00"
@.str.13 = [66 x i8] c" ELSE ! default if nothing is set in SysDepInfo; use history\0A\00"
@.str.14 = [11 x i8] c" ENDIF\0A\00"
define i32 @gen_io_form_for_dataset(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [5 x i8]
%6 = alloca i32
store i32* %0, i32** %2
%7 = load i32*, i32** %2
%8 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%9 = load i32*, i32** %2
%10 = call i32 (i32*, i8*, ...) @fprintf(i32* %9, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32*, i32** %2
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32*, i32** %2
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0))
%15 = load i32*, i32** %2
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %15, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0))
%17 = load i32*, i32** %2
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0))
%19 = load i32*, i32** %2
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0))
%21 = load i32*, i32** %2
%22 = call i32 (i32*, i8*, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %6
br label %23
23: ; preds = %42, %1
%24 = load i32, i32* %6
%25 = icmp slt i32 %24, 12
br i1 %25, label %26, label %45
26: ; preds = %23
%27 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%28 = load i32, i32* %6
%29 = call i32 @sprintf(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 %28)
%30 = load i32*, i32** %2
%31 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%32 = call i32 (i32*, i8*, ...) @fprintf(i32* %30, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.9, i64 0, i64 0), i8* %31)
%33 = load i32*, i32** %2
%34 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %33, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.10, i64 0, i64 0), i8* %34)
%36 = load i32*, i32** %2
%37 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %36, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.11, i64 0, i64 0), i8* %37)
%39 = load i32*, i32** %2
%40 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
%41 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.12, i64 0, i64 0), i8* %40)
br label %42
42: ; preds = %26
%43 = load i32, i32* %6
%44 = add nsw i32 %43, 1
store i32 %44, i32* %6
br label %23
45: ; preds = %23
%46 = load i32*, i32** %2
%47 = call i32 (i32*, i8*, ...) @fprintf(i32* %46, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.13, i64 0, i64 0))
%48 = load i32*, i32** %2
%49 = call i32 (i32*, i8*, ...) @fprintf(i32* %48, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0))
%50 = load i32*, i32** %2
%51 = call i32 (i32*, i8*, ...) @fprintf(i32* %50, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c" IF ( DataSet .eq. 'RESTART' ) THEN\0A\00"
@.str.1 = [49 x i8] c" CALL nl_get_io_form_restart( 1, io_form )\0A\00"
@.str.2 = [43 x i8] c" ELSE IF ( DataSet .eq. 'INPUT' ) THEN\0A\00"
@.str.3 = [47 x i8] c" CALL nl_get_io_form_input( 1, io_form )\0A\00"
@.str.4 = [45 x i8] c" ELSE IF ( DataSet .eq. 'HISTORY' ) THEN\0A\00"
@.str.5 = [49 x i8] c" CALL nl_get_io_form_history( 1, io_form )\0A\00"
@.str.6 = [46 x i8] c" ELSE IF ( DataSet .eq. 'BOUNDARY' ) THEN\0A\00"
@.str.7 = [50 x i8] c" CALL nl_get_io_form_boundary( 1, io_form )\0A\00"
@.str.8 = [3 x i8] c"%d\00"
@.str.9 = [48 x i8] c" ELSE IF ( DataSet .eq. 'AUXINPUT%s' ) THEN\0A\00"
@.str.10 = [52 x i8] c" CALL nl_get_io_form_auxinput%s( 1, io_form )\0A\00"
@.str.11 = [47 x i8] c" ELSE IF ( DataSet .eq. 'AUXHIST%s' ) THEN\0A\00"
@.str.12 = [51 x i8] c" CALL nl_get_io_form_auxhist%s( 1, io_form )\0A\00"
@.str.13 = [66 x i8] c" ELSE ! default if nothing is set in SysDepInfo; use history\0A\00"
@.str.14 = [11 x i8] c" ENDIF\0A\00"
define i32 @gen_io_form_for_dataset(i32* nocapture %0) {
%2 = alloca [5 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i64 44, i64 1, i32* %0)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0), i64 48, i64 1, i32* %0)
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i64 42, i64 1, i32* %0)
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i64 46, i64 1, i32* %0)
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0), i64 44, i64 1, i32* %0)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0), i64 48, i64 1, i32* %0)
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.6, i64 0, i64 0), i64 45, i64 1, i32* %0)
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0), i64 49, i64 1, i32* %0)
br label %12
12: ; preds = %1, %12
%13 = phi i32 [ 1, %1 ], [ %19, %12 ]
%14 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32 %13)
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.9, i64 0, i64 0), i8* %3)
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.10, i64 0, i64 0), i8* %3)
%17 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.11, i64 0, i64 0), i8* %3)
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.12, i64 0, i64 0), i8* %3)
%19 = add nuw nsw i32 %13, 1
%20 = icmp eq i32 %19, 12
br i1 %20, label %21, label %12
21: ; preds = %12
%22 = call i64 @fwrite(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.13, i64 0, i64 0), i64 65, i64 1, i32* %0)
%23 = call i64 @fwrite(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.5, i64 0, i64 0), i64 48, i64 1, i32* %0)
%24 = call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i64 10, i64 1, i32* %0)
ret i32 0
}