#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*/ displaystatus();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ resetstatus();
int /*<<< orphan*/ scanf(char *, char *);
int restart() {
  char restartchoice;
  displaystatus();
  printf("all clipped!\n\n");
  do {
    printf("start over?\n");
    printf("[y/n]: ");
    scanf(" %c", &restartchoice);
  } while ((restartchoice != 'y') && (restartchoice != 'n'));
  if (restartchoice == 'y') {
    resetstatus();
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<restart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <displaystatus@plt>
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    -0x5(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x5(%rbp),%ecx
xor    %eax,%eax
cmp    $0x79,%ecx
mov    %al,-0x6(%rbp)
je     11a2 <restart+0x62>
movsbl -0x5(%rbp),%eax
cmp    $0x6e,%eax
setne  %al
mov    %al,-0x6(%rbp)
mov    -0x6(%rbp),%al
test   $0x1,%al
jne    115b <restart+0x1b>
movsbl -0x5(%rbp),%eax
cmp    $0x79,%eax
jne    11cd <restart+0x8d>
mov    $0x0,%al
call   1060 <resetstatus@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d4 <restart+0x94>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<restart>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1030 <displaystatus@plt>
lea    0xea6(%rip),%rdi
call   1040 <puts@plt>
lea    0xea8(%rip),%r14
lea    0xe87(%rip),%r15
lea    0xe88(%rip),%r12
lea    0x7(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1050 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
movzbl 0x7(%rsp),%eax
cmp    $0x6e,%al
je     11c3 <restart+0x73>
cmp    $0x79,%al
jne    1190 <restart+0x40>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <resetstatus@plt>
jmp    11c8 <restart+0x78>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [15 x i8] c"all clipped!\0A\0A\00"
@.str.1 = [13 x i8] c"start over?\0A\00"
@.str.2 = [8 x i8] c"[y/n]: \00"
@.str.3 = [4 x i8] c" %c\00"
define i32 @restart() {
%1 = alloca i32
%2 = alloca i8
%3 = call i32 (...) @displaystatus()
%4 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %17, %0
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %2)
br label %9
9: ; preds = %5
%10 = load i8, i8* %2
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 121
br i1 %12, label %13, label %17
13: ; preds = %9
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 110
br label %17
17: ; preds = %13, %9
%18 = phi i1 [ false, %9 ], [ %16, %13 ]
br i1 %18, label %5, label %19
19: ; preds = %17
%20 = load i8, i8* %2
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 121
br i1 %22, label %23, label %25
23: ; preds = %19
%24 = call i32 (...) @resetstatus()
store i32 0, i32* %1
br label %26
25: ; preds = %19
store i32 1, i32* %1
br label %26
26: ; preds = %25, %23
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@.str.2 = [8 x i8] c"[y/n]: \00"
@.str.3 = [4 x i8] c" %c\00"
@str = [14 x i8] c"all clipped!\0A\00"
@str.4 = [12 x i8] c"start over?\00"
define i32 @restart() {
%1 = alloca i8
%2 = tail call i32 (...) @displaystatus()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %4, %0
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str.4, i64 0, i64 0))
%6 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%8 = load i8, i8* %1
switch i8 %8, label %4 [
i8 121, label %9
i8 110, label %11
]
9: ; preds = %4
%10 = call i32 (...) @resetstatus()
br label %11
11: ; preds = %4, %9
%12 = phi i32 [ 0, %9 ], [ 1, %4 ]
ret i32 %12
}