#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 */

/* Variables and functions */
int mjson_base64_dec(char const *, int, char *, int);
int mjson_find(char const *, int, char const *, char const **, int *);
int mjson_get_base64(const char *s, int len, const char *path, char *to,
                     int n) {
  const char *p;
  int sz;
  if (mjson_find(s, len, path, &p, &sz) != 11)
    return 0;
  return mjson_base64_dec(p + 1, sz - 2, to, n);
}


x86 assembly (clang, -O0):
<mjson_get_base64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
lea    -0x38(%rbp),%rcx
lea    -0x3c(%rbp),%r8
call   1030 <mjson_find@plt>
cmp    $0xb,%eax
je     1168 <mjson_get_base64+0x48>
movl   $0x0,-0x4(%rbp)
jmp    1185 <mjson_get_base64+0x65>
mov    -0x38(%rbp),%rdi
add    $0x1,%rdi
mov    -0x3c(%rbp),%esi
sub    $0x2,%esi
mov    -0x28(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
call   1040 <mjson_base64_dec@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mjson_get_base64>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %r8d,%ebp
mov    %rcx,%rbx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
call   1030 <mjson_find@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xb,%ecx
jne    115e <mjson_get_base64+0x3e>
mov    0x10(%rsp),%rdi
add    $0x1,%rdi
mov    0xc(%rsp),%esi
add    $0xfffffffe,%esi
mov    %rbx,%rdx
mov    %ebp,%ecx
call   1040 <mjson_base64_dec@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @mjson_get_base64(i8* %0, i32 %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i32 %4, i32* %11
%14 = load i8*, i8** %7
%15 = load i32, i32* %8
%16 = load i8*, i8** %9
%17 = call i32 @mjson_find(i8* %14, i32 %15, i8* %16, i8** %12, i32* %13)
%18 = icmp ne i32 %17, 11
br i1 %18, label %19, label %20
19: ; preds = %5
store i32 0, i32* %6
br label %28
20: ; preds = %5
%21 = load i8*, i8** %12
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i32, i32* %13
%24 = sub nsw i32 %23, 2
%25 = load i8*, i8** %10
%26 = load i32, i32* %11
%27 = call i32 @mjson_base64_dec(i8* %22, i32 %24, i8* %25, i32 %26)
store i32 %27, i32* %6
br label %28
28: ; preds = %20, %19
%29 = load i32, i32* %6
ret i32 %29
}

LLVM IR (-O2):
define i32 @mjson_get_base64(i8* %0, i32 %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = bitcast i8** %6 to i8*
%9 = bitcast i32* %7 to i8*
%10 = call i32 @mjson_find(i8* %0, i32 %1, i8* %2, i8** %6, i32* %7)
%11 = icmp eq i32 %10, 11
br i1 %11, label %12, label %18
12: ; preds = %5
%13 = load i8*, i8** %6
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = load i32, i32* %7
%16 = add nsw i32 %15, -2
%17 = call i32 @mjson_base64_dec(i8* %14, i32 %16, i8* %3, i32 %4)
br label %18
18: ; preds = %5, %12
%19 = phi i32 [ %17, %12 ], [ 0, %5 ]
ret i32 %19
}