#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*/ cdoAbort(char *);
int gridInqType(int);
int vlistInqVarGrid(int, int);
int vlistNvars(int);
void nospec(int vlistID) {
  int gridID, gridtype;
  int varID, nvars;
  nvars = vlistNvars(vlistID);
  for (varID = 0; varID < nvars; varID++) {
    gridID = vlistInqVarGrid(vlistID, varID);
    gridtype = gridInqType(gridID);
    if (gridtype == 5)
      cdoAbort("Operator not defined for spectral fields");
  }
}


x86 assembly (clang, -O0):
<nospec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <vlistNvars@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11ab <nospec+0x6b>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <vlistInqVarGrid@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <gridInqType@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jne    1198 <nospec+0x58>
lea    0xe6d(%rip),%rdi
call   1050 <cdoAbort@plt>
jmp    119d <nospec+0x5d>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115d <nospec+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nospec>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
call   1040 <vlistNvars@plt>
test   %eax,%eax
jle    1187 <nospec+0x47>
mov    %eax,%ebp
xor    %ebx,%ebx
lea    0xea2(%rip),%r15
jmp    1167 <nospec+0x27>
add    $0x1,%ebx
cmp    %ebx,%ebp
je     1187 <nospec+0x47>
mov    %r14d,%edi
mov    %ebx,%esi
call   1030 <vlistInqVarGrid@plt>
mov    %eax,%edi
call   1060 <gridInqType@plt>
cmp    $0x5,%eax
jne    1160 <nospec+0x20>
mov    %r15,%rdi
call   1050 <cdoAbort@plt>
jmp    1160 <nospec+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [41 x i8] c"Operator not defined for spectral fields\00"
define void @nospec(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @vlistNvars(i32 %7)
store i32 %8, i32* %6
store i32 0, i32* %5
br label %9
9: ; preds = %24, %1
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %27
13: ; preds = %9
%14 = load i32, i32* %2
%15 = load i32, i32* %5
%16 = call i32 @vlistInqVarGrid(i32 %14, i32 %15)
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = call i32 @gridInqType(i32 %17)
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 5
br i1 %20, label %21, label %23
21: ; preds = %13
%22 = call i32 @cdoAbort(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %23
23: ; preds = %21, %13
br label %24
24: ; preds = %23
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %9
27: ; preds = %9
ret void
}

LLVM IR (-O2):
@.str = [41 x i8] c"Operator not defined for spectral fields\00"
define void @nospec(i32 %0) {
%2 = tail call i32 @vlistNvars(i32 %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %14
4: ; preds = %1, %11
%5 = phi i32 [ %12, %11 ], [ 0, %1 ]
%6 = tail call i32 @vlistInqVarGrid(i32 %0, i32 %5)
%7 = tail call i32 @gridInqType(i32 %6)
%8 = icmp eq i32 %7, 5
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = tail call i32 @cdoAbort(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %4, %9
%12 = add nuw nsw i32 %5, 1
%13 = icmp eq i32 %12, %2
br i1 %13, label %14, label %4
14: ; preds = %11, %1
ret void
}