#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 const general_field_type(char const *, int);
int general_field_next_none(const char *general_field, int i,
                            const int general_field_len, int num,
                            const int type) {
  for (; i < general_field_len && num; i++, num--) {
    if (general_field_type(general_field, i) == type) {
      return 0;
    }
  }
  return num == 0 || i == general_field_len;
}


x86 assembly (clang, -O0):
<general_field_next_none>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x14(%rbp),%ecx
xor    %eax,%eax
cmp    -0x18(%rbp),%ecx
mov    %al,-0x21(%rbp)
jge    1144 <general_field_next_none+0x34>
cmpl   $0x0,-0x1c(%rbp)
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1154 <general_field_next_none+0x44>
jmp    1191 <general_field_next_none+0x81>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1030 <general_field_type@plt>
cmp    -0x20(%rbp),%eax
jne    1175 <general_field_next_none+0x65>
movl   $0x0,-0x4(%rbp)
jmp    11b7 <general_field_next_none+0xa7>
jmp    117a <general_field_next_none+0x6a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1129 <general_field_next_none+0x19>
mov    $0x1,%al
cmpl   $0x0,-0x1c(%rbp)
mov    %al,-0x22(%rbp)
je     11ac <general_field_next_none+0x9c>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
sete   %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<general_field_next_none>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %esi,%ebp
cmp    %edx,%esi
jge    1153 <general_field_next_none+0x43>
test   %ebx,%ebx
je     1153 <general_field_next_none+0x43>
mov    %r8d,%r15d
mov    %rdi,%r12
nopl   (%rax)
mov    %r12,%rdi
mov    %ebp,%esi
call   1030 <general_field_type@plt>
cmp    %r15d,%eax
je     1167 <general_field_next_none+0x57>
add    $0x1,%ebp
lea    -0x1(%rbx),%eax
cmp    %r14d,%ebp
jge    1155 <general_field_next_none+0x45>
cmp    $0x1,%ebx
mov    %eax,%ebx
jne    1130 <general_field_next_none+0x20>
jmp    1155 <general_field_next_none+0x45>
mov    %ebx,%eax
test   %eax,%eax
sete   %al
cmp    %r14d,%ebp
sete   %cl
or     %al,%cl
movzbl %cl,%eax
jmp    1169 <general_field_next_none+0x59>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @general_field_next_none(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
br label %12
12: ; preds = %29, %5
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32, i32* %10
%18 = icmp ne i32 %17, 0
br label %19
19: ; preds = %16, %12
%20 = phi i1 [ false, %12 ], [ %18, %16 ]
br i1 %20, label %21, label %34
21: ; preds = %19
%22 = load i8*, i8** %7
%23 = load i32, i32* %8
%24 = call i32 @general_field_type(i8* %22, i32 %23)
%25 = load i32, i32* %11
%26 = icmp eq i32 %24, %25
br i1 %26, label %27, label %28
27: ; preds = %21
store i32 0, i32* %6
br label %44
28: ; preds = %21
br label %29
29: ; preds = %28
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %8
%32 = load i32, i32* %10
%33 = add nsw i32 %32, -1
store i32 %33, i32* %10
br label %12
34: ; preds = %19
%35 = load i32, i32* %10
%36 = icmp eq i32 %35, 0
br i1 %36, label %41, label %37
37: ; preds = %34
%38 = load i32, i32* %8
%39 = load i32, i32* %9
%40 = icmp eq i32 %38, %39
br label %41
41: ; preds = %37, %34
%42 = phi i1 [ true, %34 ], [ %40, %37 ]
%43 = zext i1 %42 to i32
store i32 %43, i32* %6
br label %44
44: ; preds = %41, %27
%45 = load i32, i32* %6
ret i32 %45
}

LLVM IR (-O2):
define i32 @general_field_next_none(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = icmp slt i32 %1, %2
%7 = icmp ne i32 %3, 0
%8 = and i1 %6, %7
br i1 %8, label %9, label %20
9: ; preds = %5, %14
%10 = phi i32 [ %16, %14 ], [ %3, %5 ]
%11 = phi i32 [ %15, %14 ], [ %1, %5 ]
%12 = tail call i32 @general_field_type(i8* %0, i32 %11)
%13 = icmp eq i32 %12, %4
br i1 %13, label %27, label %14
14: ; preds = %9
%15 = add nsw i32 %11, 1
%16 = add nsw i32 %10, -1
%17 = icmp slt i32 %15, %2
%18 = icmp ne i32 %16, 0
%19 = select i1 %17, i1 %18, i1 false
br i1 %19, label %9, label %20
20: ; preds = %14, %5
%21 = phi i32 [ %1, %5 ], [ %15, %14 ]
%22 = phi i32 [ %3, %5 ], [ %16, %14 ]
%23 = icmp eq i32 %22, 0
%24 = icmp eq i32 %21, %2
%25 = select i1 %23, i1 true, i1 %24
%26 = zext i1 %25 to i32
br label %27
27: ; preds = %9, %20
%28 = phi i32 [ %26, %20 ], [ 0, %9 ]
ret i32 %28
}