#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 *);
void main() {
  char str[100];
  int i, count = 0;
  printf("Enter a string\n");
  scanf("%[^\n]s", str);
  for (i = 0; i < 100; i++) {
    if ((str[i] >= 65 && str[i] <= 90) &&
        (str[i + 1] >= 97 && str[i + 1] <= 122))
      ++count;
  }
  printf("The number of words with first letter capital is: %d", count);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x78(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rsi
lea    0xec5(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x74(%rbp)
cmpl   $0x64,-0x74(%rbp)
jge    11cd <main+0xad>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x41,%eax
jl     11ba <main+0x9a>
movslq -0x74(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x5a,%eax
jg     11ba <main+0x9a>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x61,%eax
jl     11ba <main+0x9a>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x70(%rbp,%rax,1),%eax
cmp    $0x7a,%eax
jg     11ba <main+0x9a>
mov    -0x78(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
jmp    11bf <main+0x9f>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    1157 <main+0x37>
mov    -0x78(%rbp),%esi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
lea    0xf01(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb9(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
xor    %esi,%esi
mov    $0x2,%eax
jmp    116a <main+0x3a>
nopl   0x0(%rax,%rax,1)
add    $0x2,%rax
cmp    $0x66,%rax
je     11a1 <main+0x71>
movzbl -0x2(%rsp,%rax,1),%ecx
add    $0xbf,%cl
cmp    $0x19,%cl
ja     1185 <main+0x55>
movzbl -0x1(%rsp,%rax,1),%ecx
add    $0x9f,%cl
cmp    $0x1a,%cl
adc    $0x0,%esi
movzbl -0x1(%rsp,%rax,1),%ecx
add    $0xbf,%cl
cmp    $0x19,%cl
ja     1160 <main+0x30>
movzbl (%rsp,%rax,1),%ecx
add    $0x9f,%cl
cmp    $0x1a,%cl
adc    $0x0,%esi
jmp    1160 <main+0x30>
lea    0xe5f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x68,%rsp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Enter a string\0A\00"
@.str.1 = [7 x i8] c"%[^\0A]s\00"
@.str.2 = [53 x i8] c"The number of words with first letter capital is: %d\00"
define void @main() {
%1 = alloca [100 x i8]
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %5)
store i32 0, i32* %2
br label %7
7: ; preds = %44, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 100
br i1 %9, label %10, label %47
10: ; preds = %7
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp sge i32 %15, 65
br i1 %16, label %17, label %43
17: ; preds = %10
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp sle i32 %22, 90
br i1 %23, label %24, label %43
24: ; preds = %17
%25 = load i32, i32* %2
%26 = add nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %27
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp sge i32 %30, 97
br i1 %31, label %32, label %43
32: ; preds = %24
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp sle i32 %38, 122
br i1 %39, label %40, label %43
40: ; preds = %32
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %43
43: ; preds = %40, %32, %24, %17, %10
br label %44
44: ; preds = %43
%45 = load i32, i32* %2
%46 = add nsw i32 %45, 1
store i32 %46, i32* %2
br label %7
47: ; preds = %7
%48 = load i32, i32* %3
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0), i32 %48)
ret void
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"%[^\0A]s\00"
@.str.2 = [53 x i8] c"The number of words with first letter capital is: %d\00"
@str = [15 x i8] c"Enter a string\00"
define void @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %5
5: ; preds = %34, %0
%6 = phi i64 [ 0, %0 ], [ %26, %34 ]
%7 = phi i32 [ 0, %0 ], [ %35, %34 ]
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %6
%9 = load i8, i8* %8
%10 = add i8 %9, -65
%11 = icmp ult i8 %10, 26
%12 = or i64 %6, 1
br i1 %11, label %13, label %20
13: ; preds = %5
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %12
%15 = load i8, i8* %14
%16 = add i8 %15, -97
%17 = icmp ult i8 %16, 26
%18 = zext i1 %17 to i32
%19 = add nsw i32 %7, %18
br label %20
20: ; preds = %5, %13
%21 = phi i32 [ %19, %13 ], [ %7, %5 ]
%22 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %12
%23 = load i8, i8* %22
%24 = add i8 %23, -65
%25 = icmp ult i8 %24, 26
%26 = add nuw nsw i64 %6, 2
br i1 %25, label %27, label %34
27: ; preds = %20
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 %26
%29 = load i8, i8* %28
%30 = add i8 %29, -97
%31 = icmp ult i8 %30, 26
%32 = zext i1 %31 to i32
%33 = add nsw i32 %21, %32
br label %34
34: ; preds = %27, %20
%35 = phi i32 [ %33, %27 ], [ %21, %20 ]
%36 = icmp eq i64 %26, 100
br i1 %36, label %37, label %5
37: ; preds = %34
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.2, i64 0, i64 0), i32 %35)
ret void
}