#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 strlen(char *);
char *FindPointer(char *yytext) {
  printf("Lunghezza: %d \n ", (int)strlen(yytext));
  int i = 0;
  char *punt;
  while (yytext[i] != ' ' && yytext[i] != '\t' && i < strlen(yytext) - 1)
    i++;
  while ((yytext[i] == ' ' || yytext[i] == '\t') && i < strlen(yytext) - 1)
    i++;
  punt = yytext + i;
  return punt;
}


x86 assembly (clang, -O0):
<FindPointer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x19(%rbp)
je     119d <FindPointer+0x7d>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0x19(%rbp)
je     119d <FindPointer+0x7d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
setl   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11ad <FindPointer+0x8d>
jmp    11bb <FindPointer+0x9b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114a <FindPointer+0x2a>
jmp    11c0 <FindPointer+0xa0>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     11ef <FindPointer+0xcf>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0x21(%rbp)
jne    120e <FindPointer+0xee>
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
setl   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    121e <FindPointer+0xfe>
jmp    122c <FindPointer+0x10c>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c0 <FindPointer+0xa0>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FindPointer>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
lea    0xecd(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %ebx,%ebx
nopl   0x0(%rax)
movzbl (%r14,%rbx,1),%eax
cmp    $0x9,%al
je     1186 <FindPointer+0x66>
cmp    $0x20,%al
je     1186 <FindPointer+0x66>
mov    %r14,%rdi
call   1030 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmp    %rax,%rbx
jge    1186 <FindPointer+0x66>
add    $0x1,%rbx
jmp    1140 <FindPointer+0x20>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
call   1030 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmp    %rax,%rbx
jge    1193 <FindPointer+0x73>
add    $0x1,%rbx
movzbl (%r14,%rbx,1),%eax
cmp    $0x20,%al
je     1170 <FindPointer+0x50>
cmp    $0x9,%al
je     1170 <FindPointer+0x50>
add    %rbx,%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Lunghezza: %d \0A \00"
define i8* @FindPointer(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %6)
store i32 0, i32* %3
br label %8
8: ; preds = %32, %1
%9 = load i8*, i8** %2
%10 = load i32, i32* %3
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 32
br i1 %15, label %16, label %30
16: ; preds = %8
%17 = load i8*, i8** %2
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 9
br i1 %23, label %24, label %30
24: ; preds = %16
%25 = load i32, i32* %3
%26 = load i8*, i8** %2
%27 = call i32 @strlen(i8* %26)
%28 = sub nsw i32 %27, 1
%29 = icmp slt i32 %25, %28
br label %30
30: ; preds = %24, %16, %8
%31 = phi i1 [ false, %16 ], [ false, %8 ], [ %29, %24 ]
br i1 %31, label %32, label %35
32: ; preds = %30
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %8
35: ; preds = %30
br label %36
36: ; preds = %60, %35
%37 = load i8*, i8** %2
%38 = load i32, i32* %3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8, i8* %37, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 32
br i1 %43, label %52, label %44
44: ; preds = %36
%45 = load i8*, i8** %2
%46 = load i32, i32* %3
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %45, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 9
br i1 %51, label %52, label %58
52: ; preds = %44, %36
%53 = load i32, i32* %3
%54 = load i8*, i8** %2
%55 = call i32 @strlen(i8* %54)
%56 = sub nsw i32 %55, 1
%57 = icmp slt i32 %53, %56
br label %58
58: ; preds = %52, %44
%59 = phi i1 [ false, %44 ], [ %57, %52 ]
br i1 %59, label %60, label %63
60: ; preds = %58
%61 = load i32, i32* %3
%62 = add nsw i32 %61, 1
store i32 %62, i32* %3
br label %36
63: ; preds = %58
%64 = load i8*, i8** %2
%65 = load i32, i32* %3
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8, i8* %64, i64 %66
store i8* %67, i8** %4
%68 = load i8*, i8** %4
ret i8* %68
}

LLVM IR (-O2):
@.str = [17 x i8] c"Lunghezza: %d \0A \00"
define i8* @FindPointer(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %4
4: ; preds = %13, %1
%5 = phi i64 [ %14, %13 ], [ 0, %1 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
switch i8 %7, label %8 [
i8 32, label %15
i8 9, label %15
]
8: ; preds = %4
%9 = tail call i32 @strlen(i8* %0)
%10 = add nsw i32 %9, -1
%11 = sext i32 %10 to i64
%12 = icmp slt i64 %5, %11
br i1 %12, label %13, label %15
13: ; preds = %8
%14 = add nuw nsw i64 %5, 1
br label %4
15: ; preds = %4, %4, %8
%16 = and i64 %5, 4294967295
br label %17
17: ; preds = %26, %15
%18 = phi i64 [ %27, %26 ], [ %16, %15 ]
%19 = getelementptr inbounds i8, i8* %0, i64 %18
%20 = load i8, i8* %19
switch i8 %20, label %28 [
i8 32, label %21
i8 9, label %21
]
21: ; preds = %17, %17
%22 = tail call i32 @strlen(i8* %0)
%23 = add nsw i32 %22, -1
%24 = sext i32 %23 to i64
%25 = icmp slt i64 %18, %24
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = add nuw nsw i64 %18, 1
br label %17
28: ; preds = %17, %21
%29 = and i64 %18, 4294967295
%30 = getelementptr inbounds i8, i8* %0, i64 %29
ret i8* %30
}