#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, ...);
int gen_med_hist_out_opens(FILE *fp) {
  char *aux, *streamtype, streamno[5];
  int i;
  for (i = 1; i < 12; i++) {
    fprintf(fp, " CASE ( AUXHIST%d_ALARM )\n", i);
    fprintf(fp,
            "   CALL open_hist_w( grid, config_flags, stream, AUXHIST%d_ALARM, "
            "      &\n",
            i);
    fprintf(fp,
            "                     config_flags%%auxhist%d_outname, "
            "grid%%auxhist%d_oid, &\n",
            i, i);
    fprintf(fp, "                     output_auxhist%d, fname, n2, ierr )\n",
            i);
    fprintf(fp,
            "   CALL output_auxhist%d ( grid%%auxhist%d_oid, grid , "
            "config_flags , ierr )\n",
            i, i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<gen_med_hist_out_opens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x24(%rbp)
cmpl   $0xc,-0x24(%rbp)
jge    11aa <gen_med_hist_out_opens+0x9a>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xec5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xecb(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    0xefe(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xf37(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    0xf59(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1123 <gen_med_hist_out_opens+0x13>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_med_hist_out_opens>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x1,%ebp
lea    0xef1(%rip),%r15
lea    0xf35(%rip),%r12
lea    0xf7c(%rip),%r13
lea    0xfaf(%rip),%r14
nop
mov    %rbx,%rdi
lea    0xeb6(%rip),%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%ebp
cmp    $0xc,%ebp
jne    1140 <gen_med_hist_out_opens+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c" CASE ( AUXHIST%d_ALARM )\0A\00"
@.str.1 = [75 x i8] c" CALL open_hist_w( grid, config_flags, stream, AUXHIST%d_ALARM, &\0A\00"
@.str.2 = [78 x i8] c" config_flags%%auxhist%d_outname, grid%%auxhist%d_oid, &\0A\00"
@.str.3 = [58 x i8] c" output_auxhist%d, fname, n2, ierr )\0A\00"
@.str.4 = [78 x i8] c" CALL output_auxhist%d ( grid%%auxhist%d_oid, grid , config_flags , ierr )\0A\00"
define i32 @gen_med_hist_out_opens(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [5 x i8]
%6 = alloca i32
store i32* %0, i32** %2
store i32 1, i32* %6
br label %7
7: ; preds = %28, %1
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 12
br i1 %9, label %10, label %31
10: ; preds = %7
%11 = load i32*, i32** %2
%12 = load i32, i32* %6
%13 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32*, i32** %2
%15 = load i32, i32* %6
%16 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load i32*, i32** %2
%18 = load i32, i32* %6
%19 = load i32, i32* %6
%20 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32 %19)
%21 = load i32*, i32** %2
%22 = load i32, i32* %6
%23 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %21, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = load i32*, i32** %2
%25 = load i32, i32* %6
%26 = load i32, i32* %6
%27 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.4, i64 0, i64 0), i32 %25, i32 %26)
br label %28
28: ; preds = %10
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %7
31: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c" CASE ( AUXHIST%d_ALARM )\0A\00"
@.str.1 = [75 x i8] c" CALL open_hist_w( grid, config_flags, stream, AUXHIST%d_ALARM, &\0A\00"
@.str.2 = [78 x i8] c" config_flags%%auxhist%d_outname, grid%%auxhist%d_oid, &\0A\00"
@.str.3 = [58 x i8] c" output_auxhist%d, fname, n2, ierr )\0A\00"
@.str.4 = [78 x i8] c" CALL output_auxhist%d ( grid%%auxhist%d_oid, grid , config_flags , ierr )\0A\00"
define i32 @gen_med_hist_out_opens(i32* nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 1, %1 ], [ %9, %2 ]
%4 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%6 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0), i32 %3, i32 %3)
%7 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.3, i64 0, i64 0), i32 %3)
%8 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.4, i64 0, i64 0), i32 %3, i32 %3)
%9 = add nuw nsw i32 %3, 1
%10 = icmp eq i32 %9, 12
br i1 %10, label %11, label %2
11: ; preds = %2
ret i32 0
}