#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 base64encrypt(char const *, int, char *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int strlen(char const *);
int main() {
  int buflen;
  const char *data2 = "{Type:\"1\",ToUserId:\"04f69a0e-e468 - 464e-8c0e - "
                      "a30fc00b37d7\",Amount:\"10\",Number:\"1\",Desc:"
                      "\"¹§Ï²·¢²Æ£¡\",PayPwd:\"123456\"}";
  int data2_len = strlen(data2);
  char buffer[1024];
  buflen = base64encrypt(data2, data2_len, buffer);
  printf("buflen: %d\n", buflen);
  printf("buffer: %s", buffer);
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    -0x420(%rbp),%rdx
call   1060 <base64encrypt@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x420(%rbp),%rsi
lea    0xef0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x408,%rsp
lea    0xeaf(%rip),%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r14,%rdx
call   1060 <base64encrypt@plt>
lea    0xf12(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf0e(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [130 x i8] c"{Type:\221\22,ToUserId:\2204f69a0e-e468 - 464e-8c0e - a30fc00b37d7\22,Amount:\2210\22,Number:\221\22,Desc:\22\C2\B9\C2\A7\C3\8F\C2\B2\C2\B7\C2\A2\C2\B2\C3\86\C2\A3\C2\A1\22,PayPwd:\22123456\22}\00"
@.str.1 = [12 x i8] c"buflen: %d\0A\00"
@.str.2 = [11 x i8] c"buffer: %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [1024 x i8]
store i32 0, i32* %1
store i8* getelementptr inbounds ([130 x i8], [130 x i8]* @.str, i64 0, i64 0), i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %4
%8 = load i8*, i8** %3
%9 = load i32, i32* %4
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%11 = call i32 @base64encrypt(i8* %8, i32 %9, i8* %10)
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [130 x i8] c"{Type:\221\22,ToUserId:\2204f69a0e-e468 - 464e-8c0e - a30fc00b37d7\22,Amount:\2210\22,Number:\221\22,Desc:\22\C2\B9\C2\A7\C3\8F\C2\B2\C2\B7\C2\A2\C2\B2\C3\86\C2\A3\C2\A1\22,PayPwd:\22123456\22}\00"
@.str.1 = [12 x i8] c"buflen: %d\0A\00"
@.str.2 = [11 x i8] c"buffer: %s\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = tail call i32 @strlen(i8* getelementptr inbounds ([130 x i8], [130 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%4 = call i32 @base64encrypt(i8* getelementptr inbounds ([130 x i8], [130 x i8]* @.str, i64 0, i64 0), i32 %2, i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 %4)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%7 = call i32 (...) @getchar()
ret i32 0
}