#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 *, ...);
void findAndPrint(char *l) {
  char *line = l;
  int len = 0;
  while (*line != ':' && *line) {
    line++;
    len++;
  }
  line++;
  if (l[0] == 'N' && l[1] == 'a' && len == 4) {
    printf("Process Name      : \t\t");
    printf("%s", line);
  }
  if (l[0] == 'S' && len == 5) {
    printf("Process Status    : \t\t");
    printf("%s", line);
  }
  if (l[0] == 'P' && len == 4) {
    printf("Parent PID        : \t\t");
    printf("%s", line);
  }
  if (l[0] == 'T' && len == 7) {
    printf("Threads           : \t\t");
    printf("%s", line);
  }
}


x86 assembly (clang, -O0):
<findAndPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x3a,%ecx
mov    %al,-0x15(%rbp)
je     1150 <findAndPrint+0x40>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1160 <findAndPrint+0x50>
jmp    117a <findAndPrint+0x6a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112b <findAndPrint+0x1b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x4e,%eax
jne    11d1 <findAndPrint+0xc1>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x61,%eax
jne    11d1 <findAndPrint+0xc1>
cmpl   $0x4,-0x14(%rbp)
jne    11d1 <findAndPrint+0xc1>
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x53,%eax
jne    120b <findAndPrint+0xfb>
cmpl   $0x5,-0x14(%rbp)
jne    120b <findAndPrint+0xfb>
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe13(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x50,%eax
jne    1245 <findAndPrint+0x135>
cmpl   $0x4,-0x14(%rbp)
jne    1245 <findAndPrint+0x135>
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x54,%eax
jne    127f <findAndPrint+0x16f>
cmpl   $0x7,-0x14(%rbp)
jne    127f <findAndPrint+0x16f>
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
lea    0xd9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findAndPrint>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movzbl (%r15,%rbx,1),%eax
test   %al,%al
je     1133 <findAndPrint+0x23>
cmp    $0x3a,%al
je     1133 <findAndPrint+0x23>
add    $0x1,%rbx
jmp    1120 <findAndPrint+0x10>
lea    (%r15,%rbx,1),%r14
add    $0x1,%r14
mov    (%r15),%al
cmp    $0x4e,%al
jne    1172 <findAndPrint+0x62>
cmpb   $0x61,0x1(%r15)
jne    11c3 <findAndPrint+0xb3>
cmp    $0x4,%ebx
jne    11c3 <findAndPrint+0xb3>
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r15),%al
jmp    1184 <findAndPrint+0x74>
cmp    $0x53,%al
jne    1184 <findAndPrint+0x74>
cmp    $0x5,%ebx
jne    1184 <findAndPrint+0x74>
lea    0xe98(%rip),%rdi
jmp    11a6 <findAndPrint+0x96>
cmp    $0x50,%al
jne    1196 <findAndPrint+0x86>
cmp    $0x4,%ebx
jne    1196 <findAndPrint+0x86>
lea    0xe9d(%rip),%rdi
jmp    11a6 <findAndPrint+0x96>
cmp    $0x54,%al
jne    11c3 <findAndPrint+0xb3>
cmp    $0x7,%ebx
jne    11c3 <findAndPrint+0xb3>
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe63(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <printf@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Process Name : \09\09\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [23 x i8] c"Process Status : \09\09\00"
@.str.3 = [23 x i8] c"Parent PID : \09\09\00"
@.str.4 = [23 x i8] c"Threads : \09\09\00"
define void @findAndPrint(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
store i8* %5, i8** %3
store i32 0, i32* %4
br label %6
6: ; preds = %18, %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 58
br i1 %10, label %11, label %16
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 0
br label %16
16: ; preds = %11, %6
%17 = phi i1 [ false, %6 ], [ %15, %11 ]
br i1 %17, label %18, label %23
18: ; preds = %16
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %6
23: ; preds = %16
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %3
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i64 0
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 78
br i1 %30, label %31, label %44
31: ; preds = %23
%32 = load i8*, i8** %2
%33 = getelementptr inbounds i8, i8* %32, i64 1
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 97
br i1 %36, label %37, label %44
37: ; preds = %31
%38 = load i32, i32* %4
%39 = icmp eq i32 %38, 4
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%42 = load i8*, i8** %3
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %42)
br label %44
44: ; preds = %40, %37, %31, %23
%45 = load i8*, i8** %2
%46 = getelementptr inbounds i8, i8* %45, i64 0
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 83
br i1 %49, label %50, label %57
50: ; preds = %44
%51 = load i32, i32* %4
%52 = icmp eq i32 %51, 5
br i1 %52, label %53, label %57
53: ; preds = %50
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%55 = load i8*, i8** %3
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %55)
br label %57
57: ; preds = %53, %50, %44
%58 = load i8*, i8** %2
%59 = getelementptr inbounds i8, i8* %58, i64 0
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 80
br i1 %62, label %63, label %70
63: ; preds = %57
%64 = load i32, i32* %4
%65 = icmp eq i32 %64, 4
br i1 %65, label %66, label %70
66: ; preds = %63
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%68 = load i8*, i8** %3
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %68)
br label %70
70: ; preds = %66, %63, %57
%71 = load i8*, i8** %2
%72 = getelementptr inbounds i8, i8* %71, i64 0
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = icmp eq i32 %74, 84
br i1 %75, label %76, label %83
76: ; preds = %70
%77 = load i32, i32* %4
%78 = icmp eq i32 %77, 7
br i1 %78, label %79, label %83
79: ; preds = %76
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%81 = load i8*, i8** %3
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %81)
br label %83
83: ; preds = %79, %76, %70
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"Process Name : \09\09\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [23 x i8] c"Process Status : \09\09\00"
@.str.3 = [23 x i8] c"Parent PID : \09\09\00"
@.str.4 = [23 x i8] c"Threads : \09\09\00"
define void @findAndPrint(i8* %0) {
br label %2
2: ; preds = %6, %1
%3 = phi i8* [ %0, %1 ], [ %7, %6 ]
%4 = phi i32 [ 0, %1 ], [ %8, %6 ]
%5 = load i8, i8* %3
switch i8 %5, label %6 [
i8 58, label %9
i8 0, label %9
]
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
%8 = add nuw nsw i32 %4, 1
br label %2
9: ; preds = %2, %2
%10 = getelementptr inbounds i8, i8* %3, i64 1
%11 = load i8, i8* %0
%12 = icmp eq i8 %11, 78
br i1 %12, label %13, label %23
13: ; preds = %9
%14 = getelementptr inbounds i8, i8* %0, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 97
%17 = icmp eq i32 %4, 4
%18 = select i1 %16, i1 %17, i1 false
br i1 %18, label %19, label %40
19: ; preds = %13
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%22 = load i8, i8* %0
br label %27
23: ; preds = %9
%24 = icmp eq i8 %11, 83
%25 = icmp eq i32 %4, 5
%26 = select i1 %24, i1 %25, i1 false
br i1 %26, label %36, label %27
27: ; preds = %19, %23
%28 = phi i8 [ %22, %19 ], [ %11, %23 ]
%29 = icmp eq i8 %28, 80
%30 = icmp eq i32 %4, 4
%31 = select i1 %29, i1 %30, i1 false
br i1 %31, label %36, label %32
32: ; preds = %27
%33 = icmp eq i8 %28, 84
%34 = icmp eq i32 %4, 7
%35 = select i1 %33, i1 %34, i1 false
br i1 %35, label %36, label %40
36: ; preds = %32, %27, %23
%37 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), %23 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), %27 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), %32 ]
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %37)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %40
40: ; preds = %36, %13, %32
ret void
}