#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*/ cinta1(int, int);
int /*<<< orphan*/ cinta2(int, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int /*<<< orphan*/ wajik1(int, int);
int /*<<< orphan*/ wajik2(int, int);
int main(int argc, char **argv) {
  int n, jenis, x, i;
  scanf("%d", &x);
  for (i = 1; i <= x; i++) {
    scanf("%d %d", &jenis, &n);
    if (jenis == 4) {
      wajik1(n, jenis);
      wajik2(n, jenis);
    } else if (jenis == 3) {
      cinta1(n, jenis);
      cinta2(n, jenis);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe96(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jg     11fe <main+0xae>
lea    0xe6e(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1060 <scanf@plt>
cmpl   $0x4,-0x18(%rbp)
jne    11c6 <main+0x76>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <wajik1@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1070 <wajik2@plt>
jmp    11eb <main+0x9b>
cmpl   $0x3,-0x18(%rbp)
jne    11e6 <main+0x96>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <cinta1@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <cinta2@plt>
jmp    11eb <main+0x9b>
jmp    11f0 <main+0xa0>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    117f <main+0x2f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xea2(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x0,0x14(%rsp)
jle    11ef <main+0x9f>
lea    0xe85(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%rbx
xor    %ebp,%ebp
jmp    11b4 <main+0x64>
nopl   0x0(%rax)
mov    0xc(%rsp),%edi
mov    $0x3,%esi
call   1030 <cinta1@plt>
mov    0xc(%rsp),%edi
mov    0x10(%rsp),%esi
call   1050 <cinta2@plt>
add    $0x1,%ebp
cmp    0x14(%rsp),%ebp
jge    11ef <main+0x9f>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x10(%rsp),%eax
cmp    $0x3,%eax
je     1190 <main+0x40>
cmp    $0x4,%eax
jne    11ab <main+0x5b>
mov    0xc(%rsp),%edi
mov    $0x4,%esi
call   1040 <wajik1@plt>
mov    0xc(%rsp),%edi
mov    0x10(%rsp),%esi
call   1070 <wajik2@plt>
jmp    11ab <main+0x5b>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%d %d\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %8)
store i32 1, i32* %9
br label %11
11: ; preds = %38, %2
%12 = load i32, i32* %9
%13 = load i32, i32* %8
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %41
15: ; preds = %11
%16 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %7, i32* %6)
%17 = load i32, i32* %7
%18 = icmp eq i32 %17, 4
br i1 %18, label %19, label %26
19: ; preds = %15
%20 = load i32, i32* %6
%21 = load i32, i32* %7
%22 = call i32 @wajik1(i32 %20, i32 %21)
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = call i32 @wajik2(i32 %23, i32 %24)
br label %37
26: ; preds = %15
%27 = load i32, i32* %7
%28 = icmp eq i32 %27, 3
br i1 %28, label %29, label %36
29: ; preds = %26
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = call i32 @cinta1(i32 %30, i32 %31)
%33 = load i32, i32* %6
%34 = load i32, i32* %7
%35 = call i32 @cinta2(i32 %33, i32 %34)
br label %36
36: ; preds = %29, %26
br label %37
37: ; preds = %36, %19
br label %38
38: ; preds = %37
%39 = load i32, i32* %9
%40 = add nsw i32 %39, 1
store i32 %40, i32* %9
br label %11
41: ; preds = %11
ret i32 0
}

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