#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int ilog2(int);
int /*<<< orphan*/ printf(char *, char);
void write_mg_info(FILE *fp, char class) {
  int problem_size, nit, log2_size, lt_default, lm;
  int ndim1, ndim2, ndim3;
  if (class == 'S') {
    problem_size = 32;
    nit = 4;
  } else if (class == 'W') {
    problem_size = 128;
    nit = 4;
  } else if (class == 'A') {
    problem_size = 256;
    nit = 4;
  } else if (class == 'B') {
    problem_size = 256;
    nit = 20;
  } else if (class == 'C') {
    problem_size = 512;
    nit = 20;
  } else if (class == 'D') {
    problem_size = 1024;
    nit = 50;
  } else if (class == 'E') {
    problem_size = 2048;
    nit = 50;
  } else {
    printf("setparams: Internal error: invalid class type %c\n", class);
    exit(1);
  }
  log2_size = ilog2(problem_size);
  lt_default = log2_size;
  lm = log2_size;
  ndim1 = lm;
  ndim3 = log2_size;
  ndim2 = log2_size;
  fprintf(fp, "#define NX_DEFAULT     %d\n", problem_size);
  fprintf(fp, "#define NY_DEFAULT     %d\n", problem_size);
  fprintf(fp, "#define NZ_DEFAULT     %d\n", problem_size);
  fprintf(fp, "#define NIT_DEFAULT    %d\n", nit);
  fprintf(fp, "#define LM             %d\n", lm);
  fprintf(fp, "#define LT_DEFAULT     %d\n", lt_default);
  fprintf(fp, "#define DEBUG_DEFAULT  %d\n", 0);
  fprintf(fp, "#define NDIM1          %d\n", ndim1);
  fprintf(fp, "#define NDIM2          %d\n", ndim2);
  fprintf(fp, "#define NDIM3          %d\n", ndim3);
  fprintf(fp, "#define ONE            %d\n", 1);
}


x86 assembly (clang, -O0):
<write_mg_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
cmp    $0x53,%eax
jne    1172 <write_mg_info+0x32>
movl   $0x20,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
jmp    126a <write_mg_info+0x12a>
movsbl -0x9(%rbp),%eax
cmp    $0x57,%eax
jne    1192 <write_mg_info+0x52>
movl   $0x80,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
jmp    1265 <write_mg_info+0x125>
movsbl -0x9(%rbp),%eax
cmp    $0x41,%eax
jne    11b2 <write_mg_info+0x72>
movl   $0x100,-0x10(%rbp)
movl   $0x4,-0x14(%rbp)
jmp    1260 <write_mg_info+0x120>
movsbl -0x9(%rbp),%eax
cmp    $0x42,%eax
jne    11d2 <write_mg_info+0x92>
movl   $0x100,-0x10(%rbp)
movl   $0x14,-0x14(%rbp)
jmp    125b <write_mg_info+0x11b>
movsbl -0x9(%rbp),%eax
cmp    $0x43,%eax
jne    11f2 <write_mg_info+0xb2>
movl   $0x200,-0x10(%rbp)
movl   $0x14,-0x14(%rbp)
jmp    1256 <write_mg_info+0x116>
movsbl -0x9(%rbp),%eax
cmp    $0x44,%eax
jne    1212 <write_mg_info+0xd2>
movl   $0x400,-0x10(%rbp)
movl   $0x32,-0x14(%rbp)
jmp    1251 <write_mg_info+0x111>
movsbl -0x9(%rbp),%eax
cmp    $0x45,%eax
jne    1232 <write_mg_info+0xf2>
movl   $0x800,-0x10(%rbp)
movl   $0x32,-0x14(%rbp)
jmp    124c <write_mg_info+0x10c>
lea    0xdc7(%rip),%rdi
movsbl -0x9(%rbp),%esi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    1251 <write_mg_info+0x111>
jmp    1256 <write_mg_info+0x116>
jmp    125b <write_mg_info+0x11b>
jmp    1260 <write_mg_info+0x120>
jmp    1265 <write_mg_info+0x125>
jmp    126a <write_mg_info+0x12a>
mov    -0x10(%rbp),%edi
call   1030 <ilog2@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xd91(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xd99(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xda1(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xda9(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%edx
lea    0xdb1(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xdb9(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xdc4(%rip),%rsi
xor    %edx,%edx
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%edx
lea    0xdca(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%edx
lea    0xdd2(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x2c(%rbp),%edx
lea    0xdda(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xde5(%rip),%rsi
mov    $0x1,%edx
call   1050 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_mg_info>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    -0x41(%rsi),%eax
cmp    $0x16,%al
ja     128b <write_mg_info+0x14b>
mov    %rdi,%rbx
mov    $0x20,%ebp
mov    $0x4,%r14d
movzbl %al,%eax
lea    0xe96(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x100,%ebp
jmp    11b3 <write_mg_info+0x73>
mov    $0x100,%ebp
mov    $0x14,%r14d
jmp    11b3 <write_mg_info+0x73>
mov    $0x200,%ebp
mov    $0x14,%r14d
jmp    11b3 <write_mg_info+0x73>
mov    $0x400,%ebp
mov    $0x32,%r14d
jmp    11b3 <write_mg_info+0x73>
mov    $0x800,%ebp
mov    $0x32,%r14d
jmp    11b3 <write_mg_info+0x73>
mov    $0x80,%ebp
mov    %ebp,%edi
call   1030 <ilog2@plt>
mov    %eax,%r15d
lea    0xeca(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
call   1050 <fprintf@plt>
lea    0xed4(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
call   1050 <fprintf@plt>
lea    0xede(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
call   1050 <fprintf@plt>
lea    0xee8(%rip),%rsi
mov    %rbx,%rdi
mov    %r14d,%edx
call   1050 <fprintf@plt>
lea    0xef1(%rip),%rsi
mov    %rbx,%rdi
mov    %r15d,%edx
call   1050 <fprintf@plt>
lea    0xefa(%rip),%rsi
mov    %rbx,%rdi
mov    %r15d,%edx
call   1050 <fprintf@plt>
lea    0xf03(%rip),%rsi
mov    %rbx,%rdi
xor    %edx,%edx
call   1050 <fprintf@plt>
lea    0xf0d(%rip),%rsi
mov    %rbx,%rdi
mov    %r15d,%edx
call   1050 <fprintf@plt>
lea    0xf16(%rip),%rsi
mov    %rbx,%rdi
mov    %r15d,%edx
call   1050 <fprintf@plt>
lea    0xf1f(%rip),%rsi
mov    %rbx,%rdi
mov    %r15d,%edx
call   1050 <fprintf@plt>
lea    0xf28(%rip),%rsi
mov    %rbx,%rdi
mov    $0x1,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <fprintf@plt>
movsbl %sil,%esi
lea    0xdc6(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"setparams: Internal error: invalid class type %c\0A\00"
@.str.1 = [27 x i8] c"#define NX_DEFAULT %d\0A\00"
@.str.2 = [27 x i8] c"#define NY_DEFAULT %d\0A\00"
@.str.3 = [27 x i8] c"#define NZ_DEFAULT %d\0A\00"
@.str.4 = [27 x i8] c"#define NIT_DEFAULT %d\0A\00"
@.str.5 = [27 x i8] c"#define LM %d\0A\00"
@.str.6 = [27 x i8] c"#define LT_DEFAULT %d\0A\00"
@.str.7 = [27 x i8] c"#define DEBUG_DEFAULT %d\0A\00"
@.str.8 = [27 x i8] c"#define NDIM1 %d\0A\00"
@.str.9 = [27 x i8] c"#define NDIM2 %d\0A\00"
@.str.10 = [27 x i8] c"#define NDIM3 %d\0A\00"
@.str.11 = [27 x i8] c"#define ONE %d\0A\00"
define void @write_mg_info(i32* %0, i8 signext %1) {
%3 = alloca i32*
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32* %0, i32** %3
store i8 %1, i8* %4
%13 = load i8, i8* %4
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 83
br i1 %15, label %16, label %17
16: ; preds = %2
store i32 32, i32* %5
store i32 4, i32* %6
br label %57
17: ; preds = %2
%18 = load i8, i8* %4
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 87
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 128, i32* %5
store i32 4, i32* %6
br label %56
22: ; preds = %17
%23 = load i8, i8* %4
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 65
br i1 %25, label %26, label %27
26: ; preds = %22
store i32 256, i32* %5
store i32 4, i32* %6
br label %55
27: ; preds = %22
%28 = load i8, i8* %4
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 66
br i1 %30, label %31, label %32
31: ; preds = %27
store i32 256, i32* %5
store i32 20, i32* %6
br label %54
32: ; preds = %27
%33 = load i8, i8* %4
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 67
br i1 %35, label %36, label %37
36: ; preds = %32
store i32 512, i32* %5
store i32 20, i32* %6
br label %53
37: ; preds = %32
%38 = load i8, i8* %4
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 68
br i1 %40, label %41, label %42
41: ; preds = %37
store i32 1024, i32* %5
store i32 50, i32* %6
br label %52
42: ; preds = %37
%43 = load i8, i8* %4
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 69
br i1 %45, label %46, label %47
46: ; preds = %42
store i32 2048, i32* %5
store i32 50, i32* %6
br label %51
47: ; preds = %42
%48 = load i8, i8* %4
%49 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %48)
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %46
br label %52
52: ; preds = %51, %41
br label %53
53: ; preds = %52, %36
br label %54
54: ; preds = %53, %31
br label %55
55: ; preds = %54, %26
br label %56
56: ; preds = %55, %21
br label %57
57: ; preds = %56, %16
%58 = load i32, i32* %5
%59 = call i32 @ilog2(i32 %58)
store i32 %59, i32* %7
%60 = load i32, i32* %7
store i32 %60, i32* %8
%61 = load i32, i32* %7
store i32 %61, i32* %9
%62 = load i32, i32* %9
store i32 %62, i32* %10
%63 = load i32, i32* %7
store i32 %63, i32* %12
%64 = load i32, i32* %7
store i32 %64, i32* %11
%65 = load i32*, i32** %3
%66 = load i32, i32* %5
%67 = call i32 @fprintf(i32* %65, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %66)
%68 = load i32*, i32** %3
%69 = load i32, i32* %5
%70 = call i32 @fprintf(i32* %68, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %69)
%71 = load i32*, i32** %3
%72 = load i32, i32* %5
%73 = call i32 @fprintf(i32* %71, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %72)
%74 = load i32*, i32** %3
%75 = load i32, i32* %6
%76 = call i32 @fprintf(i32* %74, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %75)
%77 = load i32*, i32** %3
%78 = load i32, i32* %9
%79 = call i32 @fprintf(i32* %77, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %78)
%80 = load i32*, i32** %3
%81 = load i32, i32* %8
%82 = call i32 @fprintf(i32* %80, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %81)
%83 = load i32*, i32** %3
%84 = call i32 @fprintf(i32* %83, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i32 0)
%85 = load i32*, i32** %3
%86 = load i32, i32* %10
%87 = call i32 @fprintf(i32* %85, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 %86)
%88 = load i32*, i32** %3
%89 = load i32, i32* %11
%90 = call i32 @fprintf(i32* %88, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i32 %89)
%91 = load i32*, i32** %3
%92 = load i32, i32* %12
%93 = call i32 @fprintf(i32* %91, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i32 %92)
%94 = load i32*, i32** %3
%95 = call i32 @fprintf(i32* %94, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i32 1)
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"setparams: Internal error: invalid class type %c\0A\00"
@.str.1 = [27 x i8] c"#define NX_DEFAULT %d\0A\00"
@.str.2 = [27 x i8] c"#define NY_DEFAULT %d\0A\00"
@.str.3 = [27 x i8] c"#define NZ_DEFAULT %d\0A\00"
@.str.4 = [27 x i8] c"#define NIT_DEFAULT %d\0A\00"
@.str.5 = [27 x i8] c"#define LM %d\0A\00"
@.str.6 = [27 x i8] c"#define LT_DEFAULT %d\0A\00"
@.str.7 = [27 x i8] c"#define DEBUG_DEFAULT %d\0A\00"
@.str.8 = [27 x i8] c"#define NDIM1 %d\0A\00"
@.str.9 = [27 x i8] c"#define NDIM2 %d\0A\00"
@.str.10 = [27 x i8] c"#define NDIM3 %d\0A\00"
@.str.11 = [27 x i8] c"#define ONE %d\0A\00"
define void @write_mg_info(i32* nocapture %0, i8 signext %1) {
switch i8 %1, label %9 [
i8 83, label %12
i8 87, label %3
i8 65, label %4
i8 66, label %5
i8 67, label %6
i8 68, label %7
i8 69, label %8
]
3: ; preds = %2
br label %12
4: ; preds = %2
br label %12
5: ; preds = %2
br label %12
6: ; preds = %2
br label %12
7: ; preds = %2
br label %12
8: ; preds = %2
br label %12
9: ; preds = %2
%10 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %1)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %2, %3, %5, %7, %8, %6, %4
%13 = phi i32 [ 4, %3 ], [ 4, %4 ], [ 20, %5 ], [ 20, %6 ], [ 50, %7 ], [ 50, %8 ], [ 4, %2 ]
%14 = phi i32 [ 128, %3 ], [ 256, %4 ], [ 256, %5 ], [ 512, %6 ], [ 1024, %7 ], [ 2048, %8 ], [ 32, %2 ]
%15 = tail call i32 @ilog2(i32 %14)
%16 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%17 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%18 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%19 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %13)
%20 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i32 %15)
%21 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %15)
%22 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i32 0)
%23 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), i32 %15)
%24 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i32 %15)
%25 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0), i32 %15)
%26 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i32 1)
ret void
}