#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__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int zning(int, int, int);
int main() {
  int a, b, k, m, i, *zni;
  scanf("%d", &m);
  zni = (int *)malloc(sizeof(int) * m);
  i = m;
  while (i > 0) {
    scanf("%d %d %d", &a, &b, &k);
    zni[m - i] = zning(a, b, k);
    i--;
  }
  while (i < m)
    printf("%d\n", zni[i++]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb0(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jle    11cc <main+0x8c>
lea    0xe75(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <zning@plt>
mov    %eax,%edx
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    -0x18(%rbp),%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    117a <main+0x3a>
jmp    11d1 <main+0x91>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1203 <main+0xc3>
mov    -0x20(%rbp),%rax
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe10(%rip),%rdi
call   1040 <printf@plt>
jmp    11d1 <main+0x91>
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
sub    $0x18,%rsp
lea    0xeb1(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x8(%rsp),%edi
shl    $0x2,%edi
call   1050 <malloc@plt>
movslq 0x8(%rsp),%rbp
test   %rbp,%rbp
jle    1219 <main+0xd9>
mov    %rax,%rbx
lea    0x1(%rbp),%r14d
neg    %rbp
lea    0x14(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xc(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xe59(%rip),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x14(%rsp),%edi
mov    0x10(%rsp),%esi
mov    0xc(%rsp),%edx
call   1030 <zning@plt>
movslq 0x8(%rsp),%rcx
add    %rbp,%rcx
mov    %eax,(%rbx,%rcx,4)
add    $0xffffffff,%r14d
add    $0x1,%rbp
cmp    $0x1,%r14d
ja     11a0 <main+0x60>
cmpl   $0x0,0x8(%rsp)
jle    1219 <main+0xd9>
xor    %ebp,%ebp
lea    0xe18(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,4),%esi
add    $0x1,%rbp
mov    %r14,%rdi
call   1040 <printf@plt>
movslq 0x8(%rsp),%rax
cmp    %rax,%rbp
jl     1200 <main+0xc0>
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 = [9 x i8] c"%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* %5)
%9 = load i32, i32* %5
%10 = sext i32 %9 to i64
%11 = mul i64 4, %10
%12 = trunc i64 %11 to i32
%13 = call i64 @malloc(i32 %12)
%14 = inttoptr i64 %13 to i32*
store i32* %14, i32** %7
%15 = load i32, i32* %5
store i32 %15, i32* %6
br label %16
16: ; preds = %19, %0
%17 = load i32, i32* %6
%18 = icmp sgt i32 %17, 0
br i1 %18, label %19, label %33
19: ; preds = %16
%20 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%21 = load i32, i32* %2
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = call i32 @zning(i32 %21, i32 %22, i32 %23)
%25 = load i32*, i32** %7
%26 = load i32, i32* %5
%27 = load i32, i32* %6
%28 = sub nsw i32 %26, %27
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %25, i64 %29
store i32 %24, i32* %30
%31 = load i32, i32* %6
%32 = add nsw i32 %31, -1
store i32 %32, i32* %6
br label %16
33: ; preds = %16
br label %34
34: ; preds = %38, %33
%35 = load i32, i32* %6
%36 = load i32, i32* %5
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %46
38: ; preds = %34
%39 = load i32*, i32** %7
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
%42 = sext i32 %40 to i64
%43 = getelementptr inbounds i32, i32* %39, i64 %42
%44 = load i32, i32* %43
%45 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %44)
br label %34
46: ; preds = %34
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [9 x i8] c"%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 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%10 = load i32, i32* %4
%11 = shl i32 %10, 2
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i32*
%14 = load i32, i32* %4
%15 = icmp sgt i32 %14, 0
br i1 %15, label %19, label %41
16: ; preds = %19
%17 = load i32, i32* %4
%18 = icmp sgt i32 %17, 0
br i1 %18, label %32, label %41
19: ; preds = %0, %19
%20 = phi i32 [ %30, %19 ], [ %14, %0 ]
%21 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%22 = load i32, i32* %1
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = call i32 @zning(i32 %22, i32 %23, i32 %24)
%26 = load i32, i32* %4
%27 = sub nsw i32 %26, %20
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i32, i32* %13, i64 %28
store i32 %25, i32* %29
%30 = add nsw i32 %20, -1
%31 = icmp ugt i32 %20, 1
br i1 %31, label %19, label %16
32: ; preds = %16, %32
%33 = phi i64 [ %34, %32 ], [ 0, %16 ]
%34 = add nuw nsw i64 %33, 1
%35 = getelementptr inbounds i32, i32* %13, i64 %33
%36 = load i32, i32* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %4
%39 = sext i32 %38 to i64
%40 = icmp slt i64 %34, %39
br i1 %40, label %32, label %41
41: ; preds = %32, %0, %16
ret i32 0
}