#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*/ gets(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ scanf(char *, int *);
int main(void) {
  int n, h = 11, l = 0;
  char x[9];
  while (scanf("%d\n", &n) && n != 0) {
    gets(x);
    if (x[4] == 'h') {
      if (n <= h)
        h = n - 1;
    } else if (x[4] == 'l') {
      if (n >= l)
        l = n + 1;
    } else {
      if (n <= h && n >= l)
        printf("Stan may be honest\n");
      else
        printf("Stan is dishonest\n");
      h = 11;
      l = 0;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xb,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xeac(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x1a(%rbp)
je     1179 <main+0x49>
cmpl   $0x0,-0x8(%rbp)
setne  %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    1189 <main+0x59>
jmp    122d <main+0xfd>
lea    -0x19(%rbp),%rdi
call   1040 <gets@plt>
movsbl -0x15(%rbp),%eax
cmp    $0x68,%eax
jne    11b9 <main+0x89>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11b4 <main+0x84>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1228 <main+0xf8>
movsbl -0x15(%rbp),%eax
cmp    $0x6c,%eax
jne    11e0 <main+0xb0>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     11db <main+0xab>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1223 <main+0xf3>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1209 <main+0xd9>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jl     1209 <main+0xd9>
lea    0xe05(%rip),%rdi
call   1030 <printf@plt>
jmp    1215 <main+0xe5>
lea    0xe08(%rip),%rdi
call   1030 <printf@plt>
movl   $0xb,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
jmp    1228 <main+0xf8>
jmp    114d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xebb(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
test   %rax,%rax
je     120d <main+0xdd>
cmpl   $0x0,0x8(%rsp)
je     120d <main+0xdd>
mov    $0xb,%r12d
xor    %ebp,%ebp
lea    0xf(%rsp),%r14
lea    0xe89(%rip),%r15
lea    0x8(%rsp),%rbx
lea    0xe93(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1040 <gets@plt>
movzbl 0x13(%rsp),%eax
cmp    $0x6c,%al
je     11c0 <main+0x90>
cmp    $0x68,%al
jne    11d0 <main+0xa0>
mov    0x8(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    %r12d,%eax
cmovle %ecx,%r12d
jmp    11f6 <main+0xc6>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x8(%rsp),%eax
lea    0x1(%rax),%ecx
cmp    %ebp,%eax
cmovge %ecx,%ebp
jmp    11f6 <main+0xc6>
xchg   %ax,%ax
mov    0x8(%rsp),%eax
cmp    %r12d,%eax
jg     11e2 <main+0xb2>
cmp    %ebp,%eax
jl     11e2 <main+0xb2>
mov    %r13,%rdi
jmp    11e9 <main+0xb9>
lea    0xe1b(%rip),%rdi
call   1030 <puts@plt>
xor    %ebp,%ebp
mov    $0xb,%r12d
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
test   %rax,%rax
je     120d <main+0xdd>
cmpl   $0x0,0x8(%rsp)
jne    1190 <main+0x60>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [20 x i8] c"Stan may be honest\0A\00"
@.str.2 = [19 x i8] c"Stan is dishonest\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [9 x i8]
store i32 0, i32* %1
store i32 11, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %56, %0
%7 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %2
%11 = icmp ne i32 %10, 0
br label %12
12: ; preds = %9, %6
%13 = phi i1 [ false, %6 ], [ %11, %9 ]
br i1 %13, label %14, label %57
14: ; preds = %12
%15 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 0
%16 = call i32 @gets(i8* %15)
%17 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 4
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 104
br i1 %20, label %21, label %29
21: ; preds = %14
%22 = load i32, i32* %2
%23 = load i32, i32* %3
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = load i32, i32* %2
%27 = sub nsw i32 %26, 1
store i32 %27, i32* %3
br label %28
28: ; preds = %25, %21
br label %56
29: ; preds = %14
%30 = getelementptr inbounds [9 x i8], [9 x i8]* %5, i64 0, i64 4
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 108
br i1 %33, label %34, label %42
34: ; preds = %29
%35 = load i32, i32* %2
%36 = load i32, i32* %4
%37 = icmp sge i32 %35, %36
br i1 %37, label %38, label %41
38: ; preds = %34
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %41
41: ; preds = %38, %34
br label %55
42: ; preds = %29
%43 = load i32, i32* %2
%44 = load i32, i32* %3
%45 = icmp sle i32 %43, %44
br i1 %45, label %46, label %52
46: ; preds = %42
%47 = load i32, i32* %2
%48 = load i32, i32* %4
%49 = icmp sge i32 %47, %48
br i1 %49, label %50, label %52
50: ; preds = %46
%51 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %54
52: ; preds = %46, %42
%53 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %54
54: ; preds = %52, %50
store i32 11, i32* %3
store i32 0, i32* %4
br label %55
55: ; preds = %54, %41
br label %56
56: ; preds = %55, %28
br label %6
57: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@str = [18 x i8] c"Stan is dishonest\00"
@str.3 = [19 x i8] c"Stan may be honest\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%5 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = icmp ne i64 %5, 0
%7 = load i32, i32* %1
%8 = icmp ne i32 %7, 0
%9 = select i1 %6, i1 %8, i1 false
br i1 %9, label %10, label %44
10: ; preds = %0
%11 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 4
br label %12
12: ; preds = %10, %36
%13 = phi i32 [ 0, %10 ], [ %38, %36 ]
%14 = phi i32 [ 11, %10 ], [ %37, %36 ]
%15 = call i32 @gets(i8* %4)
%16 = load i8, i8* %11
switch i8 %16, label %27 [
i8 104, label %17
i8 108, label %22
]
17: ; preds = %12
%18 = load i32, i32* %1
%19 = icmp sgt i32 %18, %14
%20 = add nsw i32 %18, -1
%21 = select i1 %19, i32 %14, i32 %20
br label %36
22: ; preds = %12
%23 = load i32, i32* %1
%24 = icmp slt i32 %23, %13
%25 = add nsw i32 %23, 1
%26 = select i1 %24, i32 %13, i32 %25
br label %36
27: ; preds = %12
%28 = load i32, i32* %1
%29 = icmp sgt i32 %28, %14
%30 = icmp slt i32 %28, %13
%31 = select i1 %29, i1 true, i1 %30
br i1 %31, label %34, label %32
32: ; preds = %27
%33 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.3, i64 0, i64 0))
br label %36
34: ; preds = %27
%35 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %36
36: ; preds = %22, %17, %32, %34
%37 = phi i32 [ %21, %17 ], [ %14, %22 ], [ 11, %34 ], [ 11, %32 ]
%38 = phi i32 [ %13, %17 ], [ %26, %22 ], [ 0, %34 ], [ 0, %32 ]
%39 = call i64 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%40 = icmp ne i64 %39, 0
%41 = load i32, i32* %1
%42 = icmp ne i32 %41, 0
%43 = select i1 %40, i1 %42, i1 false
br i1 %43, label %12, label %44
44: ; preds = %36, %0
ret i32 0
}