#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 /*<<< orphan*/ base32_decode(char *, unsigned long long *);
int /*<<< orphan*/ base32_encode(unsigned long long, int, char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcpy(char *, char *);
char *test_base32() {
  unsigned long long content;
  char result[64];
  memset(result, 0, 64);
  strcpy((char *)(&content), "abcdefg");
  printf("content is: 0x%llx\n", content);
  base32_encode(content, 10, result);
  printf("result is: %s\n", result);
  unsigned long long dec_result;
  base32_decode(result, &dec_result);
  printf("dec_result is: 0x%llx\n", dec_result);
  return 0;
}


x86 assembly (clang, -O0):
<test_base32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1060 <memset@plt>
lea    -0x8(%rbp),%rdi
lea    0xe8d(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rsi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x50(%rbp),%rdx
mov    $0xa,%esi
call   1070 <base32_encode@plt>
lea    -0x50(%rbp),%rsi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
lea    -0x58(%rbp),%rsi
call   1050 <base32_decode@plt>
mov    -0x58(%rbp),%rsi
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_base32>:
push   %rbx
sub    $0x50,%rsp
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x40,%edx
call   1060 <memset@plt>
lea    0xe90(%rip),%rsi
mov    %rsp,%rdi
call   1030 <strcpy@plt>
mov    (%rsp),%rsi
lea    0xe85(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rdi
mov    $0xa,%esi
mov    %rbx,%rdx
call   1070 <base32_encode@plt>
lea    0xe7a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <base32_decode@plt>
mov    0x8(%rsp),%rsi
lea    0xe66(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"abcdefg\00"
@.str.1 = [20 x i8] c"content is: 0x%llx\0A\00"
@.str.2 = [15 x i8] c"result is: %s\0A\00"
@.str.3 = [23 x i8] c"dec_result is: 0x%llx\0A\00"
define i8* @test_base32() {
%1 = alloca i64
%2 = alloca [64 x i8]
%3 = alloca i64
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 0, i32 64)
%6 = bitcast i64* %1 to i8*
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%8 = load i64, i64* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i64 %8)
%10 = load i64, i64* %1
%11 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%12 = call i32 @base32_encode(i64 %10, i32 10, i8* %11)
%13 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%16 = call i32 @base32_decode(i8* %15, i64* %3)
%17 = load i64, i64* %3
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i64 %17)
ret i8* null
}

LLVM IR (-O2):
@.str = [8 x i8] c"abcdefg\00"
@.str.1 = [20 x i8] c"content is: 0x%llx\0A\00"
@.str.2 = [15 x i8] c"result is: %s\0A\00"
@.str.3 = [23 x i8] c"dec_result is: 0x%llx\0A\00"
define noalias i8* @test_base32() {
%1 = alloca i64
%2 = alloca [64 x i8]
%3 = alloca i64
%4 = bitcast i64* %1 to i8*
%5 = getelementptr inbounds [64 x i8], [64 x i8]* %2, i64 0, i64 0
%6 = call i32 @memset(i8* %5, i32 0, i32 64)
%7 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%8 = load i64, i64* %1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i64 %8)
%10 = load i64, i64* %1
%11 = call i32 @base32_encode(i64 %10, i32 10, i8* %5)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%13 = bitcast i64* %3 to i8*
%14 = call i32 @base32_decode(i8* %5, i64* %3)
%15 = load i64, i64* %3
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i64 %15)
ret i8* null
}