#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 */
struct field_def {
  int dummy;
};

/* Variables and functions */
scalar_t__ is_destroyable_field(struct field_def *);
struct field_def **_get_destroyable_field(struct field_def **f,
                                          struct field_def **end) {
  for (; f < end; f++) {
    if (is_destroyable_field(*f))
      return f;
  }
  return NULL;
}


x86 assembly (clang, -O0):
<_get_destroyable_field>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1167 <_get_destroyable_field+0x57>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <is_destroyable_field@plt>
cmp    $0x0,%rax
je     1151 <_get_destroyable_field+0x41>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116f <_get_destroyable_field+0x5f>
jmp    1156 <_get_destroyable_field+0x46>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <_get_destroyable_field+0x10>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_get_destroyable_field>:
push   %r14
push   %rbx
push   %rax
cmp    %rsi,%rdi
jae    1136 <_get_destroyable_field+0x26>
mov    %rsi,%r14
mov    %rdi,%rbx
nop
mov    (%rbx),%rdi
call   1030 <is_destroyable_field@plt>
test   %rax,%rax
jne    1138 <_get_destroyable_field+0x28>
add    $0x8,%rbx
cmp    %r14,%rbx
jb     1120 <_get_destroyable_field+0x10>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.field_def = type { i32 }
define %struct.field_def** @_get_destroyable_field(%struct.field_def** %0, %struct.field_def** %1) {
%3 = alloca %struct.field_def**
%4 = alloca %struct.field_def**
%5 = alloca %struct.field_def**
store %struct.field_def** %0, %struct.field_def*** %4
store %struct.field_def** %1, %struct.field_def*** %5
br label %6
6: ; preds = %18, %2
%7 = load %struct.field_def**, %struct.field_def*** %4
%8 = load %struct.field_def**, %struct.field_def*** %5
%9 = icmp ult %struct.field_def** %7, %8
br i1 %9, label %10, label %21
10: ; preds = %6
%11 = load %struct.field_def**, %struct.field_def*** %4
%12 = load %struct.field_def*, %struct.field_def** %11
%13 = call i64 @is_destroyable_field(%struct.field_def* %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %10
%16 = load %struct.field_def**, %struct.field_def*** %4
store %struct.field_def** %16, %struct.field_def*** %3
br label %22
17: ; preds = %10
br label %18
18: ; preds = %17
%19 = load %struct.field_def**, %struct.field_def*** %4
%20 = getelementptr inbounds %struct.field_def*, %struct.field_def** %19, i32 1
store %struct.field_def** %20, %struct.field_def*** %4
br label %6
21: ; preds = %6
store %struct.field_def** null, %struct.field_def*** %3
br label %22
22: ; preds = %21, %15
%23 = load %struct.field_def**, %struct.field_def*** %3
ret %struct.field_def** %23
}

LLVM IR (-O2):
%struct.field_def = type { i32 }
define %struct.field_def** @_get_destroyable_field(%struct.field_def** %0, %struct.field_def** readnone %1) {
%3 = icmp ult %struct.field_def** %0, %1
br i1 %3, label %4, label %12
4: ; preds = %2, %9
%5 = phi %struct.field_def** [ %10, %9 ], [ %0, %2 ]
%6 = load %struct.field_def*, %struct.field_def** %5
%7 = tail call i64 @is_destroyable_field(%struct.field_def* %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = getelementptr inbounds %struct.field_def*, %struct.field_def** %5, i64 1
%11 = icmp ult %struct.field_def** %10, %1
br i1 %11, label %4, label %12
12: ; preds = %4, %9, %2
%13 = phi %struct.field_def** [ null, %2 ], [ null, %9 ], [ %5, %4 ]
ret %struct.field_def** %13
}