#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*/ inserthash(char *);
void *limitedrandom(char, char);
void rand_str_hased(int a, int b) {
  int nr = limitedrandom(a, b);
  int i;
  char x[3000];
  for (i = 0; i < nr; i++) {
    x[i] = limitedrandom('a', 'z');
  }
  inserthash(x);
}


x86 assembly (clang, -O0):
<rand_str_hased>:
push   %rbp
mov    %rsp,%rbp
sub    $0xbd0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,%cl
mov    -0x8(%rbp),%eax
movsbl %cl,%edi
movsbl %al,%esi
call   1030 <limitedrandom@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1184 <rand_str_hased+0x64>
mov    $0x61,%edi
mov    $0x7a,%esi
call   1030 <limitedrandom@plt>
mov    %al,%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0xbd0(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114e <rand_str_hased+0x2e>
lea    -0xbd0(%rbp),%rdi
call   1040 <inserthash@plt>
add    $0xbd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_str_hased>:
push   %r14
push   %rbx
sub    $0xbb8,%rsp
movsbl %dil,%edi
movsbl %sil,%esi
call   1030 <limitedrandom@plt>
test   %eax,%eax
jle    115b <rand_str_hased+0x3b>
mov    %eax,%r14d
xor    %ebx,%ebx
mov    $0x61,%edi
mov    $0x7a,%esi
call   1030 <limitedrandom@plt>
mov    %al,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1140 <rand_str_hased+0x20>
mov    %rsp,%rdi
call   1040 <inserthash@plt>
add    $0xbb8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @rand_str_hased(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [3000 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %3
%9 = trunc i32 %8 to i8
%10 = load i32, i32* %4
%11 = trunc i32 %10 to i8
%12 = call i8* @limitedrandom(i8 signext %9, i8 signext %11)
%13 = ptrtoint i8* %12 to i32
store i32 %13, i32* %5
store i32 0, i32* %6
br label %14
14: ; preds = %24, %2
%15 = load i32, i32* %6
%16 = load i32, i32* %5
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %27
18: ; preds = %14
%19 = call i8* @limitedrandom(i8 signext 97, i8 signext 122)
%20 = ptrtoint i8* %19 to i8
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [3000 x i8], [3000 x i8]* %7, i64 0, i64 %22
store i8 %20, i8* %23
br label %24
24: ; preds = %18
%25 = load i32, i32* %6
%26 = add nsw i32 %25, 1
store i32 %26, i32* %6
br label %14
27: ; preds = %14
%28 = getelementptr inbounds [3000 x i8], [3000 x i8]* %7, i64 0, i64 0
%29 = call i32 @inserthash(i8* %28)
ret void
}

LLVM IR (-O2):
define void @rand_str_hased(i32 %0, i32 %1) {
%3 = alloca [3000 x i8]
%4 = trunc i32 %0 to i8
%5 = trunc i32 %1 to i8
%6 = tail call i8* @limitedrandom(i8 signext %4, i8 signext %5)
%7 = ptrtoint i8* %6 to i64
%8 = trunc i64 %7 to i32
%9 = getelementptr inbounds [3000 x i8], [3000 x i8]* %3, i64 0, i64 0
%10 = icmp sgt i32 %8, 0
br i1 %10, label %11, label %21
11: ; preds = %2
%12 = and i64 %7, 4294967295
br label %13
13: ; preds = %11, %13
%14 = phi i64 [ 0, %11 ], [ %19, %13 ]
%15 = tail call i8* @limitedrandom(i8 signext 97, i8 signext 122)
%16 = ptrtoint i8* %15 to i64
%17 = trunc i64 %16 to i8
%18 = getelementptr inbounds [3000 x i8], [3000 x i8]* %3, i64 0, i64 %14
store i8 %17, i8* %18
%19 = add nuw nsw i64 %14, 1
%20 = icmp eq i64 %19, %12
br i1 %20, label %21, label %13
21: ; preds = %13, %2
%22 = call i32 @inserthash(i8* %9)
ret void
}