#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 */
scalar_t__ fabs(double const);
int /*<<< orphan*/ grib_fail(char *, char *, int);
int is_ok(double const *, long *, long, long);
long lcm(long, long);
int try(const double *val, long v[6], long *basic_angle, long *sub_division) {
  int i = 0;
  long ni, nj;
  for (i = 0; i < 6; i++)
    if (val[i] == -1e+100)
      return 0;
  if (val[4] == 0)
    return 0;
  if (val[5] == 0)
    return 0;
  ni = (long)(0.5 + fabs((val[0] - val[2]) / val[4])) + 1;
  nj = (long)(0.5 + fabs((val[1] - val[3]) / val[5])) + 1;
  *basic_angle = 360;
  *sub_division = lcm(ni, nj);
  if (*sub_division < 0)
    return 0;
  {
    if (!(*sub_division >= 0))
      grib_fail(
          "*sub_division >= 0",
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/MengbinZhu/pfldp/refs/heads/master/"
          "ropp-7.0/grib_api-1.9.9/src/grib_accessor_class_g2grid.c",
          304);
  };
  return is_ok(val, v, *basic_angle, *sub_division);
}


x86 assembly (clang, -O0):
<try>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x6,-0x2c(%rbp)
jge    11b4 <try+0x74>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xe83(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11a1 <try+0x61>
jp     11a1 <try+0x61>
movl   $0x0,-0x4(%rbp)
jmp    12ff <try+0x1bf>
jmp    11a6 <try+0x66>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1166 <try+0x26>
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11dc <try+0x9c>
jp     11dc <try+0x9c>
movl   $0x0,-0x4(%rbp)
jmp    12ff <try+0x1bf>
mov    -0x10(%rbp),%rax
movsd  0x28(%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1204 <try+0xc4>
jp     1204 <try+0xc4>
movl   $0x0,-0x4(%rbp)
jmp    12ff <try+0x1bf>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x20(%rax),%xmm0
call   1060 <fabs@plt>
cvtsi2sd %rax,%xmm1
movsd  0xdd0(%rip),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
subsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rax
divsd  0x28(%rax),%xmm0
call   1060 <fabs@plt>
cvtsi2sd %rax,%xmm1
movsd  0xd92(%rip),%xmm0
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movq   $0x168,(%rax)
mov    -0x38(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1050 <lcm@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rax
cmpq   $0x0,(%rax)
jge    12bb <try+0x17b>
movl   $0x0,-0x4(%rbp)
jmp    12ff <try+0x1bf>
mov    -0x28(%rbp),%rax
cmpq   $0x0,(%rax)
jge    12e1 <try+0x1a1>
lea    0xd40(%rip),%rdi
lea    0xd4c(%rip),%rsi
mov    $0x130,%edx
call   1030 <grib_fail@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
mov    -0x28(%rbp),%rax
mov    (%rax),%rcx
call   1040 <is_ok@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<try>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
movsd  (%rdi),%xmm0
ucomisd 0xebb(%rip),%xmm0
jne    1149 <try+0x19>
jnp    1190 <try+0x60>
mov    %rdi,%rbx
movsd  0x8(%rdi),%xmm1
ucomisd 0xea7(%rip),%xmm1
jne    115d <try+0x2d>
jnp    1190 <try+0x60>
movsd  0x10(%rbx),%xmm1
ucomisd 0xe96(%rip),%xmm1
jne    116e <try+0x3e>
jnp    1190 <try+0x60>
movsd  0x18(%rbx),%xmm2
ucomisd 0xe85(%rip),%xmm2
jne    117f <try+0x4f>
jnp    1190 <try+0x60>
movsd  0x20(%rbx),%xmm2
ucomisd 0xe74(%rip),%xmm2
jne    119c <try+0x6c>
jp     119c <try+0x6c>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
movsd  0x28(%rbx),%xmm3
ucomisd 0xe57(%rip),%xmm3
jne    11ad <try+0x7d>
jnp    1190 <try+0x60>
xorpd  %xmm4,%xmm4
ucomisd %xmm4,%xmm2
jne    11b9 <try+0x89>
jnp    1190 <try+0x60>
ucomisd %xmm4,%xmm3
jne    11c1 <try+0x91>
jnp    1190 <try+0x60>
mov    %rcx,%r12
mov    %rdx,%r15
mov    %rsi,%r14
subsd  %xmm1,%xmm0
divsd  %xmm2,%xmm0
call   1050 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0xe21(%rip),%xmm0
cvttsd2si %xmm0,%r13
add    $0x1,%r13
movsd  0x8(%rbx),%xmm0
subsd  0x18(%rbx),%xmm0
divsd  0x28(%rbx),%xmm0
call   1050 <fabs@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0xdf4(%rip),%xmm0
cvttsd2si %xmm0,%rsi
add    $0x1,%rsi
movq   $0x168,(%r15)
mov    %r13,%rdi
call   1040 <lcm@plt>
mov    %rax,(%r12)
test   %rax,%rax
js     1190 <try+0x60>
mov    (%r15),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rax,%rcx
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <is_ok@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"*sub_division >= 0\00"
@.str.1 = [182 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/MengbinZhu/pfldp/refs/heads/master/ropp-7.0/grib_api-1.9.9/src/grib_accessor_class_g2grid.c\00"
define i32 @try(double* %0, i64* %1, i64* %2, i64* %3) {
%5 = alloca i32
%6 = alloca double*
%7 = alloca i64*
%8 = alloca i64*
%9 = alloca i64*
%10 = alloca i32
%11 = alloca i64
%12 = alloca i64
store double* %0, double** %6
store i64* %1, i64** %7
store i64* %2, i64** %8
store i64* %3, i64** %9
store i32 0, i32* %10
store i32 0, i32* %10
br label %13
13: ; preds = %25, %4
%14 = load i32, i32* %10
%15 = icmp slt i32 %14, 6
br i1 %15, label %16, label %28
16: ; preds = %13
%17 = load double*, double** %6
%18 = load i32, i32* %10
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds double, double* %17, i64 %19
%21 = load double, double* %20
%22 = fcmp oeq double %21, -1.000000e+100
br i1 %22, label %23, label %24
23: ; preds = %16
store i32 0, i32* %5
br label %96
24: ; preds = %16
br label %25
25: ; preds = %24
%26 = load i32, i32* %10
%27 = add nsw i32 %26, 1
store i32 %27, i32* %10
br label %13
28: ; preds = %13
%29 = load double*, double** %6
%30 = getelementptr inbounds double, double* %29, i64 4
%31 = load double, double* %30
%32 = fcmp oeq double %31, 0.000000e+00
br i1 %32, label %33, label %34
33: ; preds = %28
store i32 0, i32* %5
br label %96
34: ; preds = %28
%35 = load double*, double** %6
%36 = getelementptr inbounds double, double* %35, i64 5
%37 = load double, double* %36
%38 = fcmp oeq double %37, 0.000000e+00
br i1 %38, label %39, label %40
39: ; preds = %34
store i32 0, i32* %5
br label %96
40: ; preds = %34
%41 = load double*, double** %6
%42 = getelementptr inbounds double, double* %41, i64 0
%43 = load double, double* %42
%44 = load double*, double** %6
%45 = getelementptr inbounds double, double* %44, i64 2
%46 = load double, double* %45
%47 = fsub double %43, %46
%48 = load double*, double** %6
%49 = getelementptr inbounds double, double* %48, i64 4
%50 = load double, double* %49
%51 = fdiv double %47, %50
%52 = call i64 @fabs(double %51)
%53 = sitofp i64 %52 to double
%54 = fadd double 5.000000e-01, %53
%55 = fptosi double %54 to i64
%56 = add nsw i64 %55, 1
store i64 %56, i64* %11
%57 = load double*, double** %6
%58 = getelementptr inbounds double, double* %57, i64 1
%59 = load double, double* %58
%60 = load double*, double** %6
%61 = getelementptr inbounds double, double* %60, i64 3
%62 = load double, double* %61
%63 = fsub double %59, %62
%64 = load double*, double** %6
%65 = getelementptr inbounds double, double* %64, i64 5
%66 = load double, double* %65
%67 = fdiv double %63, %66
%68 = call i64 @fabs(double %67)
%69 = sitofp i64 %68 to double
%70 = fadd double 5.000000e-01, %69
%71 = fptosi double %70 to i64
%72 = add nsw i64 %71, 1
store i64 %72, i64* %12
%73 = load i64*, i64** %8
store i64 360, i64* %73
%74 = load i64, i64* %11
%75 = load i64, i64* %12
%76 = call i64 @lcm(i64 %74, i64 %75)
%77 = load i64*, i64** %9
store i64 %76, i64* %77
%78 = load i64*, i64** %9
%79 = load i64, i64* %78
%80 = icmp slt i64 %79, 0
br i1 %80, label %81, label %82
81: ; preds = %40
store i32 0, i32* %5
br label %96
82: ; preds = %40
%83 = load i64*, i64** %9
%84 = load i64, i64* %83
%85 = icmp sge i64 %84, 0
br i1 %85, label %88, label %86
86: ; preds = %82
%87 = call i32 @grib_fail(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([182 x i8], [182 x i8]* @.str.1, i64 0, i64 0), i32 304)
br label %88
88: ; preds = %86, %82
%89 = load double*, double** %6
%90 = load i64*, i64** %7
%91 = load i64*, i64** %8
%92 = load i64, i64* %91
%93 = load i64*, i64** %9
%94 = load i64, i64* %93
%95 = call i32 @is_ok(double* %89, i64* %90, i64 %92, i64 %94)
store i32 %95, i32* %5
br label %96
96: ; preds = %88, %81, %39, %33, %23
%97 = load i32, i32* %5
ret i32 %97
}

LLVM IR (-O2):
define i32 @try(double* %0, i64* %1, i64* nocapture %2, i64* nocapture %3) {
%5 = load double, double* %0
%6 = fcmp oeq double %5, -1.000000e+100
br i1 %6, label %54, label %7
7: ; preds = %4
%8 = getelementptr inbounds double, double* %0, i64 1
%9 = load double, double* %8
%10 = fcmp oeq double %9, -1.000000e+100
br i1 %10, label %54, label %11
11: ; preds = %7
%12 = getelementptr inbounds double, double* %0, i64 2
%13 = load double, double* %12
%14 = fcmp oeq double %13, -1.000000e+100
br i1 %14, label %54, label %15
15: ; preds = %11
%16 = getelementptr inbounds double, double* %0, i64 3
%17 = load double, double* %16
%18 = fcmp oeq double %17, -1.000000e+100
br i1 %18, label %54, label %19
19: ; preds = %15
%20 = getelementptr inbounds double, double* %0, i64 4
%21 = load double, double* %20
%22 = fcmp oeq double %21, -1.000000e+100
br i1 %22, label %54, label %23
23: ; preds = %19
%24 = getelementptr inbounds double, double* %0, i64 5
%25 = load double, double* %24
%26 = fcmp oeq double %25, -1.000000e+100
%27 = fcmp oeq double %21, 0.000000e+00
%28 = select i1 %26, i1 true, i1 %27
%29 = fcmp oeq double %25, 0.000000e+00
%30 = or i1 %28, %29
br i1 %30, label %54, label %31
31: ; preds = %23
%32 = fsub double %5, %13
%33 = fdiv double %32, %21
%34 = tail call i64 @fabs(double %33)
%35 = sitofp i64 %34 to double
%36 = fadd double %35, 5.000000e-01
%37 = fptosi double %36 to i64
%38 = add nsw i64 %37, 1
%39 = load double, double* %8
%40 = load double, double* %16
%41 = fsub double %39, %40
%42 = load double, double* %24
%43 = fdiv double %41, %42
%44 = tail call i64 @fabs(double %43)
%45 = sitofp i64 %44 to double
%46 = fadd double %45, 5.000000e-01
%47 = fptosi double %46 to i64
%48 = add nsw i64 %47, 1
store i64 360, i64* %2
%49 = tail call i64 @lcm(i64 %38, i64 %48)
store i64 %49, i64* %3
%50 = icmp slt i64 %49, 0
br i1 %50, label %54, label %51
51: ; preds = %31
%52 = load i64, i64* %2
%53 = tail call i32 @is_ok(double* %0, i64* %1, i64 %52, i64 %49)
br label %54
54: ; preds = %4, %7, %11, %15, %19, %23, %31, %51
%55 = phi i32 [ %53, %51 ], [ 0, %31 ], [ 0, %23 ], [ 0, %19 ], [ 0, %15 ], [ 0, %11 ], [ 0, %7 ], [ 0, %4 ]
ret i32 %55
}