#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_med_last_solve_io(FILE *fp) {
  char *aux, *streamtype, streamno[5];
  int i;
  for (i = 1; i < 12; i++) {
    fprintf(fp,
            " IF( WRFU_AlarmIsRinging( grid%%alarms( AUXHIST%d_ALARM ), rc=rc "
            ") ) THEN\n",
            i);
    fprintf(fp,
            "   CALL med_hist_out ( grid , AUXHIST%d_ALARM , config_flags )\n",
            i);
    fprintf(fp, " ENDIF\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<gen_med_last_solve_io>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x24(%rbp)
cmpl   $0xc,-0x24(%rbp)
jge    1177 <gen_med_last_solve_io+0x67>
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    0xefb(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xf29(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1123 <gen_med_last_solve_io+0x13>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_med_last_solve_io>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xece(%rip),%r14
mov    %r14,%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xf03(%rip),%r12
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    0xf2a(%rip),%r15
mov    $0x7,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x2,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x2,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x7,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x3,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x7,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x7,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x5,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x7,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x6,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x6,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x7,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x7,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x7,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x7,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x8,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x7,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x9,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0x9,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x7,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xa,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0xa,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x7,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xb,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    $0xb,%edx
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x7,%esi
mov    $0x1,%edx
mov    %r15,%rdi
mov    %rbx,%rcx
call   1040 <fwrite@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [75 x i8] c" IF( WRFU_AlarmIsRinging( grid%%alarms( AUXHIST%d_ALARM ), rc=rc ) ) THEN\0A\00"
@.str.1 = [64 x i8] c" CALL med_hist_out ( grid , AUXHIST%d_ALARM , config_flags )\0A\00"
@.str.2 = [8 x i8] c" ENDIF\0A\00"
define i32 @gen_med_last_solve_io(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 = %19, %1
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 12
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load i32*, i32** %2
%12 = load i32, i32* %6
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i32*, i32** %2
%15 = load i32, i32* %6
%16 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = load i32*, i32** %2
%18 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %10
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
store i32 %21, i32* %6
br label %7
22: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [75 x i8] c" IF( WRFU_AlarmIsRinging( grid%%alarms( AUXHIST%d_ALARM ), rc=rc ) ) THEN\0A\00"
@.str.1 = [64 x i8] c" CALL med_hist_out ( grid , AUXHIST%d_ALARM , config_flags )\0A\00"
@.str.2 = [8 x i8] c" ENDIF\0A\00"
define i32 @gen_med_last_solve_io(i32* nocapture %0) {
%2 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i32 1)
%3 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i32 1)
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 7, i64 1, i32* %0)
%5 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i32 2)
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i32 2)
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 7, i64 1, i32* %0)
%8 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i32 3)
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i32 3)
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 7, i64 1, i32* %0)
%11 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i32 4)
%12 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i32 4)
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 7, i64 1, i32* %0)
%14 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i32 5)
%15 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i32 5)
%16 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 7, i64 1, i32* %0)
%17 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i32 6)
%18 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i32 6)
%19 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 7, i64 1, i32* %0)
%20 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i32 7)
%21 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i32 7)
%22 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 7, i64 1, i32* %0)
%23 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i32 8)
%24 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i32 8)
%25 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 7, i64 1, i32* %0)
%26 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i32 9)
%27 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i32 9)
%28 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 7, i64 1, i32* %0)
%29 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i32 10)
%30 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i32 10)
%31 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 7, i64 1, i32* %0)
%32 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([75 x i8], [75 x i8]* @.str, i64 0, i64 0), i32 11)
%33 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0), i32 11)
%34 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i64 7, i64 1, i32* %0)
ret i32 0
}