#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 *);
void GenerateStr(char *str, int len) {
  int i;
  for (i = 0; i < len; i++) {
    str[i] = 'a' + (i % 26);
  }
  str[i] = '\0';
  printf("%s\n", str);
}


x86 assembly (clang, -O0):
<GenerateStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <GenerateStr+0x49>
mov    -0x10(%rbp),%eax
mov    $0x1a,%ecx
cltd
idiv   %ecx
add    $0x61,%edx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <GenerateStr+0x16>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x8(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GenerateStr>:
mov    %rdi,%r10
test   %esi,%esi
jle    1126 <GenerateStr+0x16>
mov    %esi,%r9d
cmp    $0x10,%esi
jae    112e <GenerateStr+0x1e>
xor    %edx,%edx
jmp    15c0 <GenerateStr+0x4b0>
xor    %r9d,%r9d
jmp    15fd <GenerateStr+0x4ed>
mov    %r9d,%edx
and    $0xfffffff0,%edx
lea    -0x10(%rdx),%rsi
mov    %rsi,%r8
shr    $0x4,%r8
add    $0x1,%r8
test   %rsi,%rsi
je     1611 <GenerateStr+0x501>
mov    %r8,%rsi
and    $0xfffffffffffffffe,%rsi
movdqa 0xeb5(%rip),%xmm4
movdqa 0xebc(%rip),%xmm14
movdqa 0xec4(%rip),%xmm6
movdqa 0xecb(%rip),%xmm13
xor    %edi,%edi
movdqa 0xed0(%rip),%xmm12
movdqa 0xed7(%rip),%xmm11
movdqa 0xede(%rip),%xmm8
movdqa 0xee5(%rip),%xmm9
movdqa 0xeec(%rip),%xmm10
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movdqa %xmm14,%xmm0
pmuludq %xmm12,%xmm0
pshufd $0xed,%xmm0,%xmm0
pshufd $0xf5,%xmm14,%xmm1
pmuludq %xmm12,%xmm1
pshufd $0xed,%xmm1,%xmm1
punpckldq %xmm1,%xmm0
psrld  $0x3,%xmm0
pshufd $0xf5,%xmm0,%xmm1
pmuludq %xmm11,%xmm0
pshufd $0xe8,%xmm0,%xmm2
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm0
punpckldq %xmm0,%xmm2
movdqa %xmm14,%xmm0
psubd  %xmm2,%xmm0
movdqa %xmm4,%xmm1
pmuludq %xmm12,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm4,%xmm2
pmuludq %xmm12,%xmm2
pshufd $0xed,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psrld  $0x3,%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm11,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
movdqa %xmm4,%xmm2
psubd  %xmm1,%xmm2
packuswb %xmm2,%xmm0
movdqa %xmm13,%xmm1
pmuludq %xmm12,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm13,%xmm2
pmuludq %xmm12,%xmm2
pshufd $0xed,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
psrld  $0x3,%xmm1
pshufd $0xf5,%xmm1,%xmm2
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm11,%xmm2
pshufd $0xe8,%xmm2,%xmm2
punpckldq %xmm2,%xmm1
movdqa %xmm13,%xmm2
psubd  %xmm1,%xmm2
movdqa %xmm6,%xmm1
pmuludq %xmm12,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm6,%xmm5
pmuludq %xmm12,%xmm5
pshufd $0xed,%xmm5,%xmm5
punpckldq %xmm5,%xmm1
psrld  $0x3,%xmm1
pshufd $0xf5,%xmm1,%xmm5
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm11,%xmm5
pshufd $0xe8,%xmm5,%xmm5
punpckldq %xmm5,%xmm1
movdqa %xmm6,%xmm5
psubd  %xmm1,%xmm5
packuswb %xmm5,%xmm2
packuswb %xmm0,%xmm2
paddb  %xmm8,%xmm2
movdqu %xmm2,(%r10,%rdi,1)
movdqa %xmm6,%xmm2
paddd  %xmm9,%xmm2
movdqa %xmm13,%xmm0
paddd  %xmm9,%xmm0
movdqa %xmm4,%xmm5
paddd  %xmm9,%xmm5
movdqa %xmm14,%xmm3
paddd  %xmm9,%xmm3
movdqa %xmm3,%xmm1
pmuludq %xmm12,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm3,%xmm7
pmuludq %xmm12,%xmm7
pshufd $0xed,%xmm7,%xmm7
punpckldq %xmm7,%xmm1
psrld  $0x3,%xmm1
pshufd $0xf5,%xmm1,%xmm7
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm11,%xmm7
pshufd $0xe8,%xmm7,%xmm7
punpckldq %xmm7,%xmm1
psubd  %xmm1,%xmm3
movdqa %xmm5,%xmm1
pmuludq %xmm12,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm5,%xmm7
pmuludq %xmm12,%xmm7
pshufd $0xed,%xmm7,%xmm7
punpckldq %xmm7,%xmm1
psrld  $0x3,%xmm1
pshufd $0xf5,%xmm1,%xmm7
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm11,%xmm7
pshufd $0xe8,%xmm7,%xmm7
punpckldq %xmm7,%xmm1
psubd  %xmm1,%xmm5
packuswb %xmm5,%xmm3
movdqa %xmm0,%xmm1
pmuludq %xmm12,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm0,%xmm5
pmuludq %xmm12,%xmm5
pshufd $0xed,%xmm5,%xmm5
punpckldq %xmm5,%xmm1
psrld  $0x3,%xmm1
pshufd $0xf5,%xmm1,%xmm5
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm11,%xmm5
pshufd $0xe8,%xmm5,%xmm5
punpckldq %xmm5,%xmm1
psubd  %xmm1,%xmm0
movdqa %xmm2,%xmm1
pmuludq %xmm12,%xmm1
pshufd $0xed,%xmm1,%xmm1
pshufd $0xf5,%xmm2,%xmm5
pmuludq %xmm12,%xmm5
pshufd $0xed,%xmm5,%xmm5
punpckldq %xmm5,%xmm1
psrld  $0x3,%xmm1
pshufd $0xf5,%xmm1,%xmm5
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
pmuludq %xmm11,%xmm5
pshufd $0xe8,%xmm5,%xmm5
punpckldq %xmm5,%xmm1
psubd  %xmm1,%xmm2
packuswb %xmm2,%xmm0
packuswb %xmm3,%xmm0
paddb  %xmm8,%xmm0
movdqu %xmm0,0x10(%r10,%rdi,1)
add    $0x20,%rdi
paddd  %xmm10,%xmm13
paddd  %xmm10,%xmm6
paddd  %xmm10,%xmm14
paddd  %xmm10,%xmm4
add    $0xfffffffffffffffe,%rsi
jne    11b0 <GenerateStr+0xa0>
movdqa %xmm14,%xmm0
pmuludq %xmm12,%xmm0
pshufd $0xed,%xmm0,%xmm0
pshufd $0xf5,%xmm14,%xmm1
pmuludq %xmm12,%xmm1
pshufd $0xed,%xmm1,%xmm1
punpckldq %xmm1,%xmm0
psrld  $0x3,%xmm0
pshufd $0xf5,%xmm0,%xmm1
pmuludq %xmm11,%xmm0
pshufd $0xe8,%xmm0,%xmm0
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm1,%xmm0
psubd  %xmm0,%xmm14
movdqa %xmm4,%xmm0
pmuludq %xmm12,%xmm0
pshufd $0xed,%xmm0,%xmm0
pshufd $0xf5,%xmm4,%xmm1
pmuludq %xmm12,%xmm1
pshufd $0xed,%xmm1,%xmm1
punpckldq %xmm1,%xmm0
psrld  $0x3,%xmm0
pshufd $0xf5,%xmm0,%xmm1
pmuludq %xmm11,%xmm0
pshufd $0xe8,%xmm0,%xmm0
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm1,%xmm0
psubd  %xmm0,%xmm4
packuswb %xmm4,%xmm14
movdqa %xmm13,%xmm0
pmuludq %xmm12,%xmm0
pshufd $0xed,%xmm0,%xmm0
pshufd $0xf5,%xmm13,%xmm1
pmuludq %xmm12,%xmm1
pshufd $0xed,%xmm1,%xmm1
punpckldq %xmm1,%xmm0
psrld  $0x3,%xmm0
pshufd $0xf5,%xmm0,%xmm1
pmuludq %xmm11,%xmm0
pshufd $0xe8,%xmm0,%xmm0
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm1,%xmm0
psubd  %xmm0,%xmm13
movdqa %xmm6,%xmm0
pmuludq %xmm12,%xmm0
pshufd $0xed,%xmm0,%xmm0
pshufd $0xf5,%xmm6,%xmm1
pmuludq %xmm12,%xmm1
pshufd $0xed,%xmm1,%xmm1
punpckldq %xmm1,%xmm0
psrld  $0x3,%xmm0
pshufd $0xf5,%xmm0,%xmm1
pmuludq %xmm11,%xmm0
pshufd $0xe8,%xmm0,%xmm0
pmuludq %xmm11,%xmm1
pshufd $0xe8,%xmm1,%xmm1
punpckldq %xmm1,%xmm0
psubd  %xmm0,%xmm6
packuswb %xmm6,%xmm13
packuswb %xmm14,%xmm13
paddb  0xac1(%rip),%xmm13
test   $0x1,%r8b
je     15bb <GenerateStr+0x4ab>
movdqu %xmm13,(%r10,%rdi,1)
cmp    %r9,%rdx
je     15fd <GenerateStr+0x4ed>
lea    0x61(%rdx),%esi
mov    %rdx,%rdi
cs nopw 0x0(%rax,%rax,1)
mov    %edx,%ecx
imul   $0x4ec4ec4f,%rcx,%rcx
shr    $0x23,%rcx
lea    (%rcx,%rcx,4),%eax
lea    (%rax,%rax,4),%eax
add    %ecx,%eax
mov    %esi,%ecx
sub    %al,%cl
mov    %cl,(%r10,%rdi,1)
add    $0x1,%rdi
add    $0x1,%sil
add    $0x1,%edx
cmp    %rdi,%r9
jne    15d0 <GenerateStr+0x4c0>
movb   $0x0,(%r10,%r9,1)
lea    0xa97(%rip),%rdi
mov    %r10,%rsi
jmp    1030 <printf@plt>
movdqa 0x9e6(%rip),%xmm13
xor    %edi,%edi
test   $0x1,%r8b
jne    15b5 <GenerateStr+0x4a5>
jmp    15bb <GenerateStr+0x4ab>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @GenerateStr(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %19, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %22
10: ; preds = %6
%11 = load i32, i32* %5
%12 = srem i32 %11, 26
%13 = add nsw i32 97, %12
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %3
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
store i8 %14, i8* %18
br label %19
19: ; preds = %10
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %6
22: ; preds = %6
%23 = load i8*, i8** %3
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %23, i64 %25
store i8 0, i8* %26
%27 = load i8*, i8** %3
%28 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %27)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @GenerateStr(i8* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %62
4: ; preds = %2
%5 = zext i32 %1 to i64
%6 = icmp ult i32 %1, 16
br i1 %6, label %49, label %7
7: ; preds = %4
%8 = and i64 %5, 4294967280
%9 = add nsw i64 %8, -16
%10 = lshr exact i64 %9, 4
%11 = add nuw nsw i64 %10, 1
%12 = and i64 %11, 1
%13 = icmp eq i64 %9, 0
br i1 %13, label %40, label %14
14: ; preds = %7
%15 = and i64 %11, 2305843009213693950
br label %16
16: ; preds = %16, %14
%17 = phi i64 [ 0, %14 ], [ %32, %16 ]
%18 = phi <16 x i32> [ <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>, %14 ], [ %33, %16 ]
%19 = phi i64 [ 0, %14 ], [ %34, %16 ]
%20 = urem <16 x i32> %18, <i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26>
%21 = trunc <16 x i32> %20 to <16 x i8>
%22 = add nuw nsw <16 x i8> %21, <i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97>
%23 = getelementptr inbounds i8, i8* %0, i64 %17
%24 = bitcast i8* %23 to <16 x i8>*
store <16 x i8> %22, <16 x i8>* %24
%25 = or i64 %17, 16
%26 = add <16 x i32> %18, <i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16>
%27 = urem <16 x i32> %26, <i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26>
%28 = trunc <16 x i32> %27 to <16 x i8>
%29 = add nuw nsw <16 x i8> %28, <i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97>
%30 = getelementptr inbounds i8, i8* %0, i64 %25
%31 = bitcast i8* %30 to <16 x i8>*
store <16 x i8> %29, <16 x i8>* %31
%32 = add nuw i64 %17, 32
%33 = add <16 x i32> %18, <i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32, i32 32>
%34 = add i64 %19, 2
%35 = icmp eq i64 %34, %15
br i1 %35, label %36, label %16
36: ; preds = %16
%37 = urem <16 x i32> %33, <i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26, i32 26>
%38 = trunc <16 x i32> %37 to <16 x i8>
%39 = add nuw <16 x i8> %38, <i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97, i8 97>
br label %40
40: ; preds = %36, %7
%41 = phi i64 [ 0, %7 ], [ %32, %36 ]
%42 = phi <16 x i8> [ <i8 97, i8 98, i8 99, i8 100, i8 101, i8 102, i8 103, i8 104, i8 105, i8 106, i8 107, i8 108, i8 109, i8 110, i8 111, i8 112>, %7 ], [ %39, %36 ]
%43 = icmp eq i64 %12, 0
br i1 %43, label %47, label %44
44: ; preds = %40
%45 = getelementptr inbounds i8, i8* %0, i64 %41
%46 = bitcast i8* %45 to <16 x i8>*
store <16 x i8> %42, <16 x i8>* %46
br label %47
47: ; preds = %40, %44
%48 = icmp eq i64 %8, %5
br i1 %48, label %60, label %49
49: ; preds = %4, %47
%50 = phi i64 [ 0, %4 ], [ %8, %47 ]
br label %51
51: ; preds = %49, %51
%52 = phi i64 [ %58, %51 ], [ %50, %49 ]
%53 = trunc i64 %52 to i32
%54 = urem i32 %53, 26
%55 = trunc i32 %54 to i8
%56 = add nuw nsw i8 %55, 97
%57 = getelementptr inbounds i8, i8* %0, i64 %52
store i8 %56, i8* %57
%58 = add nuw nsw i64 %52, 1
%59 = icmp eq i64 %58, %5
br i1 %59, label %60, label %51
60: ; preds = %51, %47
%61 = zext i32 %1 to i64
br label %62
62: ; preds = %2, %60
%63 = phi i64 [ %61, %60 ], [ 0, %2 ]
%64 = getelementptr inbounds i8, i8* %0, i64 %63
store i8 0, i8* %64
%65 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}