#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 */
char getchar();
int /*<<< orphan*/ print_prop(int, int, char *);
int /*<<< orphan*/ puts(char *);
void comparison(char prop[], int max) {
  int x = 0;
  char c;
  for (;;) {
    c = getchar();
    if (c == '~') {
      prop[x] = '\0';
      print_prop(x, max, prop);
      puts("\nSo.. do you wanna stop?\n\tOkey...");
      break;
    } else if (c == '\n') {
      prop[x] = '\0';
      print_prop(x, max, prop);
      x = 0;
    } else
      prop[x++] = c;
  }
}


x86 assembly (clang, -O0):
<comparison>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1050 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl -0x11(%rbp),%eax
cmp    $0x7e,%eax
jne    1189 <comparison+0x59>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rdx
call   1040 <print_prop@plt>
lea    0xe81(%rip),%rdi
call   1030 <puts@plt>
jmp    11df <comparison+0xaf>
movsbl -0x11(%rbp),%eax
cmp    $0xa,%eax
jne    11bd <comparison+0x8d>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rdx
call   1040 <print_prop@plt>
movl   $0x0,-0x10(%rbp)
jmp    11d5 <comparison+0xa5>
mov    -0x11(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x10(%rbp)
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
jmp    11da <comparison+0xaa>
jmp    1146 <comparison+0x16>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<comparison>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%rbx
jmp    1152 <comparison+0x22>
nopl   0x0(%rax)
movslq %ebp,%rdi
movb   $0x0,(%rbx,%rdi,1)
mov    %r14d,%esi
mov    %rbx,%rdx
call   1040 <print_prop@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <getchar@plt>
cmp    $0xa,%al
je     1140 <comparison+0x10>
movslq %ebp,%rcx
cmp    $0x7e,%al
je     116e <comparison+0x3e>
add    $0x1,%ebp
mov    %al,(%rbx,%rcx,1)
jmp    1154 <comparison+0x24>
movb   $0x0,(%rbx,%rcx,1)
mov    %ebp,%edi
mov    %r14d,%esi
mov    %rbx,%rdx
call   1040 <print_prop@plt>
lea    0xe7a(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"\0ASo.. do you wanna stop?\0A\09Okey...\00"
define void @comparison(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %43, %2
%8 = call signext i8 (...) @getchar()
store i8 %8, i8* %6
%9 = load i8, i8* %6
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 126
br i1 %11, label %12, label %22
12: ; preds = %7
%13 = load i8*, i8** %3
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
store i8 0, i8* %16
%17 = load i32, i32* %5
%18 = load i32, i32* %4
%19 = load i8*, i8** %3
%20 = call i32 @print_prop(i32 %17, i32 %18, i8* %19)
%21 = call i32 @puts(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
br label %44
22: ; preds = %7
%23 = load i8, i8* %6
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 10
br i1 %25, label %26, label %35
26: ; preds = %22
%27 = load i8*, i8** %3
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %27, i64 %29
store i8 0, i8* %30
%31 = load i32, i32* %5
%32 = load i32, i32* %4
%33 = load i8*, i8** %3
%34 = call i32 @print_prop(i32 %31, i32 %32, i8* %33)
store i32 0, i32* %5
br label %42
35: ; preds = %22
%36 = load i8, i8* %6
%37 = load i8*, i8** %3
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
%40 = sext i32 %38 to i64
%41 = getelementptr inbounds i8, i8* %37, i64 %40
store i8 %36, i8* %41
br label %42
42: ; preds = %35, %26
br label %43
43: ; preds = %42
br label %7
44: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"\0ASo.. do you wanna stop?\0A\09Okey...\00"
define void @comparison(i8* %0, i32 %1) {
br label %3
3: ; preds = %15, %2
%4 = phi i32 [ 0, %2 ], [ %16, %15 ]
%5 = tail call signext i8 (...) @getchar()
switch i8 %5, label %17 [
i8 126, label %6
i8 10, label %11
]
6: ; preds = %3
%7 = sext i32 %4 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
store i8 0, i8* %8
%9 = tail call i32 @print_prop(i32 %4, i32 %1, i8* %0)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
ret void
11: ; preds = %3
%12 = sext i32 %4 to i64
%13 = getelementptr inbounds i8, i8* %0, i64 %12
store i8 0, i8* %13
%14 = tail call i32 @print_prop(i32 %4, i32 %1, i8* %0)
br label %15
15: ; preds = %11, %17
%16 = phi i32 [ 0, %11 ], [ %18, %17 ]
br label %3
17: ; preds = %3
%18 = add nsw i32 %4, 1
%19 = sext i32 %4 to i64
%20 = getelementptr inbounds i8, i8* %0, i64 %19
store i8 %5, i8* %20
br label %15
}