#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 any(char *, char *);
int getchar();
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int c;
  char s[0x100][0x100];
  int i = 0;
  int j = 0;
  int space = 1;
  while ((c = getchar()) != EOF) {
    if (c == '\n') {
      s[i][j] = 0;
      if (i == 0)
        break;
      for (int x = 0; x <= i; x++)
        printf("string %d is %s\n", x, s[x]);
      printf("%s contains any of %s at %d\n", s[0], s[1], any(s[0], s[1]));
      i = 0;
      j = 0;
      space = 1;
    } else if (c == ' ') {
      if (!space) {
        s[i][j] = 0;
        space = 1;
        i++;
      }
    } else {
      if (space) {
        space = 0;
        j = 0;
      }
      s[i][j] = c;
      j++;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10030,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10014(%rbp)
movl   $0x0,-0x10018(%rbp)
movl   $0x1,-0x1001c(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2e77(%rip),%rcx
cmp    (%rcx),%eax
je     133e <main+0x20e>
cmpl   $0xa,-0x8(%rbp)
jne    128b <main+0x15b>
movslq -0x10014(%rbp),%rcx
lea    -0x10010(%rbp),%rax
shl    $0x8,%rcx
add    %rcx,%rax
movslq -0x10018(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
cmpl   $0x0,-0x10014(%rbp)
jne    11b5 <main+0x85>
jmp    133e <main+0x20e>
movl   $0x0,-0x10020(%rbp)
mov    -0x10020(%rbp),%eax
cmp    -0x10014(%rbp),%eax
jg     120e <main+0xde>
mov    -0x10020(%rbp),%esi
movslq -0x10020(%rbp),%rax
lea    -0x10010(%rbp),%rdx
shl    $0x8,%rax
add    %rax,%rdx
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10020(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10020(%rbp)
jmp    11bf <main+0x8f>
lea    -0x10010(%rbp),%rax
mov    %rax,-0x10030(%rbp)
lea    -0x10010(%rbp),%rax
add    $0x100,%rax
mov    %rax,-0x10028(%rbp)
lea    -0x10010(%rbp),%rdi
lea    -0x10010(%rbp),%rsi
add    $0x100,%rsi
call   1050 <any@plt>
mov    -0x10030(%rbp),%rsi
mov    -0x10028(%rbp),%rdx
mov    %eax,%ecx
lea    0xdb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10014(%rbp)
movl   $0x0,-0x10018(%rbp)
movl   $0x1,-0x1001c(%rbp)
jmp    1339 <main+0x209>
cmpl   $0x20,-0x8(%rbp)
jne    12e0 <main+0x1b0>
cmpl   $0x0,-0x1001c(%rbp)
jne    12db <main+0x1ab>
movslq -0x10014(%rbp),%rcx
lea    -0x10010(%rbp),%rax
shl    $0x8,%rcx
add    %rcx,%rax
movslq -0x10018(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x1,-0x1001c(%rbp)
mov    -0x10014(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10014(%rbp)
jmp    1334 <main+0x204>
cmpl   $0x0,-0x1001c(%rbp)
je     1301 <main+0x1d1>
movl   $0x0,-0x1001c(%rbp)
movl   $0x0,-0x10018(%rbp)
mov    -0x8(%rbp),%eax
mov    %al,%dl
movslq -0x10014(%rbp),%rcx
lea    -0x10010(%rbp),%rax
shl    $0x8,%rcx
add    %rcx,%rax
movslq -0x10018(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10018(%rbp)
jmp    1339 <main+0x209>
jmp    1160 <main+0x30>
mov    -0x4(%rbp),%eax
add    $0x10030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10008,%rsp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e99(%rip),%r15
cmp    (%r15),%eax
jne    1168 <main+0x38>
xor    %eax,%eax
add    $0x10008,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%ecx
mov    %rsp,%r12
lea    0xe89(%rip),%r13
xor    %ebx,%ebx
xor    %r14d,%r14d
jmp    11a8 <main+0x78>
xchg   %ax,%ax
xor    %ebp,%ebp
test   %ecx,%ecx
cmovne %ebp,%ebx
movslq %r14d,%rcx
movslq %ebx,%rbx
shl    $0x8,%rcx
add    %rsp,%rcx
mov    %al,(%rbx,%rcx,1)
add    $0x1,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %ebp,%ecx
cmp    (%r15),%eax
je     1154 <main+0x24>
cmp    $0x20,%eax
je     1240 <main+0x110>
cmp    $0xa,%eax
jne    1180 <main+0x50>
movslq %r14d,%rax
movslq %ebx,%rcx
shl    $0x8,%rax
add    %rsp,%rax
movb   $0x0,(%rcx,%rax,1)
test   %r14d,%r14d
je     1154 <main+0x24>
js     11ff <main+0xcf>
add    $0x1,%r14d
mov    %r12,%rbx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r13,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%rbp
add    $0x100,%rbx
cmp    %rbp,%r14
jne    11e0 <main+0xb0>
mov    %r12,%rdi
lea    0x100(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <any@plt>
xor    %r14d,%r14d
lea    0xdf5(%rip),%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%ebp
xor    %ebx,%ebx
jmp    119a <main+0x6a>
nopw   0x0(%rax,%rax,1)
mov    $0x1,%ebp
test   %ecx,%ecx
jne    119a <main+0x6a>
movslq %r14d,%r14
movslq %ebx,%rax
mov    %r14,%rcx
shl    $0x8,%rcx
add    %rsp,%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x1,%r14d
jmp    119a <main+0x6a>

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

LLVM IR (-O2):
@EOF = global i32 0
@.str = [17 x i8] c"string %d is %s\0A\00"
@.str.1 = [29 x i8] c"%s contains any of %s at %d\0A\00"
define i32 @main() {
%1 = alloca [256 x [256 x i8]]
%2 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %1, i64 0, i64 0, i64 0
%3 = call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %55, label %6
6: ; preds = %0
%7 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %1, i64 0, i64 1, i64 0
br label %8
8: ; preds = %6, %48
%9 = phi i32 [ %3, %6 ], [ %52, %48 ]
%10 = phi i32 [ 1, %6 ], [ %51, %48 ]
%11 = phi i32 [ 0, %6 ], [ %50, %48 ]
%12 = phi i32 [ 0, %6 ], [ %49, %48 ]
switch i32 %9, label %40 [
i32 10, label %13
i32 32, label %33
]
13: ; preds = %8
%14 = sext i32 %12 to i64
%15 = sext i32 %11 to i64
%16 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %1, i64 0, i64 %14, i64 %15
store i8 0, i8* %16
%17 = icmp eq i32 %12, 0
br i1 %17, label %55, label %18
18: ; preds = %13
%19 = icmp slt i32 %12, 0
br i1 %19, label %23, label %20
20: ; preds = %18
%21 = add nuw i32 %12, 1
%22 = zext i32 %21 to i64
br label %26
23: ; preds = %26, %18
%24 = call i32 @any(i8* %2, i8* %7)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %2, i8* %7, i32 %24)
br label %48
26: ; preds = %20, %26
%27 = phi i64 [ 0, %20 ], [ %31, %26 ]
%28 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %1, i64 0, i64 %27, i64 0
%29 = trunc i64 %27 to i32
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %29, i8* %28)
%31 = add nuw nsw i64 %27, 1
%32 = icmp eq i64 %31, %22
br i1 %32, label %23, label %26
33: ; preds = %8
%34 = icmp eq i32 %10, 0
br i1 %34, label %35, label %48
35: ; preds = %33
%36 = sext i32 %12 to i64
%37 = sext i32 %11 to i64
%38 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %1, i64 0, i64 %36, i64 %37
store i8 0, i8* %38
%39 = add nsw i32 %12, 1
br label %48
40: ; preds = %8
%41 = icmp eq i32 %10, 0
%42 = select i1 %41, i32 %11, i32 0
%43 = trunc i32 %9 to i8
%44 = sext i32 %12 to i64
%45 = sext i32 %42 to i64
%46 = getelementptr inbounds [256 x [256 x i8]], [256 x [256 x i8]]* %1, i64 0, i64 %44, i64 %45
store i8 %43, i8* %46
%47 = add nsw i32 %42, 1
br label %48
48: ; preds = %40, %35, %33, %23
%49 = phi i32 [ 0, %23 ], [ %12, %33 ], [ %39, %35 ], [ %12, %40 ]
%50 = phi i32 [ 0, %23 ], [ %11, %33 ], [ %11, %35 ], [ %47, %40 ]
%51 = phi i32 [ 1, %23 ], [ 1, %33 ], [ 1, %35 ], [ 0, %40 ]
%52 = call i32 (...) @getchar()
%53 = load i32, i32* @EOF
%54 = icmp eq i32 %52, %53
br i1 %54, label %55, label %8
55: ; preds = %48, %13, %0
ret i32 0
}