#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*/ deb_printf(int /*<<< orphan*/, char *);
int dms_to_degrees(char *, double *);
int scan_dec(double *d, char *val) {
  int ret;
  double v;
  ret = dms_to_degrees(val, &v);
  if (!ret) {
    return -1;
  }
  if (v > 90.0 || v < -90.0) {
    deb_printf(0, "DEC value is too large, ignoring\n");
    return -1;
  }
  *d = v;
  return 0;
}


x86 assembly (clang, -O0):
<scan_dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <dms_to_degrees@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1156 <scan_dec+0x36>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ae <scan_dec+0x8e>
movsd  -0x28(%rbp),%xmm0
movsd  0xe9d(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     1180 <scan_dec+0x60>
movsd  0xe93(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    119a <scan_dec+0x7a>
xor    %edi,%edi
lea    0xe87(%rip),%rsi
call   1040 <deb_printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ae <scan_dec+0x8e>
movsd  -0x28(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scan_dec>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rax
mov    %rdi,%r14
mov    %rsp,%rsi
mov    %rax,%rdi
call   1030 <dms_to_degrees@plt>
mov    $0xffffffff,%ebx
test   %eax,%eax
je     1172 <scan_dec+0x52>
movsd  (%rsp),%xmm0
ucomisd 0xeb5(%rip),%xmm0
ja     1164 <scan_dec+0x44>
movsd  0xeb3(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     1164 <scan_dec+0x44>
movsd  %xmm0,(%r14)
xor    %ebx,%ebx
jmp    1172 <scan_dec+0x52>
lea    0xea5(%rip),%rsi
xor    %edi,%edi
call   1040 <deb_printf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [34 x i8] c"DEC value is too large, ignoring\0A\00"
define i32 @scan_dec(double* %0, i8* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca double
store double* %0, double** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %5
%9 = call i32 @dms_to_degrees(i8* %8, double* %7)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %2
store i32 -1, i32* %3
br label %24
13: ; preds = %2
%14 = load double, double* %7
%15 = fcmp ogt double %14, 9.000000e+01
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = load double, double* %7
%18 = fcmp olt double %17, -9.000000e+01
br i1 %18, label %19, label %21
19: ; preds = %16, %13
%20 = call i32 @deb_printf(i32 0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %24
21: ; preds = %16
%22 = load double, double* %7
%23 = load double*, double** %4
store double %22, double* %23
store i32 0, i32* %3
br label %24
24: ; preds = %21, %19, %12
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@.str = [34 x i8] c"DEC value is too large, ignoring\0A\00"
define i32 @scan_dec(double* nocapture writeonly %0, i8* %1) {
%3 = alloca double
%4 = bitcast double* %3 to i8*
%5 = call i32 @dms_to_degrees(i8* %1, double* %3)
%6 = icmp eq i32 %5, 0
br i1 %6, label %15, label %7
7: ; preds = %2
%8 = load double, double* %3
%9 = fcmp ogt double %8, 9.000000e+01
%10 = fcmp olt double %8, -9.000000e+01
%11 = or i1 %9, %10
br i1 %11, label %12, label %14
12: ; preds = %7
%13 = call i32 @deb_printf(i32 0, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %15
14: ; preds = %7
store double %8, double* %0
br label %15
15: ; preds = %2, %14, %12
%16 = phi i32 [ -1, %12 ], [ 0, %14 ], [ -1, %2 ]
ret i32 %16
}