#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 *, char *, ...);
int isqrt(int);
int /*<<< orphan*/ printf(char *, char);
void write_sp_info(FILE *fp, int nprocs, char class) {
  int maxcells, problem_size, niter;
  char *dt;
  maxcells = isqrt(nprocs);
  if (class == 'S') {
    problem_size = 12;
    dt = "0.015d0";
    niter = 100;
  } else if (class == 'W') {
    problem_size = 36;
    dt = "0.0015d0";
    niter = 400;
  } else if (class == 'A') {
    problem_size = 64;
    dt = "0.0015d0";
    niter = 400;
  } else if (class == 'B') {
    problem_size = 102;
    dt = "0.001d0";
    niter = 400;
  } else if (class == 'C') {
    problem_size = 162;
    dt = "0.00067d0";
    niter = 400;
  } else if (class == 'D') {
    problem_size = 408;
    dt = "0.00030d0";
    niter = 500;
  } else if (class == 'E') {
    problem_size = 1020;
    dt = "0.0001d0";
    niter = 500;
  } else {
    printf("setparams: Internal error: invalid class %c\n", class);
    exit(1);
  }
  fprintf(fp, "%sinteger maxcells, problem_size, niter_default\n", "        ");
  fprintf(fp, "%sparameter (maxcells=%d, problem_size=%d, niter_default=%d)\n",
          "        ", maxcells, problem_size, niter);
  fprintf(fp, "%sdouble precision dt_default\n", "        ");
  fprintf(fp, "%sparameter (dt_default = %s)\n", "        ", dt);
}


x86 assembly (clang, -O0):
<write_sp_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <isqrt@plt>
mov    %eax,-0x14(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0x53,%eax
jne    118a <write_sp_info+0x4a>
movl   $0xc,-0x18(%rbp)
lea    0xe86(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x64,-0x1c(%rbp)
jmp    12c4 <write_sp_info+0x184>
movsbl -0xd(%rbp),%eax
cmp    $0x57,%eax
jne    11b5 <write_sp_info+0x75>
movl   $0x24,-0x18(%rbp)
lea    0xe63(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x190,-0x1c(%rbp)
jmp    12bf <write_sp_info+0x17f>
movsbl -0xd(%rbp),%eax
cmp    $0x41,%eax
jne    11e0 <write_sp_info+0xa0>
movl   $0x40,-0x18(%rbp)
lea    0xe38(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x190,-0x1c(%rbp)
jmp    12ba <write_sp_info+0x17a>
movsbl -0xd(%rbp),%eax
cmp    $0x42,%eax
jne    120b <write_sp_info+0xcb>
movl   $0x66,-0x18(%rbp)
lea    0xe16(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x190,-0x1c(%rbp)
jmp    12b5 <write_sp_info+0x175>
movsbl -0xd(%rbp),%eax
cmp    $0x43,%eax
jne    1236 <write_sp_info+0xf6>
movl   $0xa2,-0x18(%rbp)
lea    0xdf3(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x190,-0x1c(%rbp)
jmp    12b0 <write_sp_info+0x170>
movsbl -0xd(%rbp),%eax
cmp    $0x44,%eax
jne    1261 <write_sp_info+0x121>
movl   $0x198,-0x18(%rbp)
lea    0xdd2(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x1f4,-0x1c(%rbp)
jmp    12ab <write_sp_info+0x16b>
movsbl -0xd(%rbp),%eax
cmp    $0x45,%eax
jne    128c <write_sp_info+0x14c>
movl   $0x3fc,-0x18(%rbp)
lea    0xdb1(%rip),%rax
mov    %rax,-0x28(%rbp)
movl   $0x1f4,-0x1c(%rbp)
jmp    12a6 <write_sp_info+0x166>
lea    0xda3(%rip),%rdi
movsbl -0xd(%rbp),%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
jmp    12ab <write_sp_info+0x16b>
jmp    12b0 <write_sp_info+0x170>
jmp    12b5 <write_sp_info+0x175>
jmp    12ba <write_sp_info+0x17a>
jmp    12bf <write_sp_info+0x17f>
jmp    12c4 <write_sp_info+0x184>
mov    -0x8(%rbp),%rdi
lea    0xd94(%rip),%rsi
lea    0xdbe(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
lea    0xdaa(%rip),%rsi
lea    0xd9a(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xdcf(%rip),%rsi
lea    0xd81(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rcx
lea    0xdd1(%rip),%rsi
lea    0xd64(%rip),%rdx
mov    $0x0,%al
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_sp_info>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
mov    %esi,%edi
call   1050 <isqrt@plt>
mov    %eax,%r15d
lea    -0x41(%rbp),%eax
cmp    $0x16,%al
ja     1278 <write_sp_info+0x138>
lea    0xef0(%rip),%r14
mov    $0x64,%r12d
mov    $0xc,%r13d
movzbl %al,%eax
lea    0xe7e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed2(%rip),%r14
mov    $0x190,%r12d
mov    $0x40,%r13d
jmp    1207 <write_sp_info+0xc7>
lea    0xec6(%rip),%r14
mov    $0x190,%r12d
mov    $0x66,%r13d
jmp    1207 <write_sp_info+0xc7>
lea    0xeb9(%rip),%r14
mov    $0x190,%r12d
mov    $0xa2,%r13d
jmp    1207 <write_sp_info+0xc7>
lea    0xeae(%rip),%r14
mov    $0x1f4,%r12d
mov    $0x198,%r13d
jmp    1207 <write_sp_info+0xc7>
lea    0xea3(%rip),%r14
mov    $0x1f4,%r12d
mov    $0x3fc,%r13d
jmp    1207 <write_sp_info+0xc7>
lea    0xe69(%rip),%r14
mov    $0x190,%r12d
mov    $0x24,%r13d
lea    0xeb1(%rip),%rsi
lea    0xedb(%rip),%rbp
mov    %rbx,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xed0(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
mov    %r15d,%ecx
mov    %r13d,%r8d
mov    %r12d,%r9d
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xef1(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1040 <fprintf@plt>
lea    0xefc(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
mov    %r14,%rcx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <fprintf@plt>
movsbl %bpl,%esi
lea    0xe0f(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"0.015d0\00"
@.str.1 = [9 x i8] c"0.0015d0\00"
@.str.2 = [8 x i8] c"0.001d0\00"
@.str.3 = [10 x i8] c"0.00067d0\00"
@.str.4 = [10 x i8] c"0.00030d0\00"
@.str.5 = [9 x i8] c"0.0001d0\00"
@.str.6 = [45 x i8] c"setparams: Internal error: invalid class %c\0A\00"
@.str.7 = [49 x i8] c"%sinteger maxcells, problem_size, niter_default\0A\00"
@.str.8 = [9 x i8] c" \00"
@.str.9 = [62 x i8] c"%sparameter (maxcells=%d, problem_size=%d, niter_default=%d)\0A\00"
@.str.10 = [31 x i8] c"%sdouble precision dt_default\0A\00"
@.str.11 = [31 x i8] c"%sparameter (dt_default = %s)\0A\00"
define void @write_sp_info(i32* %0, i32 %1, i8 signext %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%11 = load i32, i32* %5
%12 = call i32 @isqrt(i32 %11)
store i32 %12, i32* %7
%13 = load i8, i8* %6
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 83
br i1 %15, label %16, label %17
16: ; preds = %3
store i32 12, i32* %8
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %10
store i32 100, i32* %9
br label %57
17: ; preds = %3
%18 = load i8, i8* %6
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 87
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 36, i32* %8
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %10
store i32 400, i32* %9
br label %56
22: ; preds = %17
%23 = load i8, i8* %6
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 65
br i1 %25, label %26, label %27
26: ; preds = %22
store i32 64, i32* %8
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %10
store i32 400, i32* %9
br label %55
27: ; preds = %22
%28 = load i8, i8* %6
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 66
br i1 %30, label %31, label %32
31: ; preds = %27
store i32 102, i32* %8
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8** %10
store i32 400, i32* %9
br label %54
32: ; preds = %27
%33 = load i8, i8* %6
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 67
br i1 %35, label %36, label %37
36: ; preds = %32
store i32 162, i32* %8
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i8** %10
store i32 400, i32* %9
br label %53
37: ; preds = %32
%38 = load i8, i8* %6
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 68
br i1 %40, label %41, label %42
41: ; preds = %37
store i32 408, i32* %8
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8** %10
store i32 500, i32* %9
br label %52
42: ; preds = %37
%43 = load i8, i8* %6
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 69
br i1 %45, label %46, label %47
46: ; preds = %42
store i32 1020, i32* %8
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8** %10
store i32 500, i32* %9
br label %51
47: ; preds = %42
%48 = load i8, i8* %6
%49 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, 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** %4
%59 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %58, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%60 = load i32*, i32** %4
%61 = load i32, i32* %7
%62 = load i32, i32* %8
%63 = load i32, i32* %9
%64 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %60, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 %61, i32 %62, i32 %63)
%65 = load i32*, i32** %4
%66 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %65, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%67 = load i32*, i32** %4
%68 = load i8*, i8** %10
%69 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %67, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8* %68)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"0.015d0\00"
@.str.1 = [9 x i8] c"0.0015d0\00"
@.str.2 = [8 x i8] c"0.001d0\00"
@.str.3 = [10 x i8] c"0.00067d0\00"
@.str.4 = [10 x i8] c"0.00030d0\00"
@.str.5 = [9 x i8] c"0.0001d0\00"
@.str.6 = [45 x i8] c"setparams: Internal error: invalid class %c\0A\00"
@.str.7 = [49 x i8] c"%sinteger maxcells, problem_size, niter_default\0A\00"
@.str.8 = [9 x i8] c" \00"
@.str.9 = [62 x i8] c"%sparameter (maxcells=%d, problem_size=%d, niter_default=%d)\0A\00"
@.str.10 = [31 x i8] c"%sdouble precision dt_default\0A\00"
@.str.11 = [31 x i8] c"%sparameter (dt_default = %s)\0A\00"
define void @write_sp_info(i32* nocapture %0, i32 %1, i8 signext %2) {
%4 = tail call i32 @isqrt(i32 %1)
switch i8 %2, label %11 [
i8 83, label %14
i8 87, label %5
i8 65, label %6
i8 66, label %7
i8 67, label %8
i8 68, label %9
i8 69, label %10
]
5: ; preds = %3
br label %14
6: ; preds = %3
br label %14
7: ; preds = %3
br label %14
8: ; preds = %3
br label %14
9: ; preds = %3
br label %14
10: ; preds = %3
br label %14
11: ; preds = %3
%12 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0), i8 signext %2)
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %3, %5, %7, %9, %10, %8, %6
%15 = phi i32 [ 36, %5 ], [ 64, %6 ], [ 102, %7 ], [ 162, %8 ], [ 408, %9 ], [ 1020, %10 ], [ 12, %3 ]
%16 = phi i32 [ 400, %5 ], [ 400, %6 ], [ 400, %7 ], [ 400, %8 ], [ 500, %9 ], [ 500, %10 ], [ 100, %3 ]
%17 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), %6 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), %8 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), %9 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), %10 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), %3 ]
%18 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%19 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str.9, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i32 %4, i32 %15, i32 %16)
%20 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0))
%21 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.8, i64 0, i64 0), i8* %17)
ret void
}