#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 FindjoB {
  int dummy;
};

/* Variables and functions */
int Findjob_and(struct FindjoB *, int /*<<< orphan*/);
scalar_t__ Findjob_cursor_complete(struct FindjoB *, int /*<<< orphan*/);
int Findjob_default_and(struct FindjoB *o, int flag) {
  int ret;
  if (Findjob_cursor_complete(o, 0)) {
    if (flag & 1)
      return (2);
    ret = Findjob_and(o, 0);
    if (ret <= 0)
      return (ret);
  }
  return (1);
}


x86 assembly (clang, -O0):
<Findjob_default_and>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1030 <Findjob_cursor_complete@plt>
cmp    $0x0,%rax
je     1187 <Findjob_default_and+0x67>
mov    -0x14(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     115f <Findjob_default_and+0x3f>
movl   $0x2,-0x4(%rbp)
jmp    118e <Findjob_default_and+0x6e>
mov    -0x10(%rbp),%rdi
xor    %esi,%esi
call   1040 <Findjob_and@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jg     1182 <Findjob_default_and+0x62>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118e <Findjob_default_and+0x6e>
jmp    1187 <Findjob_default_and+0x67>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Findjob_default_and>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
xor    %esi,%esi
call   1030 <Findjob_cursor_complete@plt>
test   %rax,%rax
je     114d <Findjob_default_and+0x2d>
mov    $0x2,%eax
test   $0x1,%bpl
jne    1152 <Findjob_default_and+0x32>
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <Findjob_and@plt>
test   %eax,%eax
jle    1152 <Findjob_default_and+0x32>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.FindjoB = type { i32 }
define i32 @Findjob_default_and(%struct.FindjoB* %0, i32 %1) {
%3 = alloca i32
%4 = alloca %struct.FindjoB*
%5 = alloca i32
%6 = alloca i32
store %struct.FindjoB* %0, %struct.FindjoB** %4
store i32 %1, i32* %5
%7 = load %struct.FindjoB*, %struct.FindjoB** %4
%8 = call i64 @Findjob_cursor_complete(%struct.FindjoB* %7, i32 0)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %23
10: ; preds = %2
%11 = load i32, i32* %5
%12 = and i32 %11, 1
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
store i32 2, i32* %3
br label %24
15: ; preds = %10
%16 = load %struct.FindjoB*, %struct.FindjoB** %4
%17 = call i32 @Findjob_and(%struct.FindjoB* %16, i32 0)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = icmp sle i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %15
%21 = load i32, i32* %6
store i32 %21, i32* %3
br label %24
22: ; preds = %15
br label %23
23: ; preds = %22, %2
store i32 1, i32* %3
br label %24
24: ; preds = %23, %20, %14
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
%struct.FindjoB = type { i32 }
define i32 @Findjob_default_and(%struct.FindjoB* %0, i32 %1) {
%3 = tail call i64 @Findjob_cursor_complete(%struct.FindjoB* %0, i32 0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %11, label %5
5: ; preds = %2
%6 = and i32 %1, 1
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %5
%9 = tail call i32 @Findjob_and(%struct.FindjoB* %0, i32 0)
%10 = icmp slt i32 %9, 1
br i1 %10, label %12, label %11
11: ; preds = %8, %2
br label %12
12: ; preds = %8, %5, %11
%13 = phi i32 [ 1, %11 ], [ 2, %5 ], [ %9, %8 ]
ret i32 %13
}