#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 /*<<< orphan*/ printf(char *, char);
void write_ft_info(FILE *fp, char class) {
  int nx, ny, nz, maxdim, niter, np_min;
  if (class == 'S') {
    nx = 64;
    ny = 64;
    nz = 64;
    niter = 6;
  } else if (class == 'W') {
    nx = 128;
    ny = 128;
    nz = 32;
    niter = 6;
  } else if (class == 'A') {
    nx = 256;
    ny = 256;
    nz = 128;
    niter = 6;
  } else if (class == 'B') {
    nx = 512;
    ny = 256;
    nz = 256;
    niter = 20;
  } else if (class == 'C') {
    nx = 512;
    ny = 512;
    nz = 512;
    niter = 20;
  } else {
    printf("setparams: Internal error: invalid class type %c\n", class);
    exit(1);
  }
  maxdim = nx;
  if (ny > maxdim)
    maxdim = ny;
  if (nz > maxdim)
    maxdim = nz;
  fprintf(fp, "#define\tNX\t%d\n", nx);
  fprintf(fp, "#define\tNY\t%d\n", ny);
  fprintf(fp, "#define\tNZ\t%d\n", nz);
  fprintf(fp, "#define\tMAXDIM\t%d\n", maxdim);
  fprintf(fp, "#define\tNITER_DEFAULT\t%d\n", niter);
  fprintf(fp, "#define\tNTOTAL\t%d\n", nx * ny * nz);
}


x86 assembly (clang, -O0):
<write_ft_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    1170 <write_ft_info+0x40>
movl   $0x40,-0x10(%rbp)
movl   $0x40,-0x14(%rbp)
movl   $0x40,-0x18(%rbp)
movl   $0x6,-0x20(%rbp)
jmp    1256 <write_ft_info+0x126>
movsbl -0x9(%rbp),%eax
cmp    $0x57,%eax
jne    119e <write_ft_info+0x6e>
movl   $0x80,-0x10(%rbp)
movl   $0x80,-0x14(%rbp)
movl   $0x20,-0x18(%rbp)
movl   $0x6,-0x20(%rbp)
jmp    1251 <write_ft_info+0x121>
movsbl -0x9(%rbp),%eax
cmp    $0x41,%eax
jne    11cc <write_ft_info+0x9c>
movl   $0x100,-0x10(%rbp)
movl   $0x100,-0x14(%rbp)
movl   $0x80,-0x18(%rbp)
movl   $0x6,-0x20(%rbp)
jmp    124c <write_ft_info+0x11c>
movsbl -0x9(%rbp),%eax
cmp    $0x42,%eax
jne    11fa <write_ft_info+0xca>
movl   $0x200,-0x10(%rbp)
movl   $0x100,-0x14(%rbp)
movl   $0x100,-0x18(%rbp)
movl   $0x14,-0x20(%rbp)
jmp    1247 <write_ft_info+0x117>
movsbl -0x9(%rbp),%eax
cmp    $0x43,%eax
jne    1228 <write_ft_info+0xf8>
movl   $0x200,-0x10(%rbp)
movl   $0x200,-0x14(%rbp)
movl   $0x200,-0x18(%rbp)
movl   $0x14,-0x20(%rbp)
jmp    1242 <write_ft_info+0x112>
lea    0xdd1(%rip),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    1247 <write_ft_info+0x117>
jmp    124c <write_ft_info+0x11c>
jmp    1251 <write_ft_info+0x121>
jmp    1256 <write_ft_info+0x126>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    126e <write_ft_info+0x13e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    1280 <write_ft_info+0x150>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
lea    0xda4(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xda0(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xd9c(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xd98(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%edx
lea    0xd98(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%edx
imul   -0x14(%rbp),%edx
imul   -0x18(%rbp),%edx
lea    0xd97(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_ft_info>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    -0x41(%rsi),%eax
cmp    $0x16,%al
ja     1258 <write_ft_info+0x128>
mov    %rdi,%r15
mov    $0x6,%r14d
mov    $0x40,%ebp
movzbl %al,%eax
lea    0xea2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
mov    $0x40,%r12d
mov    $0x40,%r13d
jmp    *%rax
mov    $0x80,%r12d
mov    $0x100,%ebp
mov    $0x100,%r13d
jmp    11c9 <write_ft_info+0x99>
mov    $0x200,%r13d
mov    $0x14,%r14d
mov    $0x100,%ebp
mov    $0x100,%r12d
jmp    11c9 <write_ft_info+0x99>
mov    $0x14,%r14d
mov    $0x200,%ebp
mov    $0x200,%r12d
mov    $0x200,%r13d
jmp    11c9 <write_ft_info+0x99>
mov    $0x20,%r12d
mov    $0x80,%ebp
mov    $0x80,%r13d
cmp    %r13d,%ebp
mov    %r13d,%ebx
cmova  %ebp,%ebx
cmp    %ebx,%r12d
cmova  %r12d,%ebx
lea    0xeae(%rip),%rsi
mov    %r15,%rdi
mov    %r13d,%edx
call   1040 <fprintf@plt>
lea    0xeab(%rip),%rsi
mov    %r15,%rdi
mov    %ebp,%edx
call   1040 <fprintf@plt>
lea    0xea9(%rip),%rsi
mov    %r15,%rdi
mov    %r12d,%edx
call   1040 <fprintf@plt>
lea    0xea6(%rip),%rsi
mov    %r15,%rdi
mov    %ebx,%edx
call   1040 <fprintf@plt>
lea    0xea8(%rip),%rsi
mov    %r15,%rdi
mov    %r14d,%edx
call   1040 <fprintf@plt>
imul   %r13d,%ebp
imul   %r12d,%ebp
lea    0xea8(%rip),%rsi
mov    %r15,%rdi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fprintf@plt>
movsbl %sil,%esi
lea    0xdf9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"setparams: Internal error: invalid class type %c\0A\00"
@.str.1 = [15 x i8] c"#define\09NX\09%d\0A\00"
@.str.2 = [15 x i8] c"#define\09NY\09%d\0A\00"
@.str.3 = [15 x i8] c"#define\09NZ\09%d\0A\00"
@.str.4 = [19 x i8] c"#define\09MAXDIM\09%d\0A\00"
@.str.5 = [26 x i8] c"#define\09NITER_DEFAULT\09%d\0A\00"
@.str.6 = [19 x i8] c"#define\09NTOTAL\09%d\0A\00"
define void @write_ft_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
store i32* %0, i32** %3
store i8 %1, i8* %4
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 83
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 64, i32* %5
store i32 64, i32* %6
store i32 64, i32* %7
store i32 6, i32* %9
br label %43
15: ; preds = %2
%16 = load i8, i8* %4
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 87
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 128, i32* %5
store i32 128, i32* %6
store i32 32, i32* %7
store i32 6, i32* %9
br label %42
20: ; preds = %15
%21 = load i8, i8* %4
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 65
br i1 %23, label %24, label %25
24: ; preds = %20
store i32 256, i32* %5
store i32 256, i32* %6
store i32 128, i32* %7
store i32 6, i32* %9
br label %41
25: ; preds = %20
%26 = load i8, i8* %4
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 66
br i1 %28, label %29, label %30
29: ; preds = %25
store i32 512, i32* %5
store i32 256, i32* %6
store i32 256, i32* %7
store i32 20, i32* %9
br label %40
30: ; preds = %25
%31 = load i8, i8* %4
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 67
br i1 %33, label %34, label %35
34: ; preds = %30
store i32 512, i32* %5
store i32 512, i32* %6
store i32 512, i32* %7
store i32 20, i32* %9
br label %39
35: ; preds = %30
%36 = load i8, i8* %4
%37 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %36)
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %34
br label %40
40: ; preds = %39, %29
br label %41
41: ; preds = %40, %24
br label %42
42: ; preds = %41, %19
br label %43
43: ; preds = %42, %14
%44 = load i32, i32* %5
store i32 %44, i32* %8
%45 = load i32, i32* %6
%46 = load i32, i32* %8
%47 = icmp sgt i32 %45, %46
br i1 %47, label %48, label %50
48: ; preds = %43
%49 = load i32, i32* %6
store i32 %49, i32* %8
br label %50
50: ; preds = %48, %43
%51 = load i32, i32* %7
%52 = load i32, i32* %8
%53 = icmp sgt i32 %51, %52
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = load i32, i32* %7
store i32 %55, i32* %8
br label %56
56: ; preds = %54, %50
%57 = load i32*, i32** %3
%58 = load i32, i32* %5
%59 = call i32 @fprintf(i32* %57, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %58)
%60 = load i32*, i32** %3
%61 = load i32, i32* %6
%62 = call i32 @fprintf(i32* %60, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %61)
%63 = load i32*, i32** %3
%64 = load i32, i32* %7
%65 = call i32 @fprintf(i32* %63, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %64)
%66 = load i32*, i32** %3
%67 = load i32, i32* %8
%68 = call i32 @fprintf(i32* %66, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %67)
%69 = load i32*, i32** %3
%70 = load i32, i32* %9
%71 = call i32 @fprintf(i32* %69, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %70)
%72 = load i32*, i32** %3
%73 = load i32, i32* %5
%74 = load i32, i32* %6
%75 = mul nsw i32 %73, %74
%76 = load i32, i32* %7
%77 = mul nsw i32 %75, %76
%78 = call i32 @fprintf(i32* %72, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %77)
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"setparams: Internal error: invalid class type %c\0A\00"
@.str.1 = [15 x i8] c"#define\09NX\09%d\0A\00"
@.str.2 = [15 x i8] c"#define\09NY\09%d\0A\00"
@.str.3 = [15 x i8] c"#define\09NZ\09%d\0A\00"
@.str.4 = [19 x i8] c"#define\09MAXDIM\09%d\0A\00"
@.str.5 = [26 x i8] c"#define\09NITER_DEFAULT\09%d\0A\00"
@.str.6 = [19 x i8] c"#define\09NTOTAL\09%d\0A\00"
define void @write_ft_info(i32* nocapture %0, i8 signext %1) {
switch i8 %1, label %7 [
i8 83, label %10
i8 87, label %3
i8 65, label %4
i8 66, label %5
i8 67, label %6
]
3: ; preds = %2
br label %10
4: ; preds = %2
br label %10
5: ; preds = %2
br label %10
6: ; preds = %2
br label %10
7: ; preds = %2
%8 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %1)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2, %3, %5, %6, %4
%11 = phi i32 [ 128, %3 ], [ 256, %4 ], [ 256, %5 ], [ 512, %6 ], [ 64, %2 ]
%12 = phi i32 [ 32, %3 ], [ 128, %4 ], [ 256, %5 ], [ 512, %6 ], [ 64, %2 ]
%13 = phi i32 [ 6, %3 ], [ 6, %4 ], [ 20, %5 ], [ 20, %6 ], [ 6, %2 ]
%14 = phi i32 [ 128, %3 ], [ 256, %4 ], [ 512, %5 ], [ 512, %6 ], [ 64, %2 ]
%15 = icmp ugt i32 %11, %14
%16 = select i1 %15, i32 %11, i32 %14
%17 = icmp ugt i32 %12, %16
%18 = select i1 %17, i32 %12, i32 %16
%19 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%20 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i32 %11)
%21 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%22 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i32 %18)
%23 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %13)
%24 = mul nuw nsw i32 %12, %11
%25 = mul nuw nsw i32 %24, %14
%26 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %25)
ret void
}