#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*/ puts(char *);
void test_utils_interactive_sync(void) {
  char c = '\0';
  do {
    if (c == 'r') {
      puts("READY");
    } else if (c != '\n' && c != '\r') {
      puts("Help: Press s to start test, r to print it is ready");
    }
    c = getchar();
  } while (c != 's');
  puts("START");
}


x86 assembly (clang, -O0):
<test_utils_interactive_sync>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x72,%eax
jne    114a <test_utils_interactive_sync+0x2a>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
jmp    1175 <test_utils_interactive_sync+0x55>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
je     1170 <test_utils_interactive_sync+0x50>
movsbl -0x1(%rbp),%eax
cmp    $0xd,%eax
je     1170 <test_utils_interactive_sync+0x50>
lea    0xe9b(%rip),%rdi
call   1030 <puts@plt>
jmp    1175 <test_utils_interactive_sync+0x55>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x73,%eax
jne    112c <test_utils_interactive_sync+0xc>
lea    0xea7(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_utils_interactive_sync>:
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rbx
lea    0xed4(%rip),%r14
xor    %eax,%eax
jmp    1150 <test_utils_interactive_sync+0x30>
cs nopw 0x0(%rax,%rax,1)
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    $0x73,%al
je     1164 <test_utils_interactive_sync+0x44>
cmp    $0xa,%al
je     1145 <test_utils_interactive_sync+0x25>
cmp    $0xd,%al
je     1145 <test_utils_interactive_sync+0x25>
mov    %rbx,%rdi
cmp    $0x72,%al
je     1140 <test_utils_interactive_sync+0x20>
mov    %r14,%rdi
jmp    1140 <test_utils_interactive_sync+0x20>
lea    0xecf(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"READY\00"
@.str.1 = [52 x i8] c"Help: Press s to start test, r to print it is ready\00"
@.str.2 = [6 x i8] c"START\00"
define void @test_utils_interactive_sync() {
%1 = alloca i8
store i8 0, i8* %1
br label %2
2: ; preds = %21, %0
%3 = load i8, i8* %1
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 114
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %19
8: ; preds = %2
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 10
br i1 %11, label %12, label %18
12: ; preds = %8
%13 = load i8, i8* %1
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 13
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @puts(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
br label %18
18: ; preds = %16, %12, %8
br label %19
19: ; preds = %18, %6
%20 = call signext i8 (...) @getchar()
store i8 %20, i8* %1
br label %21
21: ; preds = %19
%22 = load i8, i8* %1
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 115
br i1 %24, label %2, label %25
25: ; preds = %21
%26 = call i32 @puts(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"READY\00"
@.str.1 = [52 x i8] c"Help: Press s to start test, r to print it is ready\00"
@.str.2 = [6 x i8] c"START\00"
define void @test_utils_interactive_sync() {
br label %1
1: ; preds = %7, %0
%2 = phi i8 [ 0, %0 ], [ %8, %7 ]
switch i8 %2, label %3 [
i8 114, label %4
i8 13, label %7
i8 10, label %7
]
3: ; preds = %1
br label %4
4: ; preds = %1, %3
%5 = phi i8* [ getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), %1 ]
%6 = tail call i32 @puts(i8* dereferenceable(1) %5)
br label %7
7: ; preds = %4, %1, %1
%8 = tail call signext i8 (...) @getchar()
%9 = icmp eq i8 %8, 115
br i1 %9, label %10, label %1
10: ; preds = %7
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret void
}