#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*/ strcpy(char *, char *);
int strlen(char *);
int getNumberOfValues(char *string) {
  int i = strlen(string + 1), j;
  char copy[i];
  strcpy(copy, string);
  i = 0;
  for (j = 0; copy[j]; j++)
    if (copy[j] == '!') {
      i++;
    }
  return i + 1;
}


x86 assembly (clang, -O0):
<getNumberOfValues>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x28(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     11bc <getNumberOfValues+0x9c>
mov    -0x28(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x21,%eax
jne    11a9 <getNumberOfValues+0x89>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ae <getNumberOfValues+0x8e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1179 <getNumberOfValues+0x59>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNumberOfValues>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %rdi,%r14
add    $0x1,%rdi
call   1040 <strlen@plt>
mov    %eax,%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
xor    %eax,%eax
jmp    1167 <getNumberOfValues+0x47>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
add    $0x1,%rbx
movzbl (%rbx),%ecx
cmp    $0x21,%cl
je     1160 <getNumberOfValues+0x40>
test   %cl,%cl
jne    1163 <getNumberOfValues+0x43>
add    $0x1,%eax
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getNumberOfValues(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %3
%10 = load i32, i32* %3
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %5
%13 = alloca i8, i64 %11
store i64 %11, i64* %6
%14 = load i8*, i8** %2
%15 = call i32 @strcpy(i8* %13, i8* %14)
store i32 0, i32* %3
store i32 0, i32* %4
br label %16
16: ; preds = %33, %1
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %13, i64 %18
%20 = load i8, i8* %19
%21 = icmp ne i8 %20, 0
br i1 %21, label %22, label %36
22: ; preds = %16
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %13, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 33
br i1 %28, label %29, label %32
29: ; preds = %22
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %32
32: ; preds = %29, %22
br label %33
33: ; preds = %32
%34 = load i32, i32* %4
%35 = add nsw i32 %34, 1
store i32 %35, i32* %4
br label %16
36: ; preds = %16
%37 = load i32, i32* %3
%38 = add nsw i32 %37, 1
%39 = load i8*, i8** %5
ret i32 %38
}

LLVM IR (-O2):
define i32 @getNumberOfValues(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = tail call i32 @strlen(i8* %2)
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = call i32 @strcpy(i8* %5, i8* %0)
br label %7
7: ; preds = %14, %1
%8 = phi i64 [ %16, %14 ], [ 0, %1 ]
%9 = phi i32 [ %15, %14 ], [ 0, %1 ]
%10 = getelementptr inbounds i8, i8* %5, i64 %8
%11 = load i8, i8* %10
switch i8 %11, label %14 [
i8 0, label %17
i8 33, label %12
]
12: ; preds = %7
%13 = add nsw i32 %9, 1
br label %14
14: ; preds = %7, %12
%15 = phi i32 [ %13, %12 ], [ %9, %7 ]
%16 = add nuw i64 %8, 1
br label %7
17: ; preds = %7
%18 = add nsw i32 %9, 1
ret i32 %18
}