#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 main() {
  int i, hashtag = 0;
  char tweet[140];
  printf("\nEntre com um tweet:");
  scanf("%s", tweet);
  for (i = 0; i < 140; i++) {
    if (tweet[i] == '#') {
      hashtag++;
    }
  }
  printf("Este tweet possui %d hashtags.", hashtag);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xa0(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x8c,-0x8(%rbp)
jge    119f <main+0x7f>
movslq -0x8(%rbp),%rax
movsbl -0xa0(%rbp,%rax,1),%eax
ff
cmp    $0x23,%eax
jne    118c <main+0x6c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1191 <main+0x71>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1161 <main+0x41>
mov    -0xc(%rbp),%esi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x90,%rsp
lea    0xef1(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
pxor   %xmm5,%xmm5
movdqa 0xead(%rip),%xmm0
movdqa 0xeb5(%rip),%xmm1
pxor   %xmm4,%xmm4
nop
movd   0x4(%rsp,%rbx,1),%xmm2
movdqa (%rsp,%rbx,1),%xmm3
pcmpeqb %xmm0,%xmm3
punpcklbw %xmm3,%xmm3
punpcklwd %xmm3,%xmm3
pand   %xmm1,%xmm3
paddd  %xmm5,%xmm3
pcmpeqb %xmm0,%xmm2
punpcklbw %xmm2,%xmm2
punpcklwd %xmm2,%xmm2
pand   %xmm1,%xmm2
paddd  %xmm4,%xmm2
cmp    $0x80,%rbx
je     11de <main+0xbe>
movq   0x8(%rsp,%rbx,1),%xmm4
movd   0xc(%rsp,%rbx,1),%xmm5
pcmpeqb %xmm0,%xmm4
punpcklbw %xmm4,%xmm4
punpcklwd %xmm4,%xmm4
pand   %xmm1,%xmm4
pcmpeqb %xmm0,%xmm5
punpcklbw %xmm5,%xmm5
punpcklwd %xmm5,%xmm5
pand   %xmm1,%xmm5
paddd  %xmm4,%xmm3
paddd  %xmm5,%xmm2
add    $0x10,%rbx
movdqa %xmm3,%xmm5
movdqa %xmm2,%xmm4
jmp    1160 <main+0x40>
paddd  %xmm3,%xmm2
pshufd $0xee,%xmm2,%xmm0
paddd  %xmm2,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%eax
xor    %ecx,%ecx
cmpb   $0x23,0x88(%rsp)
23
sete   %cl
add    %eax,%ecx
xor    %eax,%eax
cmpb   $0x23,0x89(%rsp)
23
sete   %al
add    %ecx,%eax
xor    %ecx,%ecx
cmpb   $0x23,0x8a(%rsp)
23
sete   %cl
add    %eax,%ecx
xor    %esi,%esi
cmpb   $0x23,0x8b(%rsp)
23
sete   %sil
add    %ecx,%esi
lea    0xdfc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"\0AEntre com um tweet:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [31 x i8] c"Este tweet possui %d hashtags.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [140 x i8]
store i32 0, i32* %1
store i32 0, i32* %3
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [140 x i8], [140 x i8]* %4, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
store i32 0, i32* %2
br label %8
8: ; preds = %22, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 140
br i1 %10, label %11, label %25
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [140 x i8], [140 x i8]* %4, i64 0, i64 %13
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 35
br i1 %17, label %18, label %21
18: ; preds = %11
%19 = load i32, i32* %3
%20 = add nsw i32 %19, 1
store i32 %20, i32* %3
br label %21
21: ; preds = %18, %11
br label %22
22: ; preds = %21
%23 = load i32, i32* %2
%24 = add nsw i32 %23, 1
store i32 %24, i32* %2
br label %8
25: ; preds = %8
%26 = load i32, i32* %3
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"\0AEntre com um tweet:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [31 x i8] c"Este tweet possui %d hashtags.\00"
define i32 @main() {
%1 = alloca [140 x i8]
%2 = getelementptr inbounds [140 x i8], [140 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %5
5: ; preds = %23, %0
%6 = phi i64 [ 0, %0 ], [ %36, %23 ]
%7 = phi <4 x i32> [ zeroinitializer, %0 ], [ %34, %23 ]
%8 = phi <4 x i32> [ zeroinitializer, %0 ], [ %35, %23 ]
%9 = getelementptr inbounds [140 x i8], [140 x i8]* %1, i64 0, i64 %6
%10 = bitcast i8* %9 to <4 x i8>*
%11 = load <4 x i8>, <4 x i8>* %10
%12 = getelementptr inbounds i8, i8* %9, i64 4
%13 = bitcast i8* %12 to <4 x i8>*
%14 = load <4 x i8>, <4 x i8>* %13
%15 = icmp eq <4 x i8> %11, <i8 35, i8 35, i8 35, i8 35>
%16 = icmp eq <4 x i8> %14, <i8 35, i8 35, i8 35, i8 35>
%17 = zext <4 x i1> %15 to <4 x i32>
%18 = zext <4 x i1> %16 to <4 x i32>
%19 = add <4 x i32> %7, %17
%20 = add <4 x i32> %8, %18
%21 = or i64 %6, 8
%22 = icmp eq i64 %21, 136
br i1 %22, label %37, label %23
23: ; preds = %5
%24 = getelementptr inbounds [140 x i8], [140 x i8]* %1, i64 0, i64 %21
%25 = bitcast i8* %24 to <4 x i8>*
%26 = load <4 x i8>, <4 x i8>* %25
%27 = getelementptr inbounds i8, i8* %24, i64 4
%28 = bitcast i8* %27 to <4 x i8>*
%29 = load <4 x i8>, <4 x i8>* %28
%30 = icmp eq <4 x i8> %26, <i8 35, i8 35, i8 35, i8 35>
%31 = icmp eq <4 x i8> %29, <i8 35, i8 35, i8 35, i8 35>
%32 = zext <4 x i1> %30 to <4 x i32>
%33 = zext <4 x i1> %31 to <4 x i32>
%34 = add <4 x i32> %19, %32
%35 = add <4 x i32> %20, %33
%36 = add nuw nsw i64 %6, 16
br label %5
37: ; preds = %5
%38 = add <4 x i32> %20, %19
%39 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %38)
%40 = getelementptr inbounds [140 x i8], [140 x i8]* %1, i64 0, i64 136
%41 = load i8, i8* %40
%42 = icmp eq i8 %41, 35
%43 = zext i1 %42 to i32
%44 = add nuw nsw i32 %39, %43
%45 = getelementptr inbounds [140 x i8], [140 x i8]* %1, i64 0, i64 137
%46 = load i8, i8* %45
%47 = icmp eq i8 %46, 35
%48 = zext i1 %47 to i32
%49 = add nuw nsw i32 %44, %48
%50 = getelementptr inbounds [140 x i8], [140 x i8]* %1, i64 0, i64 138
%51 = load i8, i8* %50
%52 = icmp eq i8 %51, 35
%53 = zext i1 %52 to i32
%54 = add nuw nsw i32 %49, %53
%55 = getelementptr inbounds [140 x i8], [140 x i8]* %1, i64 0, i64 139
%56 = load i8, i8* %55
%57 = icmp eq i8 %56, 35
%58 = zext i1 %57 to i32
%59 = add nuw nsw i32 %54, %58
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %59)
ret i32 0
}