#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 */
int /*<<< orphan*/ cdoWarning(char *, char const *, char const *);
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char const *, char *, int /*<<< orphan*/);
void grid_to_degree(const char *units, long nvals, double *restrict values,
                    const char *description) {
  if ((strncmp(units, "radian", strlen("radian"))) == 0) {
    for (long n = 0; n < nvals; ++n)
      values[n] *= (180. / 3.14159265358979323846);
  } else if ((strncmp(units, "degree", strlen("degree"))) == 0) {
  } else {
    cdoWarning(
        "Unknown units [%s] supplied for %s; proceeding assuming degress!",
        units, description);
  }
}


x86 assembly (clang, -O0):
<grid_to_degree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    0xeb1(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%edx
lea    0xe9f(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11be <grid_to_degree+0x8e>
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    11b9 <grid_to_degree+0x89>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
movsd  0xe62(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1180 <grid_to_degree+0x50>
jmp    120c <grid_to_degree+0xdc>
mov    -0x8(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    0xe42(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x38(%rbp),%rdi
mov    %eax,%edx
lea    0xe30(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11f3 <grid_to_degree+0xc3>
jmp    1207 <grid_to_degree+0xd7>
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe14(%rip),%rdi
call   1050 <cdoWarning@plt>
jmp    120c <grid_to_degree+0xdc>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grid_to_degree>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r15
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r12
lea    0xecc(%rip),%r13
mov    %r13,%rdi
call   1040 <strlen@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11a6 <grid_to_degree+0x76>
lea    0xeb2(%rip),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1287 <grid_to_degree+0x157>
lea    0xe94(%rip),%rdi
mov    %r12,%rsi
mov    %r15,%rdx
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1050 <cdoWarning@plt>
test   %r14,%r14
jle    1287 <grid_to_degree+0x157>
cmp    $0x4,%r14
jae    11bc <grid_to_degree+0x8c>
xor    %eax,%eax
jmp    1268 <grid_to_degree+0x138>
mov    %r14,%rax
and    $0xfffffffffffffffc,%rax
lea    -0x4(%rax),%rcx
mov    %rcx,%rdx
shr    $0x2,%rdx
add    $0x1,%rdx
test   %rcx,%rcx
je     1291 <grid_to_degree+0x161>
mov    %rdx,%rsi
and    $0xfffffffffffffffe,%rsi
xor    %ecx,%ecx
movapd 0xe14(%rip),%xmm0
nopl   0x0(%rax)
movupd (%rbx,%rcx,8),%xmm1
movupd 0x10(%rbx,%rcx,8),%xmm2
movupd 0x20(%rbx,%rcx,8),%xmm3
movupd 0x30(%rbx,%rcx,8),%xmm4
mulpd  %xmm0,%xmm1
mulpd  %xmm0,%xmm2
movupd %xmm1,(%rbx,%rcx,8)
movupd %xmm2,0x10(%rbx,%rcx,8)
mulpd  %xmm0,%xmm3
mulpd  %xmm0,%xmm4
movupd %xmm3,0x20(%rbx,%rcx,8)
movupd %xmm4,0x30(%rbx,%rcx,8)
add    $0x8,%rcx
add    $0xfffffffffffffffe,%rsi
jne    11f0 <grid_to_degree+0xc0>
test   $0x1,%dl
je     1263 <grid_to_degree+0x133>
movupd (%rbx,%rcx,8),%xmm0
movupd 0x10(%rbx,%rcx,8),%xmm1
movapd 0xdb0(%rip),%xmm2
mulpd  %xmm2,%xmm0
mulpd  %xmm2,%xmm1
movupd %xmm0,(%rbx,%rcx,8)
movupd %xmm1,0x10(%rbx,%rcx,8)
cmp    %r14,%rax
je     1287 <grid_to_degree+0x157>
movsd  0xda0(%rip),%xmm0
movsd  (%rbx,%rax,8),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rbx,%rax,8)
add    $0x1,%rax
cmp    %rax,%r14
jne    1270 <grid_to_degree+0x140>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
xor    %ecx,%ecx
test   $0x1,%dl
jne    123d <grid_to_degree+0x10d>
jmp    1263 <grid_to_degree+0x133>

LLVM IR (-O0):
@.str = [7 x i8] c"radian\00"
@.str.1 = [7 x i8] c"degree\00"
@.str.2 = [65 x i8] c"Unknown units [%s] supplied for %s; proceeding assuming degress!\00"
define void @grid_to_degree(i8* %0, i64 %1, double* noalias %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca double*
%8 = alloca i8*
%9 = alloca i64
store i8* %0, i8** %5
store i64 %1, i64* %6
store double* %2, double** %7
store i8* %3, i8** %8
%10 = load i8*, i8** %5
%11 = call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%12 = call i64 @strncmp(i8* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %29
14: ; preds = %4
store i64 0, i64* %9
br label %15
15: ; preds = %25, %14
%16 = load i64, i64* %9
%17 = load i64, i64* %6
%18 = icmp slt i64 %16, %17
br i1 %18, label %19, label %28
19: ; preds = %15
%20 = load double*, double** %7
%21 = load i64, i64* %9
%22 = getelementptr inbounds double, double* %20, i64 %21
%23 = load double, double* %22
%24 = fmul double %23, 0x404CA5DC1A63C1F8
store double %24, double* %22
br label %25
25: ; preds = %19
%26 = load i64, i64* %9
%27 = add nsw i64 %26, 1
store i64 %27, i64* %9
br label %15
28: ; preds = %15
br label %40
29: ; preds = %4
%30 = load i8*, i8** %5
%31 = call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%32 = call i64 @strncmp(i8* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %29
br label %39
35: ; preds = %29
%36 = load i8*, i8** %5
%37 = load i8*, i8** %8
%38 = call i32 @cdoWarning(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0), i8* %36, i8* %37)
br label %39
39: ; preds = %35, %34
br label %40
40: ; preds = %39, %28
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"radian\00"
@.str.1 = [7 x i8] c"degree\00"
@.str.2 = [65 x i8] c"Unknown units [%s] supplied for %s; proceeding assuming degress!\00"
define void @grid_to_degree(i8* %0, i64 %1, double* noalias nocapture %2, i8* %3) {
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%6 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %73
8: ; preds = %4
%9 = icmp sgt i64 %1, 0
br i1 %9, label %10, label %79
10: ; preds = %8
%11 = icmp ult i64 %1, 4
br i1 %11, label %64, label %12
12: ; preds = %10
%13 = and i64 %1, -4
%14 = add i64 %13, -4
%15 = lshr exact i64 %14, 2
%16 = add nuw nsw i64 %15, 1
%17 = and i64 %16, 1
%18 = icmp eq i64 %14, 0
br i1 %18, label %48, label %19
19: ; preds = %12
%20 = and i64 %16, 9223372036854775806
br label %21
21: ; preds = %21, %19
%22 = phi i64 [ 0, %19 ], [ %45, %21 ]
%23 = phi i64 [ 0, %19 ], [ %46, %21 ]
%24 = getelementptr inbounds double, double* %2, i64 %22
%25 = bitcast double* %24 to <2 x double>*
%26 = load <2 x double>, <2 x double>* %25
%27 = getelementptr inbounds double, double* %24, i64 2
%28 = bitcast double* %27 to <2 x double>*
%29 = load <2 x double>, <2 x double>* %28
%30 = fmul <2 x double> %26, <double 0x404CA5DC1A63C1F8, double 0x404CA5DC1A63C1F8>
%31 = fmul <2 x double> %29, <double 0x404CA5DC1A63C1F8, double 0x404CA5DC1A63C1F8>
%32 = bitcast double* %24 to <2 x double>*
store <2 x double> %30, <2 x double>* %32
%33 = bitcast double* %27 to <2 x double>*
store <2 x double> %31, <2 x double>* %33
%34 = or i64 %22, 4
%35 = getelementptr inbounds double, double* %2, i64 %34
%36 = bitcast double* %35 to <2 x double>*
%37 = load <2 x double>, <2 x double>* %36
%38 = getelementptr inbounds double, double* %35, i64 2
%39 = bitcast double* %38 to <2 x double>*
%40 = load <2 x double>, <2 x double>* %39
%41 = fmul <2 x double> %37, <double 0x404CA5DC1A63C1F8, double 0x404CA5DC1A63C1F8>
%42 = fmul <2 x double> %40, <double 0x404CA5DC1A63C1F8, double 0x404CA5DC1A63C1F8>
%43 = bitcast double* %35 to <2 x double>*
store <2 x double> %41, <2 x double>* %43
%44 = bitcast double* %38 to <2 x double>*
store <2 x double> %42, <2 x double>* %44
%45 = add nuw i64 %22, 8
%46 = add i64 %23, 2
%47 = icmp eq i64 %46, %20
br i1 %47, label %48, label %21
48: ; preds = %21, %12
%49 = phi i64 [ 0, %12 ], [ %45, %21 ]
%50 = icmp eq i64 %17, 0
br i1 %50, label %62, label %51
51: ; preds = %48
%52 = getelementptr inbounds double, double* %2, i64 %49
%53 = bitcast double* %52 to <2 x double>*
%54 = load <2 x double>, <2 x double>* %53
%55 = getelementptr inbounds double, double* %52, i64 2
%56 = bitcast double* %55 to <2 x double>*
%57 = load <2 x double>, <2 x double>* %56
%58 = fmul <2 x double> %54, <double 0x404CA5DC1A63C1F8, double 0x404CA5DC1A63C1F8>
%59 = fmul <2 x double> %57, <double 0x404CA5DC1A63C1F8, double 0x404CA5DC1A63C1F8>
%60 = bitcast double* %52 to <2 x double>*
store <2 x double> %58, <2 x double>* %60
%61 = bitcast double* %55 to <2 x double>*
store <2 x double> %59, <2 x double>* %61
br label %62
62: ; preds = %48, %51
%63 = icmp eq i64 %13, %1
br i1 %63, label %79, label %64
64: ; preds = %10, %62
%65 = phi i64 [ 0, %10 ], [ %13, %62 ]
br label %66
66: ; preds = %64, %66
%67 = phi i64 [ %71, %66 ], [ %65, %64 ]
%68 = getelementptr inbounds double, double* %2, i64 %67
%69 = load double, double* %68
%70 = fmul double %69, 0x404CA5DC1A63C1F8
store double %70, double* %68
%71 = add nuw nsw i64 %67, 1
%72 = icmp eq i64 %71, %1
br i1 %72, label %79, label %66
73: ; preds = %4
%74 = tail call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%75 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %74)
%76 = icmp eq i64 %75, 0
br i1 %76, label %79, label %77
77: ; preds = %73
%78 = tail call i32 @cdoWarning(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %3)
br label %79
79: ; preds = %66, %62, %8, %77, %73
ret void
}