#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 gen_switches_and_alarms(FILE *fp) {
  char *aux, *streamtype, streamno[5];
  int i;
  fprintf(fp, "INTEGER, PARAMETER :: history_only      = 1\n");
  fprintf(fp, "INTEGER, PARAMETER :: HISTORY_ALARM     = history_only\n");
  fprintf(fp, "INTEGER, PARAMETER :: input_only        = %d\n", 12 + 1);
  fprintf(fp, "INTEGER, PARAMETER :: INPUT_ALARM       = input_only         ! "
              "not used\n");
  for (i = 1; i < 12; i++) {
    fprintf(fp, "INTEGER, PARAMETER :: auxhist%d_only     = %d\n", i, i + 1);
    fprintf(fp, "INTEGER, PARAMETER :: AUXHIST%d_ALARM    = %d\n", i, i + 1);
    fprintf(fp, "INTEGER, PARAMETER :: auxinput%d_only     = %d\n", i,
            12 + i + 1);
    fprintf(fp, "INTEGER, PARAMETER :: AUXINPUT%d_ALARM    = %d\n", i,
            12 + i + 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<gen_switches_and_alarms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xef4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf1a(%rip),%rsi
mov    $0xd,%edx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf31(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x1,-0x24(%rbp)
cmpl   $0xc,-0x24(%rbp)
jge    11fa <gen_switches_and_alarms+0xea>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
lea    0xf4e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x24(%rbp),%ecx
add    $0x1,%ecx
lea    0xf62(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x24(%rbp),%ecx
add    $0xc,%ecx
add    $0x1,%ecx
lea    0xf73(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
mov    -0x24(%rbp),%ecx
add    $0xc,%ecx
add    $0x1,%ecx
lea    0xf85(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1170 <gen_switches_and_alarms+0x60>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_switches_and_alarms>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xecb(%rip),%rdi
mov    $0x2c,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xedf(%rip),%rdi
mov    $0x37,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
lea    0xefe(%rip),%rsi
mov    %rbx,%rdi
mov    $0xd,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xf16(%rip),%rdi
mov    $0x48,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    $0x1,%ebp
lea    0xf9f(%rip),%r12
lea    0xfc8(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%rbp),%r14d
mov    %rbx,%rdi
lea    0xf1e(%rip),%rsi
mov    %ebp,%edx
mov    %r14d,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
lea    0xf37(%rip),%rsi
mov    %ebp,%edx
mov    %r14d,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xd(%rbp),%r15d
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %ebp,%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %ebp,%edx
mov    %r15d,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %r14d,%ebp
cmp    $0xc,%r14d
jne    11b0 <gen_switches_and_alarms+0x90>
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"INTEGER, PARAMETER :: history_only = 1\0A\00"
@.str.1 = [56 x i8] c"INTEGER, PARAMETER :: HISTORY_ALARM = history_only\0A\00"
@.str.2 = [46 x i8] c"INTEGER, PARAMETER :: input_only = %d\0A\00"
@.str.3 = [73 x i8] c"INTEGER, PARAMETER :: INPUT_ALARM = input_only ! not used\0A\00"
@.str.4 = [47 x i8] c"INTEGER, PARAMETER :: auxhist%d_only = %d\0A\00"
@.str.5 = [47 x i8] c"INTEGER, PARAMETER :: AUXHIST%d_ALARM = %d\0A\00"
@.str.6 = [48 x i8] c"INTEGER, PARAMETER :: auxinput%d_only = %d\0A\00"
@.str.7 = [48 x i8] c"INTEGER, PARAMETER :: AUXINPUT%d_ALARM = %d\0A\00"
define i32 @gen_switches_and_alarms(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 ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32*, i32** %2
%12 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32 13)
%13 = load i32*, i32** %2
%14 = call i32 (i32*, i8*, ...) @fprintf(i32* %13, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %6
br label %15
15: ; preds = %41, %1
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 12
br i1 %17, label %18, label %44
18: ; preds = %15
%19 = load i32*, i32** %2
%20 = load i32, i32* %6
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
%23 = call i32 (i32*, i8*, ...) @fprintf(i32* %19, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i32 %20, i32 %22)
%24 = load i32*, i32** %2
%25 = load i32, i32* %6
%26 = load i32, i32* %6
%27 = add nsw i32 %26, 1
%28 = call i32 (i32*, i8*, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i32 %25, i32 %27)
%29 = load i32*, i32** %2
%30 = load i32, i32* %6
%31 = load i32, i32* %6
%32 = add nsw i32 12, %31
%33 = add nsw i32 %32, 1
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %29, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0), i32 %30, i32 %33)
%35 = load i32*, i32** %2
%36 = load i32, i32* %6
%37 = load i32, i32* %6
%38 = add nsw i32 12, %37
%39 = add nsw i32 %38, 1
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i32 %36, i32 %39)
br label %41
41: ; preds = %18
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
store i32 %43, i32* %6
br label %15
44: ; preds = %15
ret i32 0
}

LLVM IR (-O2):
@.str = [45 x i8] c"INTEGER, PARAMETER :: history_only = 1\0A\00"
@.str.1 = [56 x i8] c"INTEGER, PARAMETER :: HISTORY_ALARM = history_only\0A\00"
@.str.2 = [46 x i8] c"INTEGER, PARAMETER :: input_only = %d\0A\00"
@.str.3 = [73 x i8] c"INTEGER, PARAMETER :: INPUT_ALARM = input_only ! not used\0A\00"
@.str.4 = [47 x i8] c"INTEGER, PARAMETER :: auxhist%d_only = %d\0A\00"
@.str.5 = [47 x i8] c"INTEGER, PARAMETER :: AUXHIST%d_ALARM = %d\0A\00"
@.str.6 = [48 x i8] c"INTEGER, PARAMETER :: auxinput%d_only = %d\0A\00"
@.str.7 = [48 x i8] c"INTEGER, PARAMETER :: AUXINPUT%d_ALARM = %d\0A\00"
define i32 @gen_switches_and_alarms(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i64 44, i64 1, i32* %0)
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i64 55, i64 1, i32* %0)
%4 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i32 13)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.3, i64 0, i64 0), i64 72, i64 1, i32* %0)
br label %6
6: ; preds = %1, %6
%7 = phi i32 [ 1, %1 ], [ %8, %6 ]
%8 = add nuw nsw i32 %7, 1
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.4, i64 0, i64 0), i32 %7, i32 %8)
%10 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.5, i64 0, i64 0), i32 %7, i32 %8)
%11 = add nuw nsw i32 %7, 13
%12 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.6, i64 0, i64 0), i32 %7, i32 %11)
%13 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.7, i64 0, i64 0), i32 %7, i32 %11)
%14 = icmp eq i32 %8, 12
br i1 %14, label %15, label %6
15: ; preds = %6
ret i32 0
}