#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*/ STDOUT_FILENO;
int /*<<< orphan*/ SYS_write;
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ syscall(int /*<<< orphan*/, int /*<<< orphan*/, char *,
                           int /*<<< orphan*/);
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) {
    syscall(SYS_write, STDOUT_FILENO, "Process Name      : \t\t",
            strlen("Process Name      : \t\t"));
    syscall(SYS_write, STDOUT_FILENO, line, strlen(line));
  }
  if (l[0] == 'S' && len == 5) {
    syscall(SYS_write, STDOUT_FILENO, "Process Status    : \t\t",
            strlen("Process Status    : \t\t"));
    syscall(SYS_write, STDOUT_FILENO, line, strlen(line));
  }
  if (l[0] == 'P' && len == 4) {
    syscall(SYS_write, STDOUT_FILENO, "Parent PID        : \t\t",
            strlen("Parent PID        : \t\t"));
    syscall(SYS_write, STDOUT_FILENO, line, strlen(line));
  }
  if (l[0] == 'T' && len == 7) {
    syscall(SYS_write, STDOUT_FILENO, "Threads           : \t\t",
            strlen("Threads           : \t\t"));
    syscall(SYS_write, STDOUT_FILENO, line, strlen(line));
  }
}


x86 assembly (clang, -O0):
<findAndPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%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     1163 <findAndPrint+0x43>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1173 <findAndPrint+0x53>
jmp    118d <findAndPrint+0x6d>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113e <findAndPrint+0x1e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x4e,%eax
jne    1236 <findAndPrint+0x116>
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x61,%eax
jne    1236 <findAndPrint+0x116>
cmpl   $0x4,-0x14(%rbp)
jne    1236 <findAndPrint+0x116>
mov    0x2e15(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    0x2e19(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
lea    0xe1d(%rip),%rdi
call   1030 <strlen@plt>
mov    -0x30(%rbp),%edi
mov    -0x2c(%rbp),%esi
mov    %eax,%ecx
lea    0xe09(%rip),%rdx
call   1040 <syscall@plt>
mov    0x2ddd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2de1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x28(%rbp),%edi
mov    -0x24(%rbp),%esi
mov    -0x20(%rbp),%rdx
mov    %eax,%ecx
call   1040 <syscall@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x53,%eax
jne    12c2 <findAndPrint+0x1a2>
cmpl   $0x5,-0x14(%rbp)
jne    12c2 <findAndPrint+0x1a2>
mov    0x2d89(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
lea    0xda8(%rip),%rdi
call   1030 <strlen@plt>
mov    -0x48(%rbp),%edi
mov    -0x44(%rbp),%esi
mov    %eax,%ecx
lea    0xd94(%rip),%rdx
call   1040 <syscall@plt>
mov    0x2d51(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
mov    0x2d55(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x40(%rbp),%edi
mov    -0x3c(%rbp),%esi
mov    -0x38(%rbp),%rdx
mov    %eax,%ecx
call   1040 <syscall@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x50,%eax
jne    134e <findAndPrint+0x22e>
cmpl   $0x4,-0x14(%rbp)
jne    134e <findAndPrint+0x22e>
mov    0x2cfd(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
mov    0x2d01(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
lea    0xd33(%rip),%rdi
call   1030 <strlen@plt>
mov    -0x60(%rbp),%edi
mov    -0x5c(%rbp),%esi
mov    %eax,%ecx
lea    0xd1f(%rip),%rdx
call   1040 <syscall@plt>
mov    0x2cc5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x58(%rbp)
mov    0x2cc9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x58(%rbp),%edi
mov    -0x54(%rbp),%esi
mov    -0x50(%rbp),%rdx
mov    %eax,%ecx
call   1040 <syscall@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x54,%eax
jne    13da <findAndPrint+0x2ba>
cmpl   $0x7,-0x14(%rbp)
jne    13da <findAndPrint+0x2ba>
mov    0x2c71(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x78(%rbp)
mov    0x2c75(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x74(%rbp)
lea    0xcbe(%rip),%rdi
call   1030 <strlen@plt>
mov    -0x78(%rbp),%edi
mov    -0x74(%rbp),%esi
mov    %eax,%ecx
lea    0xcaa(%rip),%rdx
call   1040 <syscall@plt>
mov    0x2c39(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x70(%rbp)
mov    0x2c3d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x6c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x70(%rbp),%edi
mov    -0x6c(%rbp),%esi
mov    -0x68(%rbp),%rdx
mov    %eax,%ecx
call   1040 <syscall@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findAndPrint>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %ebp,%ebp
movzbl (%rbx,%rbp,1),%eax
test   %al,%al
je     1142 <findAndPrint+0x22>
cmp    $0x3a,%al
je     1142 <findAndPrint+0x22>
add    $0x1,%rbp
jmp    1130 <findAndPrint+0x10>
lea    (%rbx,%rbp,1),%r14
add    $0x1,%r14
mov    (%rbx),%al
cmp    $0x4e,%al
jne    11c6 <findAndPrint+0xa6>
cmpb   $0x61,0x1(%rbx)
jne    1253 <findAndPrint+0x133>
cmp    $0x4,%ebp
jne    1253 <findAndPrint+0x133>
mov    0x2e76(%rip),%rax
mov    (%rax),%r15d
mov    0x2e7c(%rip),%rax
mov    (%rax),%r13d
lea    0xe82(%rip),%r12
mov    %r12,%rdi
call   1030 <strlen@plt>
mov    %r15d,%edi
mov    %r13d,%esi
mov    %r12,%rdx
mov    %eax,%ecx
call   1040 <syscall@plt>
mov    0x2e43(%rip),%rax
mov    (%rax),%r12d
mov    0x2e49(%rip),%rax
mov    (%rax),%r15d
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %r12d,%edi
mov    %r15d,%esi
mov    %r14,%rdx
mov    %eax,%ecx
call   1040 <syscall@plt>
mov    (%rbx),%al
jmp    11d8 <findAndPrint+0xb8>
cmp    $0x53,%al
jne    11d8 <findAndPrint+0xb8>
cmp    $0x5,%ebp
jne    11d8 <findAndPrint+0xb8>
lea    0xe41(%rip),%rbx
jmp    11fa <findAndPrint+0xda>
cmp    $0x50,%al
jne    11ea <findAndPrint+0xca>
cmp    $0x4,%ebp
jne    11ea <findAndPrint+0xca>
lea    0xe46(%rip),%rbx
jmp    11fa <findAndPrint+0xda>
cmp    $0x54,%al
jne    1253 <findAndPrint+0x133>
cmp    $0x7,%ebp
jne    1253 <findAndPrint+0x133>
lea    0xe4b(%rip),%rbx
mov    0x2ddf(%rip),%r12
mov    (%r12),%r15d
mov    0x2de4(%rip),%r13
mov    0x0(%r13),%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %r15d,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
call   1040 <syscall@plt>
mov    (%r12),%ebx
mov    0x0(%r13),%ebp
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %eax,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <syscall@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@SYS_write = global i32 0
@STDOUT_FILENO = global i32 0
@.str = [23 x i8] c"Process Name : \09\09\00"
@.str.1 = [23 x i8] c"Process Status : \09\09\00"
@.str.2 = [23 x i8] c"Parent PID : \09\09\00"
@.str.3 = [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 %51
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 %51
37: ; preds = %31
%38 = load i32, i32* %4
%39 = icmp eq i32 %38, 4
br i1 %39, label %40, label %51
40: ; preds = %37
%41 = load i32, i32* @SYS_write
%42 = load i32, i32* @STDOUT_FILENO
%43 = call i32 @strlen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%44 = call i32 @syscall(i32 %41, i32 %42, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %43)
%45 = load i32, i32* @SYS_write
%46 = load i32, i32* @STDOUT_FILENO
%47 = load i8*, i8** %3
%48 = load i8*, i8** %3
%49 = call i32 @strlen(i8* %48)
%50 = call i32 @syscall(i32 %45, i32 %46, i8* %47, i32 %49)
br label %51
51: ; preds = %40, %37, %31, %23
%52 = load i8*, i8** %2
%53 = getelementptr inbounds i8, i8* %52, i64 0
%54 = load i8, i8* %53
%55 = sext i8 %54 to i32
%56 = icmp eq i32 %55, 83
br i1 %56, label %57, label %71
57: ; preds = %51
%58 = load i32, i32* %4
%59 = icmp eq i32 %58, 5
br i1 %59, label %60, label %71
60: ; preds = %57
%61 = load i32, i32* @SYS_write
%62 = load i32, i32* @STDOUT_FILENO
%63 = call i32 @strlen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
%64 = call i32 @syscall(i32 %61, i32 %62, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %63)
%65 = load i32, i32* @SYS_write
%66 = load i32, i32* @STDOUT_FILENO
%67 = load i8*, i8** %3
%68 = load i8*, i8** %3
%69 = call i32 @strlen(i8* %68)
%70 = call i32 @syscall(i32 %65, i32 %66, i8* %67, i32 %69)
br label %71
71: ; preds = %60, %57, %51
%72 = load i8*, i8** %2
%73 = getelementptr inbounds i8, i8* %72, i64 0
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp eq i32 %75, 80
br i1 %76, label %77, label %91
77: ; preds = %71
%78 = load i32, i32* %4
%79 = icmp eq i32 %78, 4
br i1 %79, label %80, label %91
80: ; preds = %77
%81 = load i32, i32* @SYS_write
%82 = load i32, i32* @STDOUT_FILENO
%83 = call i32 @strlen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%84 = call i32 @syscall(i32 %81, i32 %82, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %83)
%85 = load i32, i32* @SYS_write
%86 = load i32, i32* @STDOUT_FILENO
%87 = load i8*, i8** %3
%88 = load i8*, i8** %3
%89 = call i32 @strlen(i8* %88)
%90 = call i32 @syscall(i32 %85, i32 %86, i8* %87, i32 %89)
br label %91
91: ; preds = %80, %77, %71
%92 = load i8*, i8** %2
%93 = getelementptr inbounds i8, i8* %92, i64 0
%94 = load i8, i8* %93
%95 = sext i8 %94 to i32
%96 = icmp eq i32 %95, 84
br i1 %96, label %97, label %111
97: ; preds = %91
%98 = load i32, i32* %4
%99 = icmp eq i32 %98, 7
br i1 %99, label %100, label %111
100: ; preds = %97
%101 = load i32, i32* @SYS_write
%102 = load i32, i32* @STDOUT_FILENO
%103 = call i32 @strlen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%104 = call i32 @syscall(i32 %101, i32 %102, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i32 %103)
%105 = load i32, i32* @SYS_write
%106 = load i32, i32* @STDOUT_FILENO
%107 = load i8*, i8** %3
%108 = load i8*, i8** %3
%109 = call i32 @strlen(i8* %108)
%110 = call i32 @syscall(i32 %105, i32 %106, i8* %107, i32 %109)
br label %111
111: ; preds = %100, %97, %91
ret void
}

LLVM IR (-O2):
@SYS_write = global i32 0
@STDOUT_FILENO = global i32 0
@.str = [23 x i8] c"Process Name : \09\09\00"
@.str.1 = [23 x i8] c"Process Status : \09\09\00"
@.str.2 = [23 x i8] c"Parent PID : \09\09\00"
@.str.3 = [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 %29
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 %52
19: ; preds = %13
%20 = load i32, i32* @SYS_write
%21 = load i32, i32* @STDOUT_FILENO
%22 = tail call i32 @strlen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%23 = tail call i32 @syscall(i32 %20, i32 %21, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %22)
%24 = load i32, i32* @SYS_write
%25 = load i32, i32* @STDOUT_FILENO
%26 = tail call i32 @strlen(i8* %10)
%27 = tail call i32 @syscall(i32 %24, i32 %25, i8* %10, i32 %26)
%28 = load i8, i8* %0
br label %33
29: ; preds = %9
%30 = icmp eq i8 %11, 83
%31 = icmp eq i32 %4, 5
%32 = select i1 %30, i1 %31, i1 false
br i1 %32, label %42, label %33
33: ; preds = %19, %29
%34 = phi i8 [ %28, %19 ], [ %11, %29 ]
%35 = icmp eq i8 %34, 80
%36 = icmp eq i32 %4, 4
%37 = select i1 %35, i1 %36, i1 false
br i1 %37, label %42, label %38
38: ; preds = %33
%39 = icmp eq i8 %34, 84
%40 = icmp eq i32 %4, 7
%41 = select i1 %39, i1 %40, i1 false
br i1 %41, label %42, label %52
42: ; preds = %38, %33, %29
%43 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), %29 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), %33 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), %38 ]
%44 = load i32, i32* @SYS_write
%45 = load i32, i32* @STDOUT_FILENO
%46 = tail call i32 @strlen(i8* %43)
%47 = tail call i32 @syscall(i32 %44, i32 %45, i8* %43, i32 %46)
%48 = load i32, i32* @SYS_write
%49 = load i32, i32* @STDOUT_FILENO
%50 = tail call i32 @strlen(i8* %10)
%51 = tail call i32 @syscall(i32 %48, i32 %49, i8* %10, i32 %50)
br label %52
52: ; preds = %42, %13, %38
ret void
}