#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__ isQuadrangle(unsigned int *);
scalar_t__ isRectangle(unsigned int *);
scalar_t__ isSquare(unsigned int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  unsigned int edges[4];
  int T, i;
  scanf("%d", &T);
  while (T) {
    for (i = 0; i < 4; i++)
      scanf("%d", &edges[i]);
    if (isSquare(edges))
      printf("square\n");
    else {
      if (isRectangle(edges))
        printf("rectangle\n");
      else {
        if (isQuadrangle(edges))
          printf("quadrangle\n");
        else
          printf("banana\n");
      }
    }
    T--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    -0x24(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x0,-0x24(%rbp)
je     1247 <main+0xf7>
movl   $0x0,-0x28(%rbp)
cmpl   $0x4,-0x28(%rbp)
jge    11b7 <main+0x67>
movslq -0x28(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1182 <main+0x32>
lea    -0x20(%rbp),%rdi
call   1070 <isSquare@plt>
cmp    $0x0,%rax
je     11db <main+0x8b>
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
jmp    1239 <main+0xe9>
lea    -0x20(%rbp),%rdi
call   1060 <isRectangle@plt>
cmp    $0x0,%rax
je     11ff <main+0xaf>
lea    0xe16(%rip),%rdi
call   1030 <printf@plt>
jmp    1234 <main+0xe4>
lea    -0x20(%rbp),%rdi
call   1040 <isQuadrangle@plt>
cmp    $0x0,%rax
je     1223 <main+0xd3>
lea    0xdfd(%rip),%rdi
call   1030 <printf@plt>
jmp    122f <main+0xdf>
lea    0xdf8(%rip),%rdi
call   1030 <printf@plt>
jmp    1234 <main+0xe4>
jmp    1239 <main+0xe9>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x24(%rbp)
jmp    1171 <main+0x21>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xe9b(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
je     1226 <main+0xd6>
lea    0x14(%rsp),%r14
lea    0x18(%rsp),%r15
lea    0x1c(%rsp),%r12
lea    0xe6e(%rip),%rbx
lea    0x10(%rsp),%r13
lea    0xe81(%rip),%rbp
jmp    11ac <main+0x5c>
call   1030 <puts@plt>
addl   $0xffffffff,0xc(%rsp)
je     1226 <main+0xd6>
mov    %rbx,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r13,%rdi
call   1070 <isSquare@plt>
mov    %rbp,%rdi
test   %rax,%rax
jne    11a0 <main+0x50>
mov    %r13,%rdi
call   1060 <isRectangle@plt>
lea    0xe16(%rip),%rdi
test   %rax,%rax
jne    11a0 <main+0x50>
mov    %r13,%rdi
call   1040 <isQuadrangle@plt>
test   %rax,%rax
lea    0xdf4(%rip),%rdi
lea    0xde6(%rip),%rax
cmove  %rax,%rdi
jmp    11a0 <main+0x50>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"square\0A\00"
@.str.2 = [11 x i8] c"rectangle\0A\00"
@.str.3 = [12 x i8] c"quadrangle\0A\00"
@.str.4 = [8 x i8] c"banana\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %6
6: ; preds = %43, %0
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %46
9: ; preds = %6
store i32 0, i32* %4
br label %10
10: ; preds = %18, %9
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 4
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 %15
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %16)
br label %18
18: ; preds = %13
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %10
21: ; preds = %10
%22 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%23 = call i64 @isSquare(i32* %22)
%24 = icmp ne i64 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %21
%26 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %43
27: ; preds = %21
%28 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%29 = call i64 @isRectangle(i32* %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %27
%32 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %42
33: ; preds = %27
%34 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%35 = call i64 @isQuadrangle(i32* %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
br label %41
39: ; preds = %33
%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, %31
br label %43
43: ; preds = %42, %25
%44 = load i32, i32* %3
%45 = add nsw i32 %44, -1
store i32 %45, i32* %3
br label %6
46: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [7 x i8] c"banana\00"
@str.5 = [11 x i8] c"quadrangle\00"
@str.6 = [10 x i8] c"rectangle\00"
@str.7 = [7 x i8] c"square\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = alloca i32
%3 = bitcast [4 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 0
br i1 %7, label %33, label %8
8: ; preds = %0
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%10 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%11 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%12 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 3
br label %13
13: ; preds = %8, %27
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %11)
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %12)
%18 = call i64 @isSquare(i32* %9)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %27
20: ; preds = %13
%21 = call i64 @isRectangle(i32* %9)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = call i64 @isQuadrangle(i32* %9)
%25 = icmp eq i64 %24, 0
%26 = select i1 %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @str.5, i64 0, i64 0)
br label %27
27: ; preds = %23, %20, %13
%28 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @str.7, i64 0, i64 0), %13 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.6, i64 0, i64 0), %20 ], [ %26, %23 ]
%29 = call i32 @puts(i8* dereferenceable(1) %28)
%30 = load i32, i32* %2
%31 = add nsw i32 %30, -1
store i32 %31, i32* %2
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %13
33: ; preds = %27, %0
ret i32 0
}