#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 *);
scalar_t__ doc_next(struct pane *, struct mark *);
int from_b64(scalar_t__);
int /*<<< orphan*/ is_b64(scalar_t__);
int get_b64(struct pane *p, struct mark *m) {
  wint_t c;
  int ret;
  do {
    c = doc_next(p, m);
  } while (c != WEOF && !is_b64(c));
  if (c == WEOF)
    return WEOF;
  ret = from_b64(c);
  while ((c = doc_following(p, m)) != WEOF && !is_b64(c))
    doc_next(p, m);
  return ret;
}


x86 assembly (clang, -O0):
<get_b64>:
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   1050 <doc_next@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
mov    0x2e72(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x25(%rbp)
je     118e <get_b64+0x4e>
mov    -0x20(%rbp),%rdi
call   1060 <is_b64@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    1150 <get_b64+0x10>
mov    -0x20(%rbp),%rax
mov    0x2e3c(%rip),%rcx
cmp    (%rcx),%rax
jne    11bf <get_b64+0x7f>
mov    0x2e2c(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x4(%rbp)
jmp    1230 <get_b64+0xf0>
mov    -0x20(%rbp),%rdi
call   1040 <from_b64@plt>
mov    %eax,-0x24(%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    0x2df8(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x26(%rbp)
je     1208 <get_b64+0xc8>
mov    -0x20(%rbp),%rdi
call   1060 <is_b64@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x26(%rbp)
mov    -0x26(%rbp),%al
test   $0x1,%al
jne    1218 <get_b64+0xd8>
jmp    122a <get_b64+0xea>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <doc_next@plt>
jmp    11cb <get_b64+0x8b>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_b64>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    0x2e8b(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <doc_next@plt>
mov    %rax,%rbx
cmp    (%r12),%rax
je     1186 <get_b64+0x46>
mov    %rbx,%rdi
call   1060 <is_b64@plt>
test   %eax,%eax
je     1160 <get_b64+0x20>
cmp    (%r12),%rbx
jne    1194 <get_b64+0x54>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
mov    %rbx,%rdi
call   1040 <from_b64@plt>
mov    %eax,%ebx
xchg   %ax,%ax
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <doc_following@plt>
cmp    (%r12),%rax
je     1186 <get_b64+0x46>
mov    %rax,%rdi
call   1060 <is_b64@plt>
test   %eax,%eax
jne    1186 <get_b64+0x46>
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <doc_next@plt>
jmp    11a0 <get_b64+0x60>

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

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