#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 *, int);
int /*<<< orphan*/ putchar(char);
char rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
int main() {
  int done, litere = 0;
  long int r;
  char alpha;
  srand((unsigned)time(NULL));
  done = 0;
  while (!done) {
    r = rand() % ('Z' - 'A');
    alpha = 'a' + (char)r;
    if (alpha == 'q')
      done = !0;
    putchar(alpha);
    litere++;
  }
  printf("\n\nIn total %d litere\n\n", litere);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1193 <main+0x43>
jmp    11e4 <main+0x94>
mov    $0x0,%al
call   1070 <rand@plt>
movsbl %al,%eax
mov    $0x19,%ecx
cltd
idiv   %ecx
movslq %edx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl %al,%eax
add    $0x61,%eax
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x71,%eax
jne    11cd <main+0x7d>
movl   $0x1,-0x8(%rbp)
movsbl -0x19(%rbp),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117d <main+0x2d>
mov    -0xc(%rbp),%esi
lea    0xe12(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1070 <rand@plt>
movsbl %al,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,8),%ecx
movzwl %cx,%edx
shr    $0xa,%ecx
shr    $0xf,%edx
add    %cl,%dl
movzbl %dl,%ecx
lea    (%rcx,%rcx,4),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
add    $0x61,%al
movsbl %al,%ebp
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
cmp    $0x71,%bpl
jne    1170 <main+0x20>
lea    0xe4e(%rip),%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\0A\0AIn total %d litere\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %3
%6 = call i64 @time(i32* null)
%7 = trunc i64 %6 to i32
%8 = call i32 @srand(i32 %7)
store i32 0, i32* %2
br label %9
9: ; preds = %27, %0
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
%12 = xor i1 %11, true
br i1 %12, label %13, label %32
13: ; preds = %9
%14 = call signext i8 (...) @rand()
%15 = sext i8 %14 to i32
%16 = srem i32 %15, 25
%17 = sext i32 %16 to i64
store i64 %17, i64* %4
%18 = load i64, i64* %4
%19 = trunc i64 %18 to i8
%20 = sext i8 %19 to i32
%21 = add nsw i32 97, %20
%22 = trunc i32 %21 to i8
store i8 %22, i8* %5
%23 = load i8, i8* %5
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 113
br i1 %25, label %26, label %27
26: ; preds = %13
store i32 1, i32* %2
br label %27
27: ; preds = %26, %13
%28 = load i8, i8* %5
%29 = call i32 @putchar(i8 signext %28)
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %9
32: ; preds = %9
%33 = load i32, i32* %3
%34 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %33)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"\0A\0AIn total %d litere\0A\0A\00"
define i32 @main() {
%1 = tail call i64 @time(i32* null)
%2 = trunc i64 %1 to i32
%3 = tail call i32 @srand(i32 %2)
br label %4
4: ; preds = %0, %4
%5 = phi i32 [ 0, %0 ], [ %11, %4 ]
%6 = tail call signext i8 (...) @rand()
%7 = srem i8 %6, 25
%8 = add nsw i8 %7, 97
%9 = icmp eq i8 %8, 113
%10 = tail call i32 @putchar(i8 signext %8)
%11 = add nuw nsw i32 %5, 1
br i1 %9, label %12, label %4
12: ; preds = %4
%13 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 0
}