#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 *);
scalar_t__ strlen(char *);
scalar_t__ time(int /*<<< orphan*/ *);
void boundary(char result[]) {
  char *str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  int i, lstr;
  char ss[3] = {0};
  lstr = (int)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   %rbx
push   %rax
mov    %rdi,%rbx
movb   $0x0,0x6(%rsp)
movw   $0x0,0x4(%rsp)
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    $0x20,%ebp
lea    0xe90(%rip),%r15
lea    0x4(%rsp),%r14
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0xffffffff84210843,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x5,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x6,%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %ecx,%esi
add    %eax,%esi
movslq %esi,%rax
movzbl (%rax,%r15,1),%eax
mov    %al,0x4(%rsp)
movb   $0x0,0x5(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
add    $0xffffffff,%ebp
jne    1180 <boundary+0x40>
add    $0x8,%rsp
pop    %rbx
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 i64 @strlen(i8* %8)
%10 = trunc i64 %9 to i32
store i32 %10, i32* %5
%11 = call i64 @time(i32* null)
%12 = trunc i64 %11 to i32
%13 = call i32 @srand(i32 %12)
store i32 0, i32* %4
br label %14
14: ; preds = %30, %1
%15 = load i32, i32* %4
%16 = icmp slt i32 %15, 32
br i1 %16, label %17, label %33
17: ; preds = %14
%18 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%19 = load i8*, i8** %3
%20 = call i32 (...) @rand()
%21 = load i32, i32* %5
%22 = srem i32 %20, %21
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %19, i64 %23
%25 = load i8, i8* %24
%26 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8 signext %25)
%27 = load i8*, i8** %2
%28 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%29 = call i32 @strcat(i8* %27, i8* %28)
br label %30
30: ; preds = %17
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %14
33: ; preds = %14
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 i64 @time(i32* null)
%5 = trunc i64 %4 to i32
%6 = tail call i32 @srand(i32 %5)
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 1
br label %8
8: ; preds = %1, %8
%9 = phi i32 [ 0, %1 ], [ %16, %8 ]
%10 = call i32 (...) @rand()
%11 = srem i32 %10, 62
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [63 x i8], [63 x i8]* @.str, i64 0, i64 %12
%14 = load i8, i8* %13
store i8 %14, i8* %3
store i8 0, i8* %7
%15 = call i32 @strcat(i8* %0, i8* %3)
%16 = add nuw nsw i32 %9, 1
%17 = icmp eq i32 %16, 32
br i1 %17, label %18, label %8
18: ; preds = %8
ret void
}