#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 EOF;
int /*<<< orphan*/ copystr();
int getchar();
scalar_t__ match(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ putchar(int);
void process() {
  register int c;
  for (;;) {
    c = getchar();
    if (c == EOF)
      return;
    if (c != 's') {
      putchar(c);
      continue;
    }
    if (match("strstr(")) {
      printf("strstr(");
      c = getchar();
      if (c != '"')
        putchar(c);
      else
        copystr();
    }
  }
}


x86 assembly (clang, -O0):
<process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2e7c(%rip),%rcx
cmp    (%rcx),%eax
jne    117a <process+0x2a>
add    $0x10,%rsp
pop    %rbp
ret
cmpl   $0x73,-0x4(%rbp)
je     1191 <process+0x41>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
jmp    1158 <process+0x8>
lea    0xe68(%rip),%rdi
call   1070 <match@plt>
cmp    $0x0,%rax
je     11e0 <process+0x90>
lea    0xe52(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getchar@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x22,-0x4(%rbp)
je     11d4 <process+0x84>
mov    -0x4(%rbp),%edi
call   1030 <putchar@plt>
jmp    11db <process+0x8b>
mov    $0x0,%al
call   1050 <copystr@plt>
jmp    11e0 <process+0x90>
jmp    1158 <process+0x8>

x86 assembly (clang, -O2):
<process>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1060 <getchar@plt>
mov    0x2e86(%rip),%rbx
cmp    (%rbx),%eax
jne    116e <process+0x1e>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe8b(%rip),%r14
jmp    1192 <process+0x42>
nopw   0x0(%rax,%rax,1)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    (%rbx),%eax
je     1166 <process+0x16>
cmp    $0x73,%eax
jne    1180 <process+0x30>
mov    %r14,%rdi
call   1070 <match@plt>
test   %rax,%rax
je     1187 <process+0x37>
mov    %r14,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
cmp    $0x22,%eax
jne    1180 <process+0x30>
xor    %eax,%eax
call   1050 <copystr@plt>
jmp    1187 <process+0x37>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [8 x i8] c"strstr(\00"
define void @process() {
%1 = alloca i32
br label %2
2: ; preds = %28, %11, %0
%3 = call i32 (...) @getchar()
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = load i32, i32* @EOF
%6 = icmp eq i32 %4, %5
br i1 %6, label %7, label %8
7: ; preds = %2
ret void
8: ; preds = %2
%9 = load i32, i32* %1
%10 = icmp ne i32 %9, 115
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %1
%13 = call i32 @putchar(i32 %12)
br label %2
14: ; preds = %8
%15 = call i64 @match(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%19 = call i32 (...) @getchar()
store i32 %19, i32* %1
%20 = load i32, i32* %1
%21 = icmp ne i32 %20, 34
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = load i32, i32* %1
%24 = call i32 @putchar(i32 %23)
br label %27
25: ; preds = %17
%26 = call i32 (...) @copystr()
br label %27
27: ; preds = %25, %22
br label %28
28: ; preds = %27, %14
br label %2
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [8 x i8] c"strstr(\00"
define void @process() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %4, label %5
4: ; preds = %10, %0
ret void
5: ; preds = %0, %10
%6 = phi i32 [ %11, %10 ], [ %1, %0 ]
%7 = icmp eq i32 %6, 115
br i1 %7, label %14, label %8
8: ; preds = %5
%9 = tail call i32 @putchar(i32 %6)
br label %10
10: ; preds = %14, %23, %21, %8
%11 = tail call i32 (...) @getchar()
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %4, label %5
14: ; preds = %5
%15 = tail call i64 @match(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %10, label %17
17: ; preds = %14
%18 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%19 = tail call i32 (...) @getchar()
%20 = icmp eq i32 %19, 34
br i1 %20, label %23, label %21
21: ; preds = %17
%22 = tail call i32 @putchar(i32 %19)
br label %10
23: ; preds = %17
%24 = tail call i32 (...) @copystr()
br label %10
}