#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 int /*<<< orphan*/ time_t;

/* Variables and functions */
int rand();
int /*<<< orphan*/ sprintf(char *, char *, char);
int /*<<< orphan*/ srand(unsigned int);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
scalar_t__ time(int /*<<< orphan*/ *);
void boundary(char result[]) {
  char *str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  int i, lstr;
  char ss[3] = {0};
  lstr = strlen(str);
  srand((unsigned int)time((time_t *)NULL));
  for (i = 0; i < 32; ++i) {
    sprintf(ss, "%c", str[(rand() % lstr)]);
    strcat(result, ss);
  }
}


x86 assembly (clang, -O0):
<boundary>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xe7d(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x1b(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1040 <memset@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x20,-0x14(%rbp)
jge    1215 <boundary+0xa5>
lea    -0x1b(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1090 <rand@plt>
mov    -0x30(%rbp),%rdi
cltd
idivl  -0x18(%rbp)
mov    -0x28(%rbp),%rax
movslq %edx,%rcx
lea    0xe4e(%rip),%rsi
movsbl (%rax,%rcx,1),%edx
call   1080 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x1b(%rbp),%rsi
call   1070 <strcat@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ba <boundary+0x4a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<boundary>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r12
movb   $0x0,0xe(%rsp)
movw   $0x0,0xc(%rsp)
lea    0xe8e(%rip),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x20,%ebx
lea    0xc(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1070 <rand@plt>
cltd
idiv   %ebp
movslq %edx,%rax
movzbl (%rax,%r14,1),%eax
mov    %al,0xc(%rsp)
movb   $0x0,0xd(%rsp)
mov    %r12,%rdi
mov    %r15,%rsi
call   1060 <strcat@plt>
add    $0xffffffff,%ebx
jne    11a0 <boundary+0x50>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [63 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\00"
@.str.1 = [3 x i8] c"%c\00"
define void @boundary(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca [3 x i8]
store i8* %0, i8** %2
store i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0), i8** %3
%7 = bitcast [3 x i8]* %6 to i8*
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %5
%10 = call i64 @time(i32* null)
%11 = trunc i64 %10 to i32
%12 = call i32 @srand(i32 %11)
store i32 0, i32* %4
br label %13
13: ; preds = %29, %1
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 32
br i1 %15, label %16, label %32
16: ; preds = %13
%17 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%18 = load i8*, i8** %3
%19 = call i32 (...) @rand()
%20 = load i32, i32* %5
%21 = srem i32 %19, %20
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %18, i64 %22
%24 = load i8, i8* %23
%25 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %24)
%26 = load i8*, i8** %2
%27 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%28 = call i32 @strcat(i8* %26, i8* %27)
br label %29
29: ; preds = %16
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %13
32: ; preds = %13
ret void
}

LLVM IR (-O2):
@.str = [63 x i8] c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\00"
define void @boundary(i8* %0) {
%2 = alloca [3 x i8]
%3 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @strlen(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str, i64 0, i64 0))
%5 = tail call i64 @time(i32* null)
%6 = trunc i64 %5 to i32
%7 = tail call i32 @srand(i32 %6)
%8 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 1
br label %9
9: ; preds = %1, %9
%10 = phi i32 [ 0, %1 ], [ %17, %9 ]
%11 = call i32 (...) @rand()
%12 = srem i32 %11, %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [63 x i8], [63 x i8]* @.str, i64 0, i64 %13
%15 = load i8, i8* %14
store i8 %15, i8* %3
store i8 0, i8* %8
%16 = call i32 @strcat(i8* %0, i8* %3)
%17 = add nuw nsw i32 %10, 1
%18 = icmp eq i32 %17, 32
br i1 %18, label %19, label %9
19: ; preds = %9
ret void
}