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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     1165 <main+0x45>
cmpl   $0x0,-0xc(%rbp)
jne    116a <main+0x4a>
jmp    11f9 <main+0xd9>
cmpl   $0x0,-0x8(%rbp)
jle    118f <main+0x6f>
cmpl   $0x0,-0xc(%rbp)
jle    118f <main+0x6f>
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
jmp    11ef <main+0xcf>
cmpl   $0x0,-0x8(%rbp)
jge    11b4 <main+0x94>
cmpl   $0x0,-0xc(%rbp)
jle    11b4 <main+0x94>
lea    0xe65(%rip),%rdi
call   1030 <printf@plt>
jmp    11ea <main+0xca>
cmpl   $0x0,-0x8(%rbp)
jge    11d9 <main+0xb9>
cmpl   $0x0,-0xc(%rbp)
jge    11d9 <main+0xb9>
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
jmp    11e5 <main+0xc5>
lea    0xe42(%rip),%rdi
call   1030 <printf@plt>
jmp    11ea <main+0xca>
jmp    11ef <main+0xcf>
jmp    11f4 <main+0xd4>
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),%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    0xec0(%rip),%r12
lea    0xe9c(%rip),%r14
lea    0x4(%rsp),%r15
mov    %rsp,%rbx
lea    0xea2(%rip),%r13
lea    0xe92(%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    0xe61(%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 = [5 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
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %5
br label %6
6: ; preds = %44, %0
store i32 1, i32* %5
br label %7
7: ; preds = %6
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %7
%12 = load i32, i32* %3
%13 = icmp eq i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %11, %7
br label %45
15: ; preds = %11
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %23
18: ; preds = %15
%19 = load i32, i32* %3
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %43
23: ; preds = %18, %15
%24 = load i32, i32* %2
%25 = icmp slt i32 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = load i32, i32* %3
%28 = icmp sgt i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
br label %42
31: ; preds = %26, %23
%32 = load i32, i32* %2
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %31
%35 = load i32, i32* %3
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %41
39: ; preds = %34, %31
%40 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %41
41: ; preds = %39, %37
br label %42
42: ; preds = %41, %29
br label %43
43: ; preds = %42, %21
br label %44
44: ; preds = %43
br label %6
45: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@.str = [5 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 ([5 x i8], [5 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 ([5 x i8], [5 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
}