#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 */
char *strchr(char const *, char);
int adjustnominals(double *num, int den, char nominal, double temper[]) {
  int c;
  double n;
  char *x;
  const int m = 3;
  const char pylow[8] = "fcgdaeb";
  const char pyupp[8] = "FCGDAEB";
  x = NULL;
  c = 0;
  x = strchr(pylow, nominal);
  if (x != NULL)
    c = (x - pylow) - m;
  x = strchr(pyupp, nominal);
  if (x != NULL)
    c = (x - pyupp) - m;
  n = *num + ((temper[1] + (1.9550008653874328956590034067630767822266)) * c *
              (double)den / 100.0);
  *num = n;
  return 1;
}


x86 assembly (clang, -O0):
<adjustnominals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x3,-0x34(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x3c(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x44(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x1c(%rbp)
lea    -0x3c(%rbp),%rdi
movsbl -0xd(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1182 <adjustnominals+0x72>
mov    -0x30(%rbp),%rax
lea    -0x3c(%rbp),%rcx
sub    %rcx,%rax
sub    $0x3,%rax
mov    %eax,-0x1c(%rbp)
lea    -0x44(%rbp),%rdi
movsbl -0xd(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     11b0 <adjustnominals+0xa0>
mov    -0x30(%rbp),%rax
lea    -0x44(%rbp),%rcx
sub    %rcx,%rax
sub    $0x3,%rax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
movsd  0xe44(%rip),%xmm1
addsd  0x8(%rax),%xmm1
cvtsi2sdl -0x1c(%rbp),%xmm2
mulsd  %xmm2,%xmm1
cvtsi2sdl -0xc(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe1d(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
mov    $0x1,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adjustnominals>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r15
mov    %edx,%ebp
mov    %esi,%r14d
mov    %rdi,%r12
movabs $0x62656164676366,%rax
mov    %rax,0x10(%rsp)
movabs $0x42454144474346,%rax
mov    %rax,0x8(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %edx,%esi
call   1030 <strchr@plt>
mov    %eax,%ecx
sub    %ebx,%ecx
add    $0xfffffffd,%ecx
xor    %ebx,%ebx
test   %rax,%rax
cmovne %ecx,%ebx
lea    0x8(%rsp),%r13
mov    %r13,%rdi
mov    %ebp,%esi
call   1030 <strchr@plt>
mov    %eax,%ecx
sub    %r13d,%ecx
add    $0xfffffffd,%ecx
test   %rax,%rax
cmove  %ebx,%ecx
movsd  0x8(%r15),%xmm0
addsd  0xe70(%rip),%xmm0
cvtsi2sd %ecx,%xmm1
cvtsi2sd %r14d,%xmm2
mulsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm2
divsd  0xe5f(%rip),%xmm2
addsd  (%r12),%xmm2
movsd  %xmm2,(%r12)
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.adjustnominals.pylow = [8 x i8] c"fcgdaeb\00"
@__const.adjustnominals.pyupp = [8 x i8] c"FCGDAEB\00"
define i32 @adjustnominals(double* %0, i32 %1, i8 signext %2, double* %3) {
%5 = alloca double*
%6 = alloca i32
%7 = alloca i8
%8 = alloca double*
%9 = alloca i32
%10 = alloca double
%11 = alloca i8*
%12 = alloca i32
%13 = alloca [8 x i8]
%14 = alloca [8 x i8]
store double* %0, double** %5
store i32 %1, i32* %6
store i8 %2, i8* %7
store double* %3, double** %8
store i32 3, i32* %12
%15 = bitcast [8 x i8]* %13 to i8*
%16 = bitcast [8 x i8]* %14 to i8*
store i8* null, i8** %11
store i32 0, i32* %9
%17 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 0
%18 = load i8, i8* %7
%19 = call i8* @strchr(i8* %17, i8 signext %18)
store i8* %19, i8** %11
%20 = load i8*, i8** %11
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %30
22: ; preds = %4
%23 = load i8*, i8** %11
%24 = getelementptr inbounds [8 x i8], [8 x i8]* %13, i64 0, i64 0
%25 = ptrtoint i8* %23 to i64
%26 = ptrtoint i8* %24 to i64
%27 = sub i64 %25, %26
%28 = sub nsw i64 %27, 3
%29 = trunc i64 %28 to i32
store i32 %29, i32* %9
br label %30
30: ; preds = %22, %4
%31 = getelementptr inbounds [8 x i8], [8 x i8]* %14, i64 0, i64 0
%32 = load i8, i8* %7
%33 = call i8* @strchr(i8* %31, i8 signext %32)
store i8* %33, i8** %11
%34 = load i8*, i8** %11
%35 = icmp ne i8* %34, null
br i1 %35, label %36, label %44
36: ; preds = %30
%37 = load i8*, i8** %11
%38 = getelementptr inbounds [8 x i8], [8 x i8]* %14, i64 0, i64 0
%39 = ptrtoint i8* %37 to i64
%40 = ptrtoint i8* %38 to i64
%41 = sub i64 %39, %40
%42 = sub nsw i64 %41, 3
%43 = trunc i64 %42 to i32
store i32 %43, i32* %9
br label %44
44: ; preds = %36, %30
%45 = load double*, double** %5
%46 = load double, double* %45
%47 = load double*, double** %8
%48 = getelementptr inbounds double, double* %47, i64 1
%49 = load double, double* %48
%50 = fadd double %49, 0x3FFF47AEFCC7DA00
%51 = load i32, i32* %9
%52 = sitofp i32 %51 to double
%53 = fmul double %50, %52
%54 = load i32, i32* %6
%55 = sitofp i32 %54 to double
%56 = fmul double %53, %55
%57 = fdiv double %56, 1.000000e+02
%58 = fadd double %46, %57
store double %58, double* %10
%59 = load double, double* %10
%60 = load double*, double** %5
store double %59, double* %60
ret i32 1
}

LLVM IR (-O2):
define i32 @adjustnominals(double* nocapture %0, i32 %1, i8 signext %2, double* nocapture %3) {
%5 = alloca i64
%6 = alloca i64
%7 = bitcast i64* %5 to i8*
store i64 27696016688374630, i64* %5
%8 = bitcast i64* %6 to i8*
store i64 18653495083615046, i64* %6
%9 = call i8* @strchr(i8* %7, i8 signext %2)
%10 = icmp eq i8* %9, null
%11 = ptrtoint i8* %9 to i64
%12 = ptrtoint i64* %5 to i64
%13 = sub i64 %11, %12
%14 = trunc i64 %13 to i32
%15 = add i32 %14, -3
%16 = select i1 %10, i32 0, i32 %15
%17 = call i8* @strchr(i8* %8, i8 signext %2)
%18 = icmp eq i8* %17, null
%19 = ptrtoint i8* %17 to i64
%20 = ptrtoint i64* %6 to i64
%21 = sub i64 %19, %20
%22 = trunc i64 %21 to i32
%23 = add i32 %22, -3
%24 = select i1 %18, i32 %16, i32 %23
%25 = load double, double* %0
%26 = getelementptr inbounds double, double* %3, i64 1
%27 = load double, double* %26
%28 = fadd double %27, 0x3FFF47AEFCC7DA00
%29 = sitofp i32 %24 to double
%30 = fmul double %28, %29
%31 = sitofp i32 %1 to double
%32 = fmul double %30, %31
%33 = fdiv double %32, 1.000000e+02
%34 = fadd double %25, %33
store double %34, double* %0
ret i32 1
}