#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;
  while (1) {
    scanf("%d %d", &x, &y);
    if (x == 0 || y == 0)
      break;
    if (x > 0 && y > 0)
      printf("primeiro\n");
    else if (x < 0 && y > 0)
      printf("segundo\n");
    else if (x < 0 && y < 0)
      printf("terceiro\n");
    else
      printf("quarto\n");
  }
  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>
cmpl   $0x0,-0x8(%rbp)
je     1157 <main+0x37>
cmpl   $0x0,-0xc(%rbp)
jne    115c <main+0x3c>
jmp    11e6 <main+0xc6>
cmpl   $0x0,-0x8(%rbp)
jle    1181 <main+0x61>
cmpl   $0x0,-0xc(%rbp)
jle    1181 <main+0x61>
lea    0xe8f(%rip),%rdi
call   1030 <printf@plt>
jmp    11e1 <main+0xc1>
cmpl   $0x0,-0x8(%rbp)
jge    11a6 <main+0x86>
cmpl   $0x0,-0xc(%rbp)
jle    11a6 <main+0x86>
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
jmp    11dc <main+0xbc>
cmpl   $0x0,-0x8(%rbp)
jge    11cb <main+0xab>
cmpl   $0x0,-0xc(%rbp)
jge    11cb <main+0xab>
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
jmp    11d7 <main+0xb7>
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
jmp    11dc <main+0xbc>
jmp    11e1 <main+0xc1>
jmp    112f <main+0xf>
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     11d2 <main+0xb2>
mov    (%rsp),%ecx
test   %ecx,%ecx
je     11d2 <main+0xb2>
lea    0xec1(%rip),%r12
lea    0xe9c(%rip),%r14
lea    0x4(%rsp),%r15
mov    %rsp,%rbx
lea    0xea3(%rip),%r13
lea    0xe93(%rip),%rbp
nopw   0x0(%rax,%rax,1)
test   %eax,%eax
jle    118b <main+0x6b>
mov    %r12,%rdi
test   %ecx,%ecx
jg     11b0 <main+0x90>
test   %eax,%eax
jns    1196 <main+0x76>
mov    %r13,%rdi
test   %ecx,%ecx
jg     11b0 <main+0x90>
mov    %rbp,%rdi
test   %ecx,%eax
js     11b0 <main+0x90>
lea    0xe62(%rip),%rdi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     11d2 <main+0xb2>
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 = [6 x i8] c"%d %d\00"
@.str.1 = [10 x i8] c"primeiro\0A\00"
@.str.2 = [9 x i8] c"segundo\0A\00"
@.str.3 = [10 x i8] c"terceiro\0A\00"
@.str.4 = [8 x i8] c"quarto\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %0, %40
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %4
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %8, %4
br label %41
12: ; preds = %8
%13 = load i32, i32* %2
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %40
20: ; preds = %15, %12
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i32, i32* %3
%25 = icmp sgt i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %39
28: ; preds = %23, %20
%29 = load i32, i32* %2
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i32, i32* %3
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %38
36: ; preds = %31, %28
%37 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %38
38: ; preds = %36, %34
br label %39
39: ; preds = %38, %26
br label %40
40: ; preds = %39, %18
br label %4
41: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %d\00"
@str = [7 x i8] c"quarto\00"
@str.5 = [9 x i8] c"terceiro\00"
@str.6 = [8 x i8] c"segundo\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 ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 0
%10 = select i1 %7, i1 true, i1 %9
br i1 %10, label %33, label %11
11: ; preds = %0, %24
%12 = phi i32 [ %30, %24 ], [ %8, %0 ]
%13 = phi i32 [ %28, %24 ], [ %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 %24, label %17
17: ; preds = %11
%18 = icmp slt i32 %13, 0
%19 = select i1 %18, i1 %15, i1 false
br i1 %19, label %24, label %20
20: ; preds = %17
%21 = icmp slt i32 %12, 0
%22 = select i1 %18, i1 %21, i1 false
%23 = select i1 %22, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @str.5, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0)
br label %24
24: ; preds = %20, %17, %11
%25 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.7, i64 0, i64 0), %11 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @str.6, i64 0, i64 0), %17 ], [ %23, %20 ]
%26 = call i32 @puts(i8* dereferenceable(1) %25)
%27 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%28 = load i32, i32* %1
%29 = icmp eq i32 %28, 0
%30 = load i32, i32* %2
%31 = icmp eq i32 %30, 0
%32 = select i1 %29, i1 true, i1 %31
br i1 %32, label %33, label %11
33: ; preds = %24, %0
ret i32 0
}