#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 scalar_t__ wint_t;
struct pane {
  int dummy;
};
struct mark {
  int dummy;
};

/* Variables and functions */
scalar_t__ WEOF;
scalar_t__ doc_following(struct pane *, struct mark *);
int /*<<< orphan*/ doc_next(struct pane *, struct mark *);
int from_b64(scalar_t__);
int /*<<< orphan*/ is_b64(scalar_t__);
int get_b64_x(struct pane *p, struct mark *m) {
  wint_t c;
  while ((c = doc_following(p, m)) != WEOF && !is_b64(c))
    doc_next(p, m);
  if (c == WEOF)
    return WEOF;
  return from_b64(c);
}


x86 assembly (clang, -O0):
<get_b64_x>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <doc_following@plt>
mov    %rax,%rcx
mov    %rcx,-0x20(%rbp)
xor    %eax,%eax
mov    0x2e73(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x21(%rbp)
je     118d <get_b64_x+0x4d>
mov    -0x20(%rbp),%rdi
call   1060 <is_b64@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    119d <get_b64_x+0x5d>
jmp    11af <get_b64_x+0x6f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <doc_next@plt>
jmp    1150 <get_b64_x+0x10>
mov    -0x20(%rbp),%rax
mov    0x2e26(%rip),%rcx
cmp    (%rcx),%rax
jne    11d5 <get_b64_x+0x95>
mov    0x2e16(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x4(%rbp)
jmp    11e1 <get_b64_x+0xa1>
mov    -0x20(%rbp),%rdi
call   1040 <from_b64@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_b64_x>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
call   1030 <doc_following@plt>
mov    %rax,%rbx
mov    0x2e83(%rip),%r12
cmp    (%r12),%rax
jne    1170 <get_b64_x+0x30>
mov    %rbx,%rax
jmp    11a6 <get_b64_x+0x66>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1060 <is_b64@plt>
test   %eax,%eax
jne    119d <get_b64_x+0x5d>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <doc_next@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <doc_following@plt>
mov    %rax,%rbx
cmp    (%r12),%rax
jne    1170 <get_b64_x+0x30>
jmp    11a6 <get_b64_x+0x66>
mov    (%r12),%rax
cmp    %rax,%rbx
jne    11b2 <get_b64_x+0x72>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <from_b64@plt>

LLVM IR (-O0):
%struct.pane = type { i32 }
%struct.mark = type { i32 }
@WEOF = global i64 0
define i32 @get_b64_x(%struct.pane* %0, %struct.mark* %1) {
%3 = alloca i32
%4 = alloca %struct.pane*
%5 = alloca %struct.mark*
%6 = alloca i64
store %struct.pane* %0, %struct.pane** %4
store %struct.mark* %1, %struct.mark** %5
br label %7
7: ; preds = %20, %2
%8 = load %struct.pane*, %struct.pane** %4
%9 = load %struct.mark*, %struct.mark** %5
%10 = call i64 @doc_following(%struct.pane* %8, %struct.mark* %9)
store i64 %10, i64* %6
%11 = load i64, i64* @WEOF
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %18
13: ; preds = %7
%14 = load i64, i64* %6
%15 = call i32 @is_b64(i64 %14)
%16 = icmp ne i32 %15, 0
%17 = xor i1 %16, true
br label %18
18: ; preds = %13, %7
%19 = phi i1 [ false, %7 ], [ %17, %13 ]
br i1 %19, label %20, label %24
20: ; preds = %18
%21 = load %struct.pane*, %struct.pane** %4
%22 = load %struct.mark*, %struct.mark** %5
%23 = call i32 @doc_next(%struct.pane* %21, %struct.mark* %22)
br label %7
24: ; preds = %18
%25 = load i64, i64* %6
%26 = load i64, i64* @WEOF
%27 = icmp eq i64 %25, %26
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = load i64, i64* @WEOF
%30 = trunc i64 %29 to i32
store i32 %30, i32* %3
br label %34
31: ; preds = %24
%32 = load i64, i64* %6
%33 = call i32 @from_b64(i64 %32)
store i32 %33, i32* %3
br label %34
34: ; preds = %31, %28
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
%struct.pane = type { i32 }
%struct.mark = type { i32 }
@WEOF = global i64 0
define i32 @get_b64_x(%struct.pane* %0, %struct.mark* %1) {
%3 = tail call i64 @doc_following(%struct.pane* %0, %struct.mark* %1)
%4 = load i64, i64* @WEOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %18, label %6
6: ; preds = %2, %10
%7 = phi i64 [ %12, %10 ], [ %3, %2 ]
%8 = tail call i32 @is_b64(i64 %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = tail call i32 @doc_next(%struct.pane* %0, %struct.mark* %1)
%12 = tail call i64 @doc_following(%struct.pane* %0, %struct.mark* %1)
%13 = load i64, i64* @WEOF
%14 = icmp eq i64 %12, %13
br i1 %14, label %18, label %6
15: ; preds = %6
%16 = load i64, i64* @WEOF
%17 = icmp eq i64 %7, %16
br i1 %17, label %18, label %21
18: ; preds = %10, %2, %15
%19 = phi i64 [ %16, %15 ], [ %3, %2 ], [ %12, %10 ]
%20 = trunc i64 %19 to i32
br label %23
21: ; preds = %15
%22 = tail call i32 @from_b64(i64 %7)
br label %23
23: ; preds = %21, %18
%24 = phi i32 [ %20, %18 ], [ %22, %21 ]
ret i32 %24
}