#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 */
scalar_t__ scanf(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ wr_init();
int /*<<< orphan*/ wr_uninit();
int main() {
  char buf[32];
  wr_init();
  while (scanf("%s", buf) > 0) {
    if (strcmp("quit", buf) == 0)
      break;
  }
  wr_uninit();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <wr_init@plt>
lea    -0x30(%rbp),%rsi
lea    0xe9f(%rip),%rdi
call   1060 <scanf@plt>
cmp    $0x0,%rax
jle    1194 <main+0x54>
lea    -0x30(%rbp),%rsi
lea    0xe88(%rip),%rdi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    118f <main+0x4f>
jmp    1194 <main+0x54>
jmp    1156 <main+0x16>
mov    $0x0,%al
call   1050 <wr_uninit@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
xor    %eax,%eax
call   1040 <wr_init@plt>
lea    0xea9(%rip),%r14
mov    %rsp,%rbx
lea    0xea2(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
test   %rax,%rax
jle    1190 <main+0x50>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1170 <main+0x30>
xor    %eax,%eax
call   1050 <wr_uninit@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"quit\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [32 x i8]
store i32 0, i32* %1
%3 = call i32 (...) @wr_init()
br label %4
4: ; preds = %13, %0
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%6 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %4
%9 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%10 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
br label %14
13: ; preds = %8
br label %4
14: ; preds = %12, %4
%15 = call i32 (...) @wr_uninit()
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"quit\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @wr_init()
br label %4
4: ; preds = %7, %0
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = call i64 @strcmp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %4
10: ; preds = %7, %4
%11 = call i32 (...) @wr_uninit()
ret i32 0
}