#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_stream(FILE *fp) {
  char *aux, *streamtype, streamno[5];
  int i;
  fprintf(fp, "    IF      ( stream .eq. restart_only ) THEN\n");
  fprintf(fp, "      CALL nl_get_io_form_restart( 1, io_form )\n");
  fprintf(fp, "    ELSE IF ( stream .eq. input_only ) THEN\n");
  fprintf(fp, "      CALL nl_get_io_form_input( 1, io_form )\n");
  fprintf(fp, "    ELSE IF ( stream .eq. history_only ) THEN\n");
  fprintf(fp, "      CALL nl_get_io_form_history( 1, io_form )\n");
  fprintf(fp, "    ELSE IF ( stream .eq. boundary_only ) 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 ( stream .eq. auxinput%s_only ) THEN\n", streamno);
    fprintf(fp, "      CALL nl_get_io_form_auxinput%s( 1, io_form )\n",
            streamno);
    fprintf(fp, "    ELSE IF ( stream .eq. auxhist%s_only ) THEN\n", streamno);
    fprintf(fp, "      CALL nl_get_io_form_auxhist%s( 1, io_form )\n",
            streamno);
  }
  fprintf(fp, "    ELSE  ! if no match then do the old service representative "
              "schtick\n");
  fprintf(
      fp,
      "      CALL wrf_error_fatal('internal error: please contact "
      "wrfhelp@ucar.edu: io_form_for_stream.inc -- invalid stream number')\n");
  fprintf(fp, "    ENDIF\n");
  return 0;
}


x86 assembly (clang, -O0):
<gen_io_form_for_stream>:
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    0xee6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf05(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf20(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf3d(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf5a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf79(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf97(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x24(%rbp)
cmpl   $0xc,-0x24(%rbp)
jge    1246 <gen_io_form_for_stream+0x126>
lea    -0x1d(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xfa3(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1d(%rbp),%rdx
lea    0xf92(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1d(%rbp),%rdx
lea    0xfae(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1d(%rbp),%rdx
lea    0xfcc(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1d(%rbp),%rdx
lea    0xfe7(%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_stream+0xa3>
mov    -0x8(%rbp),%rdi
lea    0xffa(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x1030(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0x109e(%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_stream>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r15
lea    0xebb(%rip),%rdi
mov    $0x2e,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xed1(%rip),%rdi
mov    $0x30,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xee9(%rip),%rdi
mov    $0x2c,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xefd(%rip),%rdi
mov    $0x2e,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xf13(%rip),%rdi
mov    $0x2e,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xf29(%rip),%rdi
mov    $0x30,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xf41(%rip),%rdi
mov    $0x2f,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xf58(%rip),%rdi
mov    $0x31,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
mov    $0x1,%ebp
lea    0x3(%rsp),%rbx
lea    0xf9c(%rip),%r13
lea    0xfc9(%rip),%r14
lea    0xff3(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
lea    0xf44(%rip),%rsi
mov    %ebp,%edx
call   1040 <sprintf@plt>
mov    %r15,%rdi
lea    0xf36(%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_stream+0x100>
lea    0xfb7(%rip),%rdi
mov    $0x47,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0xfe6(%rip),%rdi
mov    $0x7f,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1050 <fwrite@plt>
lea    0x104d(%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 = [47 x i8] c" IF ( stream .eq. restart_only ) THEN\0A\00"
@.str.1 = [49 x i8] c" CALL nl_get_io_form_restart( 1, io_form )\0A\00"
@.str.2 = [45 x i8] c" ELSE IF ( stream .eq. input_only ) THEN\0A\00"
@.str.3 = [47 x i8] c" CALL nl_get_io_form_input( 1, io_form )\0A\00"
@.str.4 = [47 x i8] c" ELSE IF ( stream .eq. history_only ) THEN\0A\00"
@.str.5 = [49 x i8] c" CALL nl_get_io_form_history( 1, io_form )\0A\00"
@.str.6 = [48 x i8] c" ELSE IF ( stream .eq. boundary_only ) 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 = [50 x i8] c" ELSE IF ( stream .eq. auxinput%s_only ) THEN\0A\00"
@.str.10 = [52 x i8] c" CALL nl_get_io_form_auxinput%s( 1, io_form )\0A\00"
@.str.11 = [49 x i8] c" ELSE IF ( stream .eq. auxhist%s_only ) THEN\0A\00"
@.str.12 = [51 x i8] c" CALL nl_get_io_form_auxhist%s( 1, io_form )\0A\00"
@.str.13 = [72 x i8] c" ELSE ! if no match then do the old service representative schtick\0A\00"
@.str.14 = [128 x i8] c" CALL wrf_error_fatal('internal error: please contact wrfhelp@ucar.edu: io_form_for_stream.inc -- invalid stream number')\0A\00"
@.str.15 = [11 x i8] c" ENDIF\0A\00"
define i32 @gen_io_form_for_stream(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 ([47 x i8], [47 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 ([45 x i8], [45 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 ([47 x i8], [47 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 ([48 x i8], [48 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 ([50 x i8], [50 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 ([49 x i8], [49 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 ([72 x i8], [72 x i8]* @.str.13, i64 0, i64 0))
%48 = load i32*, i32** %2
%49 = call i32 (i32*, i8*, ...) @fprintf(i32* %48, i8* getelementptr inbounds ([128 x i8], [128 x i8]* @.str.14, 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.15, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c" IF ( stream .eq. restart_only ) THEN\0A\00"
@.str.1 = [49 x i8] c" CALL nl_get_io_form_restart( 1, io_form )\0A\00"
@.str.2 = [45 x i8] c" ELSE IF ( stream .eq. input_only ) THEN\0A\00"
@.str.3 = [47 x i8] c" CALL nl_get_io_form_input( 1, io_form )\0A\00"
@.str.4 = [47 x i8] c" ELSE IF ( stream .eq. history_only ) THEN\0A\00"
@.str.5 = [49 x i8] c" CALL nl_get_io_form_history( 1, io_form )\0A\00"
@.str.6 = [48 x i8] c" ELSE IF ( stream .eq. boundary_only ) 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 = [50 x i8] c" ELSE IF ( stream .eq. auxinput%s_only ) THEN\0A\00"
@.str.10 = [52 x i8] c" CALL nl_get_io_form_auxinput%s( 1, io_form )\0A\00"
@.str.11 = [49 x i8] c" ELSE IF ( stream .eq. auxhist%s_only ) THEN\0A\00"
@.str.12 = [51 x i8] c" CALL nl_get_io_form_auxhist%s( 1, io_form )\0A\00"
@.str.13 = [72 x i8] c" ELSE ! if no match then do the old service representative schtick\0A\00"
@.str.14 = [128 x i8] c" CALL wrf_error_fatal('internal error: please contact wrfhelp@ucar.edu: io_form_for_stream.inc -- invalid stream number')\0A\00"
@.str.15 = [11 x i8] c" ENDIF\0A\00"
define i32 @gen_io_form_for_stream(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 ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i64 46, 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 ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i64 44, 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 ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i64 46, 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 ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0), i64 47, 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 ([50 x i8], [50 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 ([49 x i8], [49 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 ([72 x i8], [72 x i8]* @.str.13, i64 0, i64 0), i64 71, i64 1, i32* %0)
%23 = call i64 @fwrite(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @.str.14, i64 0, i64 0), i64 127, i64 1, i32* %0)
%24 = call i64 @fwrite(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0), i64 10, i64 1, i32* %0)
ret i32 0
}