#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 *, unsigned long long);
int /*<<< orphan*/ printf(char *, char);
void write_ft_info(FILE *fp, char class) {
  int nx, ny, nz, maxdim, niter;
  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 if (class == 'D') {
    nx = 2048;
    ny = 1024;
    nz = 1024;
    niter = 25;
  } else if (class == 'E') {
    nx = 4096;
    ny = 2048;
    nz = 2048;
    niter = 25;
  } 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 NX             %d\n", nx);
  fprintf(fp, "#define NY             %d\n", ny);
  fprintf(fp, "#define NZ             %d\n", nz);
  fprintf(fp, "#define MAXDIM         %d\n", maxdim);
  fprintf(fp, "#define NITER_DEFAULT  %d\n", niter);
  fprintf(fp, "#define NXP            %d\n", nx + 1);
  fprintf(fp, "#define NYP            %d\n", ny);
  fprintf(fp, "#define NTOTAL         %llu\n",
          (unsigned long long)nx * ny * nz);
  fprintf(fp, "#define NTOTALP        %llu\n",
          (unsigned long long)(nx + 1) * ny * nz);
}


x86 assembly (clang, -O0):
<write_ft_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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    12bc <write_ft_info+0x18c>
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    12b7 <write_ft_info+0x187>
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    12b2 <write_ft_info+0x182>
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    12ad <write_ft_info+0x17d>
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    12a8 <write_ft_info+0x178>
movsbl -0x9(%rbp),%eax
cmp    $0x44,%eax
jne    1256 <write_ft_info+0x126>
movl   $0x800,-0x10(%rbp)
movl   $0x400,-0x14(%rbp)
movl   $0x400,-0x18(%rbp)
movl   $0x19,-0x20(%rbp)
jmp    12a3 <write_ft_info+0x173>
movsbl -0x9(%rbp),%eax
cmp    $0x45,%eax
jne    1284 <write_ft_info+0x154>
movl   $0x1000,-0x10(%rbp)
movl   $0x800,-0x14(%rbp)
movl   $0x800,-0x18(%rbp)
movl   $0x19,-0x20(%rbp)
jmp    129e <write_ft_info+0x16e>
lea    0xd75(%rip),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    12a3 <write_ft_info+0x173>
jmp    12a8 <write_ft_info+0x178>
jmp    12ad <write_ft_info+0x17d>
jmp    12b2 <write_ft_info+0x182>
jmp    12b7 <write_ft_info+0x187>
jmp    12bc <write_ft_info+0x18c>
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    12d4 <write_ft_info+0x1a4>
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jle    12e6 <write_ft_info+0x1b6>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rdx
lea    0xd3d(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rdx
lea    0xd44(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
movslq -0x18(%rbp),%rdx
lea    0xd4b(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
movslq -0x1c(%rbp),%rdx
lea    0xd52(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
movslq -0x20(%rbp),%rdx
lea    0xd59(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdx
lea    0xd5b(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
movslq -0x14(%rbp),%rdx
lea    0xd62(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
movslq -0x10(%rbp),%rdx
movslq -0x14(%rbp),%rax
imul   %rax,%rdx
movslq -0x18(%rbp),%rax
imul   %rax,%rdx
lea    0xd59(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%eax
add    $0x1,%eax
movslq %eax,%rdx
movslq -0x14(%rbp),%rax
imul   %rax,%rdx
movslq -0x18(%rbp),%rax
imul   %rax,%rdx
lea    0xd4d(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%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     12cc <write_ft_info+0x19c>
mov    %rdi,%r14
mov    $0x6,%edx
mov    $0x40,%r15d
movzbl %al,%eax
lea    0xea2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
mov    $0x40,%ebp
mov    $0x40,%ebx
jmp    *%rax
mov    $0x80,%ebx
mov    $0x100,%r15d
mov    $0x100,%ebp
jmp    11ef <write_ft_info+0xbf>
mov    $0x14,%edx
mov    $0x100,%ebp
mov    $0x200,%r15d
mov    $0x100,%ebx
jmp    11ef <write_ft_info+0xbf>
mov    $0x14,%edx
mov    $0x200,%r15d
mov    $0x200,%ebp
mov    $0x200,%ebx
jmp    11ef <write_ft_info+0xbf>
mov    $0x19,%edx
mov    $0x400,%ebp
mov    $0x800,%r15d
mov    $0x400,%ebx
jmp    11ef <write_ft_info+0xbf>
mov    $0x19,%edx
mov    $0x800,%ebp
mov    $0x1000,%r15d
mov    $0x800,%ebx
jmp    11ef <write_ft_info+0xbf>
mov    $0x20,%ebx
mov    $0x80,%r15d
mov    $0x80,%ebp
mov    %rdx,(%rsp)
cmp    %r15d,%ebp
mov    %r15d,%r13d
cmova  %ebp,%r13d
cmp    %r13d,%ebx
cmova  %ebx,%r13d
mov    %r15d,%r12d
lea    0xe80(%rip),%rsi
mov    %r14,%rdi
mov    %r12,%rdx
call   1040 <fprintf@plt>
mov    %ebp,%ebp
lea    0xe87(%rip),%rsi
mov    %r14,%rdi
mov    %rbp,%rdx
call   1040 <fprintf@plt>
mov    %ebx,%ebx
lea    0xe8e(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
call   1040 <fprintf@plt>
lea    0xe97(%rip),%rsi
mov    %r14,%rdi
mov    %r13,%rdx
call   1040 <fprintf@plt>
lea    0xea0(%rip),%rsi
mov    %r14,%rdi
mov    (%rsp),%rdx
call   1040 <fprintf@plt>
or     $0x1,%r15d
lea    0xea4(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
call   1040 <fprintf@plt>
lea    0xead(%rip),%rsi
mov    %r14,%rdi
mov    %rbp,%rdx
call   1040 <fprintf@plt>
imul   %rbp,%rbx
imul   %rbx,%r12
lea    0xeae(%rip),%rsi
mov    %r14,%rdi
mov    %r12,%rdx
call   1040 <fprintf@plt>
imul   %r15,%rbx
lea    0xeb5(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fprintf@plt>
movsbl %sil,%esi
lea    0xd85(%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 = [27 x i8] c"#define NX %d\0A\00"
@.str.2 = [27 x i8] c"#define NY %d\0A\00"
@.str.3 = [27 x i8] c"#define NZ %d\0A\00"
@.str.4 = [27 x i8] c"#define MAXDIM %d\0A\00"
@.str.5 = [27 x i8] c"#define NITER_DEFAULT %d\0A\00"
@.str.6 = [27 x i8] c"#define NXP %d\0A\00"
@.str.7 = [27 x i8] c"#define NYP %d\0A\00"
@.str.8 = [29 x i8] c"#define NTOTAL %llu\0A\00"
@.str.9 = [29 x i8] c"#define NTOTALP %llu\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
store i32* %0, i32** %3
store i8 %1, i8* %4
%10 = load i8, i8* %4
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 83
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 64, i32* %5
store i32 64, i32* %6
store i32 64, i32* %7
store i32 6, i32* %9
br label %54
14: ; preds = %2
%15 = load i8, i8* %4
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 87
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 128, i32* %5
store i32 128, i32* %6
store i32 32, i32* %7
store i32 6, i32* %9
br label %53
19: ; preds = %14
%20 = load i8, i8* %4
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 65
br i1 %22, label %23, label %24
23: ; preds = %19
store i32 256, i32* %5
store i32 256, i32* %6
store i32 128, i32* %7
store i32 6, i32* %9
br label %52
24: ; preds = %19
%25 = load i8, i8* %4
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 66
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 512, i32* %5
store i32 256, i32* %6
store i32 256, i32* %7
store i32 20, i32* %9
br label %51
29: ; preds = %24
%30 = load i8, i8* %4
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 67
br i1 %32, label %33, label %34
33: ; preds = %29
store i32 512, i32* %5
store i32 512, i32* %6
store i32 512, i32* %7
store i32 20, i32* %9
br label %50
34: ; preds = %29
%35 = load i8, i8* %4
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 68
br i1 %37, label %38, label %39
38: ; preds = %34
store i32 2048, i32* %5
store i32 1024, i32* %6
store i32 1024, i32* %7
store i32 25, i32* %9
br label %49
39: ; preds = %34
%40 = load i8, i8* %4
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 69
br i1 %42, label %43, label %44
43: ; preds = %39
store i32 4096, i32* %5
store i32 2048, i32* %6
store i32 2048, i32* %7
store i32 25, i32* %9
br label %48
44: ; preds = %39
%45 = load i8, i8* %4
%46 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %45)
%47 = call i32 @exit(i32 1)
unreachable
48: ; preds = %43
br label %49
49: ; preds = %48, %38
br label %50
50: ; preds = %49, %33
br label %51
51: ; preds = %50, %28
br label %52
52: ; preds = %51, %23
br label %53
53: ; preds = %52, %18
br label %54
54: ; preds = %53, %13
%55 = load i32, i32* %5
store i32 %55, i32* %8
%56 = load i32, i32* %6
%57 = load i32, i32* %8
%58 = icmp sgt i32 %56, %57
br i1 %58, label %59, label %61
59: ; preds = %54
%60 = load i32, i32* %6
store i32 %60, i32* %8
br label %61
61: ; preds = %59, %54
%62 = load i32, i32* %7
%63 = load i32, i32* %8
%64 = icmp sgt i32 %62, %63
br i1 %64, label %65, label %67
65: ; preds = %61
%66 = load i32, i32* %7
store i32 %66, i32* %8
br label %67
67: ; preds = %65, %61
%68 = load i32*, i32** %3
%69 = load i32, i32* %5
%70 = sext i32 %69 to i64
%71 = call i32 @fprintf(i32* %68, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i64 %70)
%72 = load i32*, i32** %3
%73 = load i32, i32* %6
%74 = sext i32 %73 to i64
%75 = call i32 @fprintf(i32* %72, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i64 %74)
%76 = load i32*, i32** %3
%77 = load i32, i32* %7
%78 = sext i32 %77 to i64
%79 = call i32 @fprintf(i32* %76, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i64 %78)
%80 = load i32*, i32** %3
%81 = load i32, i32* %8
%82 = sext i32 %81 to i64
%83 = call i32 @fprintf(i32* %80, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i64 %82)
%84 = load i32*, i32** %3
%85 = load i32, i32* %9
%86 = sext i32 %85 to i64
%87 = call i32 @fprintf(i32* %84, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i64 %86)
%88 = load i32*, i32** %3
%89 = load i32, i32* %5
%90 = add nsw i32 %89, 1
%91 = sext i32 %90 to i64
%92 = call i32 @fprintf(i32* %88, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i64 %91)
%93 = load i32*, i32** %3
%94 = load i32, i32* %6
%95 = sext i32 %94 to i64
%96 = call i32 @fprintf(i32* %93, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i64 %95)
%97 = load i32*, i32** %3
%98 = load i32, i32* %5
%99 = sext i32 %98 to i64
%100 = load i32, i32* %6
%101 = sext i32 %100 to i64
%102 = mul i64 %99, %101
%103 = load i32, i32* %7
%104 = sext i32 %103 to i64
%105 = mul i64 %102, %104
%106 = call i32 @fprintf(i32* %97, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i64 %105)
%107 = load i32*, i32** %3
%108 = load i32, i32* %5
%109 = add nsw i32 %108, 1
%110 = sext i32 %109 to i64
%111 = load i32, i32* %6
%112 = sext i32 %111 to i64
%113 = mul i64 %110, %112
%114 = load i32, i32* %7
%115 = sext i32 %114 to i64
%116 = mul i64 %113, %115
%117 = call i32 @fprintf(i32* %107, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i64 %116)
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 %d\0A\00"
@.str.2 = [27 x i8] c"#define NY %d\0A\00"
@.str.3 = [27 x i8] c"#define NZ %d\0A\00"
@.str.4 = [27 x i8] c"#define MAXDIM %d\0A\00"
@.str.5 = [27 x i8] c"#define NITER_DEFAULT %d\0A\00"
@.str.6 = [27 x i8] c"#define NXP %d\0A\00"
@.str.7 = [27 x i8] c"#define NYP %d\0A\00"
@.str.8 = [29 x i8] c"#define NTOTAL %llu\0A\00"
@.str.9 = [29 x i8] c"#define NTOTALP %llu\0A\00"
define void @write_ft_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 [ 128, %3 ], [ 256, %4 ], [ 512, %5 ], [ 512, %6 ], [ 2048, %7 ], [ 4096, %8 ], [ 64, %2 ]
%14 = phi i32 [ 128, %3 ], [ 256, %4 ], [ 256, %5 ], [ 512, %6 ], [ 1024, %7 ], [ 2048, %8 ], [ 64, %2 ]
%15 = phi i32 [ 32, %3 ], [ 128, %4 ], [ 256, %5 ], [ 512, %6 ], [ 1024, %7 ], [ 2048, %8 ], [ 64, %2 ]
%16 = phi i64 [ 6, %3 ], [ 6, %4 ], [ 20, %5 ], [ 20, %6 ], [ 25, %7 ], [ 25, %8 ], [ 6, %2 ]
%17 = icmp ugt i32 %14, %13
%18 = select i1 %17, i32 %14, i32 %13
%19 = icmp ugt i32 %15, %18
%20 = select i1 %19, i32 %15, i32 %18
%21 = zext i32 %13 to i64
%22 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i64 %21)
%23 = zext i32 %14 to i64
%24 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i64 %23)
%25 = zext i32 %15 to i64
%26 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i64 %25)
%27 = zext i32 %20 to i64
%28 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i64 %27)
%29 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), i64 %16)
%30 = or i32 %13, 1
%31 = zext i32 %30 to i64
%32 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i64 %31)
%33 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.7, i64 0, i64 0), i64 %23)
%34 = mul nuw nsw i64 %25, %23
%35 = mul nuw nsw i64 %34, %21
%36 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i64 %35)
%37 = mul nuw nsw i64 %34, %31
%38 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i64 %37)
ret void
}