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


x86 assembly (clang, -O0):
<grid_to_radian>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    0xea1(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    %eax,%edx
lea    0xe8f(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11a2 <grid_to_radian+0x62>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
movsd  0xe68(%rip),%xmm0
call   1050 <scale_vec@plt>
jmp    11f0 <grid_to_radian+0xb0>
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    0xe5e(%rip),%rdi
call   1040 <strlen@plt>
mov    -0x30(%rbp),%rdi
mov    %eax,%edx
lea    0xe4c(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11d7 <grid_to_radian+0x97>
jmp    11eb <grid_to_radian+0xab>
mov    -0x8(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe30(%rip),%rdi
call   1060 <cdoWarning@plt>
jmp    11f0 <grid_to_radian+0xb0>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grid_to_radian>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
lea    0xeac(%rip),%r13
mov    %r13,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11b2 <grid_to_radian+0x72>
lea    0xe92(%rip),%r15
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     11ce <grid_to_radian+0x8e>
lea    0xe78(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1060 <cdoWarning@plt>
movsd  0xe46(%rip),%xmm0
mov    %r12,%rdi
mov    %r15,%rsi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1050 <scale_vec@plt>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"degree\00"
@.str.1 = [7 x i8] c"radian\00"
@.str.2 = [65 x i8] c"Unknown units [%s] supplied for %s; proceeding assuming radians!\00"
define void @grid_to_radian(i8* %0, i64 %1, double* noalias %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca double*
%8 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store double* %2, double** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%11 = call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %4
%14 = load i64, i64* %6
%15 = load double*, double** %7
%16 = call i32 @scale_vec(double 0x3F91DF46A2529D39, i64 %14, double* %15)
br label %28
17: ; preds = %4
%18 = load i8*, i8** %5
%19 = call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%20 = call i64 @strncmp(i8* %18, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17
br label %27
23: ; preds = %17
%24 = load i8*, i8** %5
%25 = load i8*, i8** %8
%26 = call i32 @cdoWarning(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0), i8* %24, i8* %25)
br label %27
27: ; preds = %23, %22
br label %28
28: ; preds = %27, %13
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"degree\00"
@.str.1 = [7 x i8] c"radian\00"
@.str.2 = [65 x i8] c"Unknown units [%s] supplied for %s; proceeding assuming radians!\00"
define void @grid_to_radian(i8* %0, i64 %1, double* noalias %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 %10
8: ; preds = %4
%9 = tail call i32 @scale_vec(double 0x3F91DF46A2529D39, i64 %1, double* %2)
br label %16
10: ; preds = %4
%11 = tail call i32 @strlen(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = 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 %16
16: ; preds = %14, %10, %8
ret void
}