#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 /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ system(char *);
int main() {
  char car;
  int contatore = 0;
  printf("Inserire una serie di caratteri(# per finire)\n");
  do {
    scanf("%c", &car);
    if (car >= 'a' && car <= 'z')
      contatore++;
  } while (car != '#');
  printf("Il numero delle lettere minuscole e' %d", contatore);
  printf("\n");
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x5(%rbp),%eax
cmp    $0x61,%eax
jl     1187 <main+0x57>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     1187 <main+0x57>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    118c <main+0x5c>
movsbl -0x5(%rbp),%eax
cmp    $0x23,%eax
jne    1154 <main+0x24>
mov    -0xc(%rbp),%esi
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9b(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <puts@plt>
xor    %ebx,%ebx
lea    0xe92(%rip),%r14
lea    0xf(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
call   1070 <scanf@plt>
movzbl 0xf(%rsp),%eax
lea    -0x61(%rax),%ecx
cmp    $0x1a,%cl
adc    $0x0,%ebx
cmp    $0x23,%al
jne    1180 <main+0x30>
lea    0xe5f(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe6d(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [47 x i8] c"Inserire una serie di caratteri(# per finire)\0A\00"
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [40 x i8] c"Il numero delle lettere minuscole e' %d\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %18, %0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sge i32 %8, 97
br i1 %9, label %10, label %17
10: ; preds = %5
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp sle i32 %12, 122
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %17
17: ; preds = %14, %10, %5
br label %18
18: ; preds = %17
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp ne i32 %20, 35
br i1 %21, label %5, label %22
22: ; preds = %18
%23 = load i32, i32* %3
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%26 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@.str.2 = [40 x i8] c"Il numero delle lettere minuscole e' %d\00"
@.str.4 = [6 x i8] c"pause\00"
@str = [46 x i8] c"Inserire una serie di caratteri(# per finire)\00"
define i32 @main() {
%1 = alloca i8
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
br label %3
3: ; preds = %3, %0
%4 = phi i32 [ 0, %0 ], [ %10, %3 ]
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%6 = load i8, i8* %1
%7 = add i8 %6, -97
%8 = icmp ult i8 %7, 26
%9 = zext i1 %8 to i32
%10 = add nuw nsw i32 %4, %9
%11 = icmp eq i8 %6, 35
br i1 %11, label %12, label %3
12: ; preds = %3
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%14 = call i32 @putchar(i32 10)
%15 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}