#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_dt_info(FILE *fp, int nprocs, char class) {
  int num_samples, deviation, num_sources;
  if (class == 'S') {
    num_samples = 1728;
    deviation = 128;
    num_sources = 4;
  } else if (class == 'W') {
    num_samples = 1728 * 8;
    deviation = 128 * 2;
    num_sources = 4 * 2;
  } else if (class == 'A') {
    num_samples = 1728 * 64;
    deviation = 128 * 4;
    num_sources = 4 * 4;
  } else if (class == 'B') {
    num_samples = 1728 * 512;
    deviation = 128 * 8;
    num_sources = 4 * 8;
  } else if (class == 'C') {
    num_samples = 1728 * 4096;
    deviation = 128 * 16;
    num_sources = 4 * 16;
  } else if (class == 'D') {
    num_samples = 1728 * 4096 * 8;
    deviation = 128 * 32;
    num_sources = 4 * 32;
  } else {
    printf("setparams: Internal error: invalid class type %c\n", class);
    exit(1);
  }
  fprintf(fp, "#define NUM_SAMPLES %d\n", num_samples);
  fprintf(fp, "#define STD_DEVIATION %d\n", deviation);
  fprintf(fp, "#define NUM_SOURCES %d\n", num_sources);
}


x86 assembly (clang, -O0):
<write_dt_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%eax
cmp    $0x53,%eax
jne    116b <write_dt_info+0x3b>
movl   $0x6c0,-0x14(%rbp)
movl   $0x80,-0x18(%rbp)
movl   $0x4,-0x1c(%rbp)
jmp    1261 <write_dt_info+0x131>
movsbl -0xd(%rbp),%eax
cmp    $0x57,%eax
jne    1192 <write_dt_info+0x62>
movl   $0x3600,-0x14(%rbp)
movl   $0x100,-0x18(%rbp)
movl   $0x8,-0x1c(%rbp)
jmp    125c <write_dt_info+0x12c>
movsbl -0xd(%rbp),%eax
cmp    $0x41,%eax
jne    11b9 <write_dt_info+0x89>
movl   $0x1b000,-0x14(%rbp)
movl   $0x200,-0x18(%rbp)
movl   $0x10,-0x1c(%rbp)
jmp    1257 <write_dt_info+0x127>
movsbl -0xd(%rbp),%eax
cmp    $0x42,%eax
jne    11e0 <write_dt_info+0xb0>
movl   $0xd8000,-0x14(%rbp)
movl   $0x400,-0x18(%rbp)
movl   $0x20,-0x1c(%rbp)
jmp    1252 <write_dt_info+0x122>
movsbl -0xd(%rbp),%eax
cmp    $0x43,%eax
jne    1207 <write_dt_info+0xd7>
movl   $0x6c0000,-0x14(%rbp)
movl   $0x800,-0x18(%rbp)
movl   $0x40,-0x1c(%rbp)
jmp    124d <write_dt_info+0x11d>
movsbl -0xd(%rbp),%eax
cmp    $0x44,%eax
jne    122e <write_dt_info+0xfe>
movl   $0x3600000,-0x14(%rbp)
movl   $0x1000,-0x18(%rbp)
movl   $0x80,-0x1c(%rbp)
jmp    1248 <write_dt_info+0x118>
lea    0xdcb(%rip),%rdi
movsbl -0xd(%rbp),%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    124d <write_dt_info+0x11d>
jmp    1252 <write_dt_info+0x122>
jmp    1257 <write_dt_info+0x127>
jmp    125c <write_dt_info+0x12c>
jmp    1261 <write_dt_info+0x131>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xdc3(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xdc8(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%edx
lea    0xdcf(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_dt_info>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%eax
lea    -0x41(%rax),%ecx
cmp    $0x16,%cl
ja     11f6 <write_dt_info+0xc6>
mov    %rdi,%rbx
mov    $0x4,%r14d
mov    $0x80,%ebp
mov    $0x6c0,%edx
movzbl %cl,%ecx
lea    0xea1(%rip),%rsi
movslq (%rsi,%rcx,4),%rcx
add    %rsi,%rcx
jmp    *%rcx
mov    $0x10,%r14d
mov    $0x200,%ebp
mov    $0x1b000,%edx
jmp    11c0 <write_dt_info+0x90>
mov    $0x20,%r14d
mov    $0x400,%ebp
mov    $0xd8000,%edx
jmp    11c0 <write_dt_info+0x90>
mov    $0x40,%r14d
mov    $0x800,%ebp
mov    $0x6c0000,%edx
jmp    11c0 <write_dt_info+0x90>
mov    $0x80,%r14d
mov    $0x1000,%ebp
mov    $0x3600000,%edx
jmp    11c0 <write_dt_info+0x90>
mov    $0x8,%r14d
mov    $0x100,%ebp
mov    $0x3600,%edx
lea    0xec7(%rip),%rsi
mov    %rbx,%rdi
call   1040 <fprintf@plt>
lea    0xed0(%rip),%rsi
mov    %rbx,%rdi
mov    %ebp,%edx
call   1040 <fprintf@plt>
lea    0xed9(%rip),%rsi
mov    %rbx,%rdi
mov    %r14d,%edx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fprintf@plt>
movsbl %al,%esi
lea    0xe5c(%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 = [24 x i8] c"#define NUM_SAMPLES %d\0A\00"
@.str.2 = [26 x i8] c"#define STD_DEVIATION %d\0A\00"
@.str.3 = [24 x i8] c"#define NUM_SOURCES %d\0A\00"
define void @write_dt_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
store i32* %0, i32** %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%10 = load i8, i8* %6
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 83
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 1728, i32* %7
store i32 128, i32* %8
store i32 4, i32* %9
br label %48
14: ; preds = %3
%15 = load i8, i8* %6
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 87
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 13824, i32* %7
store i32 256, i32* %8
store i32 8, i32* %9
br label %47
19: ; preds = %14
%20 = load i8, i8* %6
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 65
br i1 %22, label %23, label %24
23: ; preds = %19
store i32 110592, i32* %7
store i32 512, i32* %8
store i32 16, i32* %9
br label %46
24: ; preds = %19
%25 = load i8, i8* %6
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 66
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 884736, i32* %7
store i32 1024, i32* %8
store i32 32, i32* %9
br label %45
29: ; preds = %24
%30 = load i8, i8* %6
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 67
br i1 %32, label %33, label %34
33: ; preds = %29
store i32 7077888, i32* %7
store i32 2048, i32* %8
store i32 64, i32* %9
br label %44
34: ; preds = %29
%35 = load i8, i8* %6
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 68
br i1 %37, label %38, label %39
38: ; preds = %34
store i32 56623104, i32* %7
store i32 4096, i32* %8
store i32 128, i32* %9
br label %43
39: ; preds = %34
%40 = load i8, i8* %6
%41 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %40)
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %38
br label %44
44: ; preds = %43, %33
br label %45
45: ; preds = %44, %28
br label %46
46: ; preds = %45, %23
br label %47
47: ; preds = %46, %18
br label %48
48: ; preds = %47, %13
%49 = load i32*, i32** %4
%50 = load i32, i32* %7
%51 = call i32 @fprintf(i32* %49, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %50)
%52 = load i32*, i32** %4
%53 = load i32, i32* %8
%54 = call i32 @fprintf(i32* %52, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %53)
%55 = load i32*, i32** %4
%56 = load i32, i32* %9
%57 = call i32 @fprintf(i32* %55, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %56)
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"setparams: Internal error: invalid class type %c\0A\00"
@.str.1 = [24 x i8] c"#define NUM_SAMPLES %d\0A\00"
@.str.2 = [26 x i8] c"#define STD_DEVIATION %d\0A\00"
@.str.3 = [24 x i8] c"#define NUM_SOURCES %d\0A\00"
define void @write_dt_info(i32* nocapture %0, i32 %1, i8 signext %2) {
switch i8 %2, label %9 [
i8 83, label %12
i8 87, label %4
i8 65, label %5
i8 66, label %6
i8 67, label %7
i8 68, label %8
]
4: ; preds = %3
br label %12
5: ; preds = %3
br label %12
6: ; preds = %3
br label %12
7: ; preds = %3
br label %12
8: ; preds = %3
br label %12
9: ; preds = %3
%10 = tail call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8 signext %2)
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %3, %4, %6, %8, %7, %5
%13 = phi i32 [ 13824, %4 ], [ 110592, %5 ], [ 884736, %6 ], [ 7077888, %7 ], [ 56623104, %8 ], [ 1728, %3 ]
%14 = phi i32 [ 256, %4 ], [ 512, %5 ], [ 1024, %6 ], [ 2048, %7 ], [ 4096, %8 ], [ 128, %3 ]
%15 = phi i32 [ 8, %4 ], [ 16, %5 ], [ 32, %6 ], [ 64, %7 ], [ 128, %8 ], [ 4, %3 ]
%16 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%17 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%18 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %15)
ret void
}