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


x86 assembly (clang, -O0):
<get_b64_rev>:
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_prev@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
xor    %eax,%eax
mov    0x2e82(%rip),%rdx
cmp    (%rdx),%rcx
mov    %al,-0x21(%rbp)
je     117e <get_b64_rev+0x4e>
mov    -0x20(%rbp),%rdi
call   1050 <is_b64@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1140 <get_b64_rev+0x10>
mov    -0x20(%rbp),%rax
mov    0x2e4c(%rip),%rcx
cmp    (%rcx),%rax
jne    11af <get_b64_rev+0x7f>
mov    0x2e3c(%rip),%rax
mov    (%rax),%rax
mov    %eax,-0x4(%rbp)
jmp    11bb <get_b64_rev+0x8b>
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_rev>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
mov    0x2e9b(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <doc_prev@plt>
mov    %rax,%rbx
cmp    (%r12),%rax
je     1176 <get_b64_rev+0x46>
mov    %rbx,%rdi
call   1050 <is_b64@plt>
test   %eax,%eax
je     1150 <get_b64_rev+0x20>
cmp    (%r12),%rbx
jne    1184 <get_b64_rev+0x54>
mov    %ebx,%eax
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_rev(%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_prev(%struct.pane* %8, %struct.mark* %9)
store i64 %10, i64* %6
br label %11
11: ; preds = %7
%12 = load i64, i64* %6
%13 = load i64, i64* @WEOF
%14 = icmp ne i64 %12, %13
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = load i64, i64* %6
%17 = call i32 @is_b64(i64 %16)
%18 = icmp ne i32 %17, 0
%19 = xor i1 %18, true
br label %20
20: ; preds = %15, %11
%21 = phi i1 [ false, %11 ], [ %19, %15 ]
br i1 %21, label %7, label %22
22: ; preds = %20
%23 = load i64, i64* %6
%24 = load i64, i64* @WEOF
%25 = icmp eq i64 %23, %24
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i64, i64* @WEOF
%28 = trunc i64 %27 to i32
store i32 %28, i32* %3
br label %32
29: ; preds = %22
%30 = load i64, i64* %6
%31 = call i32 @from_b64(i64 %30)
store i32 %31, i32* %3
br label %32
32: ; preds = %29, %26
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
%struct.pane = type { i32 }
%struct.mark = type { i32 }
@WEOF = global i64 0
define i32 @get_b64_rev(%struct.pane* %0, %struct.mark* %1) {
br label %3
3: ; preds = %7, %2
%4 = tail call i64 @doc_prev(%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 %17
15: ; preds = %10
%16 = tail call i32 @from_b64(i64 %4)
br label %17
17: ; preds = %15, %13
%18 = phi i32 [ %14, %13 ], [ %16, %15 ]
ret i32 %18
}