#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 */
typedef int /*<<< orphan*/ wint_t;
struct pane {
  int dummy;
};
struct mark {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ WEOF;
int /*<<< orphan*/ doc_following(struct pane *, struct mark *);
int /*<<< orphan*/ doc_prior(struct pane *, struct mark *);
wint_t doc_pending(struct pane *p, struct mark *m, int n) {
  if (n > 0)
    return doc_following(p, m);
  if (n < 0)
    return doc_prior(p, m);
  return WEOF;
}


x86 assembly (clang, -O0):
<doc_pending>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    1152 <doc_pending+0x32>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <doc_following@plt>
mov    %eax,-0x4(%rbp)
jmp    117d <doc_pending+0x5d>
cmpl   $0x0,-0x1c(%rbp)
jge    1171 <doc_pending+0x51>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <doc_prior@plt>
mov    %eax,-0x4(%rbp)
jmp    117d <doc_pending+0x5d>
mov    0x2e68(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doc_pending>:
test   %edx,%edx
jle    1129 <doc_pending+0x9>
jmp    1040 <doc_following@plt>
js     1135 <doc_pending+0x15>
mov    0x2eae(%rip),%rax
mov    (%rax),%eax
ret
jmp    1030 <doc_prior@plt>

LLVM IR (-O0):
%struct.pane = type { i32 }
%struct.mark = type { i32 }
@WEOF = global i32 0
define i32 @doc_pending(%struct.pane* %0, %struct.mark* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %struct.pane*
%6 = alloca %struct.mark*
%7 = alloca i32
store %struct.pane* %0, %struct.pane** %5
store %struct.mark* %1, %struct.mark** %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load %struct.pane*, %struct.pane** %5
%12 = load %struct.mark*, %struct.mark** %6
%13 = call i32 @doc_following(%struct.pane* %11, %struct.mark* %12)
store i32 %13, i32* %4
br label %23
14: ; preds = %3
%15 = load i32, i32* %7
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = load %struct.pane*, %struct.pane** %5
%19 = load %struct.mark*, %struct.mark** %6
%20 = call i32 @doc_prior(%struct.pane* %18, %struct.mark* %19)
store i32 %20, i32* %4
br label %23
21: ; preds = %14
%22 = load i32, i32* @WEOF
store i32 %22, i32* %4
br label %23
23: ; preds = %21, %17, %10
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
%struct.pane = type { i32 }
%struct.mark = type { i32 }
@WEOF = global i32 0
define i32 @doc_pending(%struct.pane* %0, %struct.mark* %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @doc_following(%struct.pane* %0, %struct.mark* %1)
br label %13
7: ; preds = %3
%8 = icmp slt i32 %2, 0
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 @doc_prior(%struct.pane* %0, %struct.mark* %1)
br label %13
11: ; preds = %7
%12 = load i32, i32* @WEOF
br label %13
13: ; preds = %11, %9, %5
%14 = phi i32 [ %6, %5 ], [ %10, %9 ], [ %12, %11 ]
ret i32 %14
}