#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 */

/* Variables and functions */
void set_coef(double *con, char type, const double *coef) {
  switch (type) {
  case 'S':
    con[0] = *coef;
    return;
  case 'L':
    con[0] = *coef++;
  case 'P':
    for (size_t i = 1; i < 4; i++)
      con[i] = *coef;
    return;
  case 'D':
    for (size_t i = 4; i < 10; i++)
      con[i] = *coef;
    return;
  case 'F':
    for (size_t i = 10; i < 20; i++)
      con[i] = *coef;
    return;
  }
}


x86 assembly (clang, -O0):
<set_coef>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %rdx,-0x18(%rbp)
movsbl -0x9(%rbp),%eax
add    $0xffffffbc,%eax
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0xf,%eax
ja     1226 <set_coef+0x126>
mov    -0x38(%rbp),%rax
lea    0xecd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1226 <set_coef+0x126>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x18(%rbp)
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movq   $0x1,-0x20(%rbp)
cmpq   $0x4,-0x20(%rbp)
jae    11a5 <set_coef+0xa5>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1174 <set_coef+0x74>
jmp    1226 <set_coef+0x126>
movq   $0x4,-0x28(%rbp)
cmpq   $0xa,-0x28(%rbp)
jae    11e3 <set_coef+0xe3>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    11b2 <set_coef+0xb2>
jmp    1226 <set_coef+0x126>
movq   $0xa,-0x30(%rbp)
cmpq   $0x14,-0x30(%rbp)
jae    1221 <set_coef+0x121>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x30(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11f0 <set_coef+0xf0>
jmp    1226 <set_coef+0x126>
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_coef>:
add    $0xffffffbc,%esi
cmp    $0xf,%esi
ja     11e1 <set_coef+0xe1>
lea    0xeed(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
movsd  (%rdx),%xmm0
movsd  %xmm0,0x20(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x28(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x30(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x38(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x40(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x48(%rdi)
ret
movsd  (%rdx),%xmm0
movsd  %xmm0,0x50(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x58(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x60(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x68(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x70(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x78(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x80(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x88(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x90(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x98(%rdi)
ret
movsd  (%rdx),%xmm0
add    $0x8,%rdx
movsd  %xmm0,(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x8(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x10(%rdi)
movsd  (%rdx),%xmm0
movsd  %xmm0,0x18(%rdi)
ret
movsd  (%rdx),%xmm0
movsd  %xmm0,(%rdi)
ret

LLVM IR (-O0):
define void @set_coef(double* %0, i8 signext %1, double* %2) {
%4 = alloca double*
%5 = alloca i8
%6 = alloca double*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store double* %0, double** %4
store i8 %1, i8* %5
store double* %2, double** %6
%10 = load i8, i8* %5
%11 = sext i8 %10 to i32
switch i32 %11, label %65 [
i32 83, label %12
i32 76, label %17
i32 80, label %23
i32 68, label %37
i32 70, label %51
]
12: ; preds = %3
%13 = load double*, double** %6
%14 = load double, double* %13
%15 = load double*, double** %4
%16 = getelementptr inbounds double, double* %15, i64 0
store double %14, double* %16
br label %65
17: ; preds = %3
%18 = load double*, double** %6
%19 = getelementptr inbounds double, double* %18, i32 1
store double* %19, double** %6
%20 = load double, double* %18
%21 = load double*, double** %4
%22 = getelementptr inbounds double, double* %21, i64 0
store double %20, double* %22
br label %23
23: ; preds = %3, %17
store i64 1, i64* %7
br label %24
24: ; preds = %33, %23
%25 = load i64, i64* %7
%26 = icmp ult i64 %25, 4
br i1 %26, label %27, label %36
27: ; preds = %24
%28 = load double*, double** %6
%29 = load double, double* %28
%30 = load double*, double** %4
%31 = load i64, i64* %7
%32 = getelementptr inbounds double, double* %30, i64 %31
store double %29, double* %32
br label %33
33: ; preds = %27
%34 = load i64, i64* %7
%35 = add i64 %34, 1
store i64 %35, i64* %7
br label %24
36: ; preds = %24
br label %65
37: ; preds = %3
store i64 4, i64* %8
br label %38
38: ; preds = %47, %37
%39 = load i64, i64* %8
%40 = icmp ult i64 %39, 10
br i1 %40, label %41, label %50
41: ; preds = %38
%42 = load double*, double** %6
%43 = load double, double* %42
%44 = load double*, double** %4
%45 = load i64, i64* %8
%46 = getelementptr inbounds double, double* %44, i64 %45
store double %43, double* %46
br label %47
47: ; preds = %41
%48 = load i64, i64* %8
%49 = add i64 %48, 1
store i64 %49, i64* %8
br label %38
50: ; preds = %38
br label %65
51: ; preds = %3
store i64 10, i64* %9
br label %52
52: ; preds = %61, %51
%53 = load i64, i64* %9
%54 = icmp ult i64 %53, 20
br i1 %54, label %55, label %64
55: ; preds = %52
%56 = load double*, double** %6
%57 = load double, double* %56
%58 = load double*, double** %4
%59 = load i64, i64* %9
%60 = getelementptr inbounds double, double* %58, i64 %59
store double %57, double* %60
br label %61
61: ; preds = %55
%62 = load i64, i64* %9
%63 = add i64 %62, 1
store i64 %63, i64* %9
br label %52
64: ; preds = %52
br label %65
65: ; preds = %12, %36, %50, %64, %3
ret void
}

LLVM IR (-O2):
define void @set_coef(double* nocapture writeonly %0, i8 signext %1, double* nocapture %2) {
%4 = sext i8 %1 to i32
switch i32 %4, label %52 [
i32 83, label %39
i32 76, label %41
i32 80, label %44
i32 68, label %26
i32 70, label %5
]
5: ; preds = %3
%6 = load double, double* %2
%7 = getelementptr inbounds double, double* %0, i64 10
store double %6, double* %7
%8 = load double, double* %2
%9 = getelementptr inbounds double, double* %0, i64 11
store double %8, double* %9
%10 = load double, double* %2
%11 = getelementptr inbounds double, double* %0, i64 12
store double %10, double* %11
%12 = load double, double* %2
%13 = getelementptr inbounds double, double* %0, i64 13
store double %12, double* %13
%14 = load double, double* %2
%15 = getelementptr inbounds double, double* %0, i64 14
store double %14, double* %15
%16 = load double, double* %2
%17 = getelementptr inbounds double, double* %0, i64 15
store double %16, double* %17
%18 = load double, double* %2
%19 = getelementptr inbounds double, double* %0, i64 16
store double %18, double* %19
%20 = load double, double* %2
%21 = getelementptr inbounds double, double* %0, i64 17
store double %20, double* %21
%22 = load double, double* %2
%23 = getelementptr inbounds double, double* %0, i64 18
store double %22, double* %23
%24 = load double, double* %2
%25 = getelementptr inbounds double, double* %0, i64 19
store double %24, double* %25
br label %52
26: ; preds = %3
%27 = load double, double* %2
%28 = getelementptr inbounds double, double* %0, i64 4
store double %27, double* %28
%29 = load double, double* %2
%30 = getelementptr inbounds double, double* %0, i64 5
store double %29, double* %30
%31 = load double, double* %2
%32 = getelementptr inbounds double, double* %0, i64 6
store double %31, double* %32
%33 = load double, double* %2
%34 = getelementptr inbounds double, double* %0, i64 7
store double %33, double* %34
%35 = load double, double* %2
%36 = getelementptr inbounds double, double* %0, i64 8
store double %35, double* %36
%37 = load double, double* %2
%38 = getelementptr inbounds double, double* %0, i64 9
store double %37, double* %38
br label %52
39: ; preds = %3
%40 = load double, double* %2
store double %40, double* %0
br label %52
41: ; preds = %3
%42 = getelementptr inbounds double, double* %2, i64 1
%43 = load double, double* %2
store double %43, double* %0
br label %44
44: ; preds = %3, %41
%45 = phi double* [ %2, %3 ], [ %42, %41 ]
%46 = load double, double* %45
%47 = getelementptr inbounds double, double* %0, i64 1
store double %46, double* %47
%48 = load double, double* %45
%49 = getelementptr inbounds double, double* %0, i64 2
store double %48, double* %49
%50 = load double, double* %45
%51 = getelementptr inbounds double, double* %0, i64 3
store double %50, double* %51
br label %52
52: ; preds = %5, %26, %44, %39, %3
ret void
}