#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int X, Y;
  scanf(" %d %d", &X, &Y);
  while (X != 0 && Y != 0) {
    if (X > 0 && Y > 0)
      printf("primeiro\n");
    if (X > 0 && Y < 0)
      printf("quarto\n");
    if (X < 0 && Y < 0)
      printf("terceiro\n");
    if (X < 0 && Y > 0)
      printf("segundo\n");
    scanf(" %d %d", &X, &Y);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     115c <main+0x3c>
cmpl   $0x0,-0xc(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    116c <main+0x4c>
jmp    1205 <main+0xe5>
cmpl   $0x0,-0x8(%rbp)
jle    118c <main+0x6c>
cmpl   $0x0,-0xc(%rbp)
jle    118c <main+0x6c>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11ac <main+0x8c>
cmpl   $0x0,-0xc(%rbp)
jge    11ac <main+0x8c>
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    11cc <main+0xac>
cmpl   $0x0,-0xc(%rbp)
jge    11cc <main+0xac>
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    11ec <main+0xcc>
cmpl   $0x0,-0xc(%rbp)
jle    11ec <main+0xcc>
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
lea    0xe0d(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
jmp    1143 <main+0x23>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     11f6 <main+0xd6>
mov    (%rsp),%ecx
test   %ecx,%ecx
je     11f6 <main+0xd6>
lea    0xebb(%rip),%r15
lea    0xeab(%rip),%r12
lea    0xe9c(%rip),%r13
lea    0xe8e(%rip),%rbx
lea    0x4(%rsp),%rbp
mov    %rsp,%r14
nopw   0x0(%rax,%rax,1)
test   %eax,%eax
jle    119b <main+0x7b>
test   %ecx,%ecx
jle    119b <main+0x7b>
lea    0xe90(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%eax
mov    (%rsp),%ecx
test   %eax,%eax
jle    11b2 <main+0x92>
test   %ecx,%ecx
jns    11b2 <main+0x92>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%eax
mov    (%rsp),%ecx
test   %eax,%eax
jns    11c9 <main+0xa9>
test   %ecx,%ecx
jns    11c9 <main+0xa9>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%eax
mov    (%rsp),%ecx
test   %eax,%eax
jns    11d9 <main+0xb9>
test   %ecx,%ecx
jle    11d9 <main+0xb9>
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     11f6 <main+0xd6>
mov    (%rsp),%ecx
test   %ecx,%ecx
jne    1180 <main+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c" %d %d\00"
@.str.1 = [10 x i8] c"primeiro\0A\00"
@.str.2 = [8 x i8] c"quarto\0A\00"
@.str.3 = [10 x i8] c"terceiro\0A\00"
@.str.4 = [9 x i8] c"segundo\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
br label %5
5: ; preds = %45, %0
%6 = load i32, i32* %2
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 0
br label %11
11: ; preds = %8, %5
%12 = phi i1 [ false, %5 ], [ %10, %8 ]
br i1 %12, label %13, label %47
13: ; preds = %11
%14 = load i32, i32* %2
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %21
16: ; preds = %13
%17 = load i32, i32* %3
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %19, %16, %13
%22 = load i32, i32* %2
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = load i32, i32* %3
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %29
29: ; preds = %27, %24, %21
%30 = load i32, i32* %2
%31 = icmp slt i32 %30, 0
br i1 %31, label %32, label %37
32: ; preds = %29
%33 = load i32, i32* %3
%34 = icmp slt i32 %33, 0
br i1 %34, label %35, label %37
35: ; preds = %32
%36 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %37
37: ; preds = %35, %32, %29
%38 = load i32, i32* %2
%39 = icmp slt i32 %38, 0
br i1 %39, label %40, label %45
40: ; preds = %37
%41 = load i32, i32* %3
%42 = icmp sgt i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %45
45: ; preds = %43, %40, %37
%46 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
br label %5
47: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c" %d %d\00"
@str = [8 x i8] c"segundo\00"
@str.5 = [9 x i8] c"terceiro\00"
@str.6 = [7 x i8] c"quarto\00"
@str.7 = [9 x i8] c"primeiro\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = icmp ne i32 %6, 0
%8 = load i32, i32* %2
%9 = icmp ne i32 %8, 0
%10 = select i1 %7, i1 %9, i1 false
br i1 %10, label %11, label %56
11: ; preds = %0, %49
%12 = phi i32 [ %53, %49 ], [ %8, %0 ]
%13 = phi i32 [ %51, %49 ], [ %6, %0 ]
%14 = icmp sgt i32 %13, 0
%15 = icmp sgt i32 %12, 0
%16 = select i1 %14, i1 %15, i1 false
br i1 %16, label %17, label %21
17: ; preds = %11
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.7, i64 0, i64 0))
%19 = load i32, i32* %1
%20 = load i32, i32* %2
br label %21
21: ; preds = %17, %11
%22 = phi i32 [ %20, %17 ], [ %12, %11 ]
%23 = phi i32 [ %19, %17 ], [ %13, %11 ]
%24 = icmp sgt i32 %23, 0
%25 = icmp slt i32 %22, 0
%26 = select i1 %24, i1 %25, i1 false
br i1 %26, label %27, label %31
27: ; preds = %21
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.6, i64 0, i64 0))
%29 = load i32, i32* %1
%30 = load i32, i32* %2
br label %31
31: ; preds = %27, %21
%32 = phi i32 [ %30, %27 ], [ %22, %21 ]
%33 = phi i32 [ %29, %27 ], [ %23, %21 ]
%34 = icmp slt i32 %33, 0
%35 = icmp slt i32 %32, 0
%36 = select i1 %34, i1 %35, i1 false
br i1 %36, label %37, label %41
37: ; preds = %31
%38 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.5, i64 0, i64 0))
%39 = load i32, i32* %1
%40 = load i32, i32* %2
br label %41
41: ; preds = %37, %31
%42 = phi i32 [ %40, %37 ], [ %32, %31 ]
%43 = phi i32 [ %39, %37 ], [ %33, %31 ]
%44 = icmp slt i32 %43, 0
%45 = icmp sgt i32 %42, 0
%46 = select i1 %44, i1 %45, i1 false
br i1 %46, label %47, label %49
47: ; preds = %41
%48 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %49
49: ; preds = %47, %41
%50 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%51 = load i32, i32* %1
%52 = icmp ne i32 %51, 0
%53 = load i32, i32* %2
%54 = icmp ne i32 %53, 0
%55 = select i1 %52, i1 %54, i1 false
br i1 %55, label %11, label %56
56: ; preds = %49, %0
ret i32 0
}