#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*/ printf(char *, char *);
int rand();
void rand_str() {
  static const char text[] = "23456789"
                             "abcdefghkmnpqrstwxyz"
                             "#$?*+[]<>@";
  int i;
  char dst[24];
  for (i = 0; i < 24; ++i) {
    dst[i] = text[rand() % (sizeof text - 1)];
  }
  dst[i] = '\0';
  printf("%s\n", dst);
}


x86 assembly (clang, -O0):
<rand_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x18,-0x4(%rbp)
jge    116c <rand_str+0x4c>
mov    $0x0,%al
call   1040 <rand@plt>
cltq
mov    $0x26,%ecx
xor    %edx,%edx
div    %rcx
lea    0xead(%rip),%rax
mov    (%rax,%rdx,1),%cl
movslq -0x4(%rbp),%rax
mov    %cl,-0x20(%rbp,%rax,1)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    112f <rand_str+0xf>
movslq -0x4(%rbp),%rax
movb   $0x0,-0x20(%rbp,%rax,1)
lea    -0x20(%rbp),%rsi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_str>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movabs $0xd79435e50d79435f,%r14
35 94 d7
lea    0xec6(%rip),%r15
xor    %ebx,%ebx
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <rand@plt>
movslq %eax,%rcx
mov    %rcx,%rax
mul    %r14
shr    $0x5,%rdx
imul   $0x26,%rdx,%rax
sub    %rax,%rcx
movzbl (%r15,%rcx,1),%eax
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0x18,%rbx
jne    1140 <rand_str+0x20>
movb   $0x0,0x18(%rsp)
lea    0xeae(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@rand_str.text = internal constant [39 x i8] c"23456789abcdefghkmnpqrstwxyz#$?*+[]<>@\00"
@.str = [4 x i8] c"%s\0A\00"
define void @rand_str() {
%1 = alloca i32
%2 = alloca [24 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %15, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 24
br i1 %5, label %6, label %18
6: ; preds = %3
%7 = call i32 (...) @rand()
%8 = sext i32 %7 to i64
%9 = urem i64 %8, 38
%10 = getelementptr inbounds [39 x i8], [39 x i8]* @rand_str.text, i64 0, i64 %9
%11 = load i8, i8* %10
%12 = load i32, i32* %1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 %13
store i8 %11, i8* %14
br label %15
15: ; preds = %6
%16 = load i32, i32* %1
%17 = add nsw i32 %16, 1
store i32 %17, i32* %1
br label %3
18: ; preds = %3
%19 = load i32, i32* %1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 %20
store i8 0, i8* %21
%22 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %22)
ret void
}

LLVM IR (-O2):
@rand_str.text = internal unnamed_addr constant [39 x i8] c"23456789abcdefghkmnpqrstwxyz#$?*+[]<>@\00"
@.str = [4 x i8] c"%s\0A\00"
define void @rand_str() {
%1 = alloca [24 x i8]
%2 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 0, %0 ], [ %11, %3 ]
%5 = tail call i32 (...) @rand()
%6 = sext i32 %5 to i64
%7 = urem i64 %6, 38
%8 = getelementptr inbounds [39 x i8], [39 x i8]* @rand_str.text, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 %4
store i8 %9, i8* %10
%11 = add nuw nsw i64 %4, 1
%12 = icmp eq i64 %11, 24
br i1 %12, label %13, label %3
13: ; preds = %3
%14 = getelementptr inbounds [24 x i8], [24 x i8]* %1, i64 0, i64 24
store i8 0, i8* %14
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret void
}