#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, i, n;
  for (i = 1; i == 1;) {
    scanf("%d%d", &x, &y);
    if (x > 0 && y > 0) {
      printf("primeiro\n");
    } else if (x > 0 && y < 0) {
      printf("quarto\n");
    } else if (x < 0 && y < 0) {
      printf("terceiro\n");
    } else if (x < 0 && y > 0) {
      printf("segundo\n");
    } else if (x == 0 || y == 0) {
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
jne    121a <main+0xfa>
lea    0xeb9(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    1179 <main+0x59>
cmpl   $0x0,-0xc(%rbp)
jle    1179 <main+0x59>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
jmp    1215 <main+0xf5>
cmpl   $0x0,-0x8(%rbp)
jle    119e <main+0x7e>
cmpl   $0x0,-0xc(%rbp)
jge    119e <main+0x7e>
lea    0xe7b(%rip),%rdi
call   1030 <printf@plt>
jmp    1210 <main+0xf0>
cmpl   $0x0,-0x8(%rbp)
jge    11c3 <main+0xa3>
cmpl   $0x0,-0xc(%rbp)
jge    11c3 <main+0xa3>
lea    0xe5e(%rip),%rdi
call   1030 <printf@plt>
jmp    120b <main+0xeb>
cmpl   $0x0,-0x8(%rbp)
jge    11e8 <main+0xc8>
cmpl   $0x0,-0xc(%rbp)
jle    11e8 <main+0xc8>
lea    0xe43(%rip),%rdi
call   1030 <printf@plt>
jmp    1206 <main+0xe6>
cmpl   $0x0,-0x8(%rbp)
je     11fc <main+0xdc>
cmpl   $0x0,-0xc(%rbp)
jne    1201 <main+0xe1>
jmp    121a <main+0xfa>
jmp    1206 <main+0xe6>
jmp    120b <main+0xeb>
jmp    1210 <main+0xf0>
jmp    1215 <main+0xf5>
jmp    1136 <main+0x16>
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
push   %rax
lea    0xece(%rip),%r14
lea    0x4(%rsp),%r15
mov    %rsp,%rbx
lea    0xedc(%rip),%r12
lea    0xece(%rip),%r13
lea    0xebe(%rip),%rbp
jmp    1165 <main+0x45>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
call   1030 <puts@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%ecx
mov    (%rsp),%eax
test   %ecx,%ecx
jle    1185 <main+0x65>
mov    %r12,%rdi
test   %eax,%eax
jg     1160 <main+0x40>
test   %ecx,%ecx
jle    1190 <main+0x70>
mov    %r13,%rdi
test   %eax,%eax
js     1160 <main+0x40>
test   %ecx,%ecx
jns    119b <main+0x7b>
mov    %rbp,%rdi
test   %eax,%eax
js     1160 <main+0x40>
test   %ecx,%ecx
jns    11aa <main+0x8a>
lea    0xe5f(%rip),%rdi
test   %eax,%eax
jg     1160 <main+0x40>
test   %ecx,%ecx
je     11b2 <main+0x92>
test   %eax,%eax
jne    1165 <main+0x45>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 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
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %4
br label %6
6: ; preds = %53, %0
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %54
9: ; preds = %6
%10 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %9
%14 = load i32, i32* %3
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %53
18: ; preds = %13, %9
%19 = load i32, i32* %2
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = load i32, i32* %3
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %52
26: ; preds = %21, %18
%27 = load i32, i32* %2
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %34
29: ; preds = %26
%30 = load i32, i32* %3
%31 = icmp slt i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %51
34: ; preds = %29, %26
%35 = load i32, i32* %2
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %42
37: ; preds = %34
%38 = load i32, i32* %3
%39 = icmp sgt i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %50
42: ; preds = %37, %34
%43 = load i32, i32* %2
%44 = icmp eq i32 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %42
%46 = load i32, i32* %3
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %49
48: ; preds = %45, %42
br label %54
49: ; preds = %45
br label %50
50: ; preds = %49, %40
br label %51
51: ; preds = %50, %32
br label %52
52: ; preds = %51, %24
br label %53
53: ; preds = %52, %16
br label %6
54: ; preds = %48, %6
ret i32 0
}

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