#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 nwd(int, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int i, iteracje;
  scanf("%d", &iteracje);
  for (i = 0; i < iteracje; i++) {
    int a, b, c, d;
    scanf("%d %d %d %d", &a, &b, &c, &d);
    a = nwd(a, b);
    a = nwd(a, c);
    printf("%d\n", nwd(a, d));
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec3(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11c5 <main+0x95>
lea    0xe95(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1030 <nwd@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <nwd@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0x1c(%rbp),%esi
call   1030 <nwd@plt>
mov    %eax,%esi
lea    0xe5a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1158 <main+0x28>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xec4(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11da <main+0xaa>
lea    0x4(%rsp),%r15
lea    0x14(%rsp),%r12
lea    0x10(%rsp),%r13
lea    0xc(%rsp),%rbx
lea    0xe95(%rip),%rbp
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
lea    0xe79(%rip),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbx,%r8
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
mov    0x14(%rsp),%esi
call   1030 <nwd@plt>
mov    %eax,0x4(%rsp)
mov    0x10(%rsp),%esi
mov    %eax,%edi
call   1030 <nwd@plt>
mov    %eax,0x4(%rsp)
mov    0xc(%rsp),%esi
mov    %eax,%edi
call   1030 <nwd@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
add    $0x1,%r14d
cmp    0x8(%rsp),%r14d
jl     1180 <main+0x50>
xor    %eax,%eax
add    $0x18,%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 = [12 x i8] c"%d %d %d %d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 0, i32* %2
br label %9
9: ; preds = %25, %0
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %28
13: ; preds = %9
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5, i32* %6, i32* %7)
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = call i32 @nwd(i32 %15, i32 %16)
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = load i32, i32* %6
%20 = call i32 @nwd(i32 %18, i32 %19)
store i32 %20, i32* %4
%21 = load i32, i32* %4
%22 = load i32, i32* %7
%23 = call i32 @nwd(i32 %21, i32 %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %23)
br label %25
25: ; preds = %13
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %9
28: ; preds = %9
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [12 x i8] c"%d %d %d %d\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast i32* %1 to i8*
%7 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %29
10: ; preds = %0
%11 = bitcast i32* %2 to i8*
%12 = bitcast i32* %3 to i8*
%13 = bitcast i32* %4 to i8*
%14 = bitcast i32* %5 to i8*
br label %15
15: ; preds = %10, %15
%16 = phi i32 [ 0, %10 ], [ %26, %15 ]
%17 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4, i32* %5)
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 @nwd(i32 %18, i32 %19)
store i32 %20, i32* %2
%21 = load i32, i32* %4
%22 = call i32 @nwd(i32 %20, i32 %21)
store i32 %22, i32* %2
%23 = load i32, i32* %5
%24 = call i32 @nwd(i32 %22, i32 %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %24)
%26 = add nuw nsw i32 %16, 1
%27 = load i32, i32* %1
%28 = icmp slt i32 %26, %27
br i1 %28, label %15, label %29
29: ; preds = %15, %0
ret i32 0
}