#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 rand();
void generate_str(char *str) {
  str[15] = 0;
  for (int i = 0; i < 15; i++) {
    str[i] = (rand() % 26) + 'a';
  }
}


x86 assembly (clang, -O0):
<generate_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movb   $0x0,0xf(%rax)
movl   $0x0,-0xc(%rbp)
cmpl   $0xf,-0xc(%rbp)
jge    1160 <generate_str+0x50>
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112b <generate_str+0x1b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_str>:
push   %rbx
mov    %rdi,%rbx
movb   $0x0,0xf(%rdi)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,0x1(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,0x2(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,0x3(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,0x4(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,0x5(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,0x6(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,0x7(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,0x8(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,0x9(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,0xa(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,0xb(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,0xc(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,0xd(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0x4ec4ec4f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x23,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%edx
lea    (%rdx,%rdx,4),%edx
add    %ecx,%edx
sub    %edx,%eax
add    $0x61,%al
mov    %al,0xe(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @generate_str(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 15
store i8 0, i8* %5
store i32 0, i32* %3
br label %6
6: ; preds = %18, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 15
br i1 %8, label %9, label %21
9: ; preds = %6
%10 = call i32 (...) @rand()
%11 = srem i32 %10, 26
%12 = add nsw i32 %11, 97
%13 = trunc i32 %12 to i8
%14 = load i8*, i8** %2
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
store i8 %13, i8* %17
br label %18
18: ; preds = %9
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %6
21: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @generate_str(i8* nocapture writeonly %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 15
store i8 0, i8* %2
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 26
%5 = trunc i32 %4 to i8
%6 = add nsw i8 %5, 97
store i8 %6, i8* %0
%7 = tail call i32 (...) @rand()
%8 = srem i32 %7, 26
%9 = trunc i32 %8 to i8
%10 = add nsw i8 %9, 97
%11 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %10, i8* %11
%12 = tail call i32 (...) @rand()
%13 = srem i32 %12, 26
%14 = trunc i32 %13 to i8
%15 = add nsw i8 %14, 97
%16 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %15, i8* %16
%17 = tail call i32 (...) @rand()
%18 = srem i32 %17, 26
%19 = trunc i32 %18 to i8
%20 = add nsw i8 %19, 97
%21 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %20, i8* %21
%22 = tail call i32 (...) @rand()
%23 = srem i32 %22, 26
%24 = trunc i32 %23 to i8
%25 = add nsw i8 %24, 97
%26 = getelementptr inbounds i8, i8* %0, i64 4
store i8 %25, i8* %26
%27 = tail call i32 (...) @rand()
%28 = srem i32 %27, 26
%29 = trunc i32 %28 to i8
%30 = add nsw i8 %29, 97
%31 = getelementptr inbounds i8, i8* %0, i64 5
store i8 %30, i8* %31
%32 = tail call i32 (...) @rand()
%33 = srem i32 %32, 26
%34 = trunc i32 %33 to i8
%35 = add nsw i8 %34, 97
%36 = getelementptr inbounds i8, i8* %0, i64 6
store i8 %35, i8* %36
%37 = tail call i32 (...) @rand()
%38 = srem i32 %37, 26
%39 = trunc i32 %38 to i8
%40 = add nsw i8 %39, 97
%41 = getelementptr inbounds i8, i8* %0, i64 7
store i8 %40, i8* %41
%42 = tail call i32 (...) @rand()
%43 = srem i32 %42, 26
%44 = trunc i32 %43 to i8
%45 = add nsw i8 %44, 97
%46 = getelementptr inbounds i8, i8* %0, i64 8
store i8 %45, i8* %46
%47 = tail call i32 (...) @rand()
%48 = srem i32 %47, 26
%49 = trunc i32 %48 to i8
%50 = add nsw i8 %49, 97
%51 = getelementptr inbounds i8, i8* %0, i64 9
store i8 %50, i8* %51
%52 = tail call i32 (...) @rand()
%53 = srem i32 %52, 26
%54 = trunc i32 %53 to i8
%55 = add nsw i8 %54, 97
%56 = getelementptr inbounds i8, i8* %0, i64 10
store i8 %55, i8* %56
%57 = tail call i32 (...) @rand()
%58 = srem i32 %57, 26
%59 = trunc i32 %58 to i8
%60 = add nsw i8 %59, 97
%61 = getelementptr inbounds i8, i8* %0, i64 11
store i8 %60, i8* %61
%62 = tail call i32 (...) @rand()
%63 = srem i32 %62, 26
%64 = trunc i32 %63 to i8
%65 = add nsw i8 %64, 97
%66 = getelementptr inbounds i8, i8* %0, i64 12
store i8 %65, i8* %66
%67 = tail call i32 (...) @rand()
%68 = srem i32 %67, 26
%69 = trunc i32 %68 to i8
%70 = add nsw i8 %69, 97
%71 = getelementptr inbounds i8, i8* %0, i64 13
store i8 %70, i8* %71
%72 = tail call i32 (...) @rand()
%73 = srem i32 %72, 26
%74 = trunc i32 %73 to i8
%75 = add nsw i8 %74, 97
%76 = getelementptr inbounds i8, i8* %0, i64 14
store i8 %75, i8* %76
ret void
}