#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*/ buf;

/* Variables and functions */
char rnd(int);
const char *randomname(void) {
  static char buf[5 + 1];
  int length;
  int i;
  length = rnd(((int)(sizeof(buf) / sizeof((buf)[0]))) - 1);
  for (i = 0; i < length; i++)
    buf[i] = (char)('a' + rnd(26) - 1);
  buf[i] = '\0';
  return buf;
}


x86 assembly (clang, -O0):
<randomname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x5,%edi
call   1030 <rnd@plt>
movsbl %al,%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    116c <randomname+0x5c>
mov    $0x1a,%edi
call   1030 <rnd@plt>
movsbl %al,%eax
add    $0x61,%eax
sub    $0x1,%eax
mov    %al,%dl
movslq -0x8(%rbp),%rcx
lea    0x2ece(%rip),%rax
mov    %dl,(%rax,%rcx,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <randomname+0x1f>
movslq -0x8(%rbp),%rcx
lea    0x2eb2(%rip),%rax
movb   $0x0,(%rax,%rcx,1)
lea    0x2ea7(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomname>:
push   %r15
push   %r14
push   %rbx
mov    $0x5,%edi
call   1030 <rnd@plt>
test   %al,%al
jle    115b <randomname+0x4b>
movsbl %al,%eax
mov    %eax,%r14d
xor    %ebx,%ebx
lea    0x2ef7(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x1a,%edi
call   1030 <rnd@plt>
add    $0x60,%al
mov    %al,(%rbx,%r15,1)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1140 <randomname+0x30>
jmp    115e <randomname+0x4e>
xor    %r14d,%r14d
lea    0x2ec4(%rip),%rax
movb   $0x0,(%r14,%rax,1)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@randomname.buf = internal global [6 x i8] zeroinitializer
define i8* @randomname() {
%1 = alloca i32
%2 = alloca i32
%3 = call signext i8 @rnd(i32 5)
%4 = sext i8 %3 to i32
store i32 %4, i32* %1
store i32 0, i32* %2
br label %5
5: ; preds = %18, %0
%6 = load i32, i32* %2
%7 = load i32, i32* %1
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %21
9: ; preds = %5
%10 = call signext i8 @rnd(i32 26)
%11 = sext i8 %10 to i32
%12 = add nsw i32 97, %11
%13 = sub nsw i32 %12, 1
%14 = trunc i32 %13 to i8
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [6 x i8], [6 x i8]* @randomname.buf, i64 0, i64 %16
store i8 %14, i8* %17
br label %18
18: ; preds = %9
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %5
21: ; preds = %5
%22 = load i32, i32* %2
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [6 x i8], [6 x i8]* @randomname.buf, i64 0, i64 %23
store i8 0, i8* %24
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @randomname.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@randomname.buf = internal global [6 x i8] zeroinitializer
define i8* @randomname() {
%1 = tail call signext i8 @rnd(i32 5)
%2 = sext i8 %1 to i32
%3 = icmp sgt i8 %1, 0
br i1 %3, label %4, label %15
4: ; preds = %0
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = tail call signext i8 @rnd(i32 26)
%9 = add i8 %8, 96
%10 = getelementptr inbounds [6 x i8], [6 x i8]* @randomname.buf, i64 0, i64 %7
store i8 %9, i8* %10
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6
%14 = zext i32 %2 to i64
br label %15
15: ; preds = %0, %13
%16 = phi i64 [ %14, %13 ], [ 0, %0 ]
%17 = getelementptr inbounds [6 x i8], [6 x i8]* @randomname.buf, i64 0, i64 %16
store i8 0, i8* %17
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @randomname.buf, i64 0, i64 0)
}