#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char, char);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
short *malloc(char);
int main() {
  FILE *f = fopen("INP.TXT", "r");
  char n, i, j;
  short m, *a;
  fscanf(f, "%hhd %hd", &n, &m);
  a = malloc(n * sizeof(short));
  for (i = 0; i < n; i++)
    fscanf(f, "%hd", a + i);
  fclose(f);
  f = fopen("OUT.TXT", "w");
  for (i = 0; i + 1 < n; i++)
    for (j = i + 1; j < n; j++)
      if (a[i] + a[j] == m) {
        fprintf(f, "%hhd %hhd\n", i + 1, j + 1);
        fclose(f);
        return 0;
      }
  fputs("-1\n", f);
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe8a(%rip),%rdi
lea    0xe8b(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe79(%rip),%rsi
lea    -0x11(%rbp),%rdx
lea    -0x16(%rbp),%rcx
mov    $0x0,%al
call   1050 <fscanf@plt>
movsbq -0x11(%rbp),%rax
shl    $0x1,%rax
movsbl %al,%edi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
movb   $0x0,-0x12(%rbp)
movsbl -0x12(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jge    11f9 <main+0x99>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rdx
movsbl -0x12(%rbp),%eax
cltq
shl    $0x1,%rax
add    %rax,%rdx
lea    0xe2a(%rip),%rsi
mov    $0x0,%al
call   1050 <fscanf@plt>
mov    -0x12(%rbp),%al
add    $0x1,%al
mov    %al,-0x12(%rbp)
jmp    11b9 <main+0x59>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe0a(%rip),%rdi
lea    0xe0b(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
movb   $0x0,-0x12(%rbp)
movsbl -0x12(%rbp),%eax
add    $0x1,%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jge    12d1 <main+0x171>
movsbl -0x12(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x13(%rbp)
movsbl -0x13(%rbp),%eax
movsbl -0x11(%rbp),%ecx
cmp    %ecx,%eax
jge    12bf <main+0x15f>
mov    -0x20(%rbp),%rax
movsbq -0x12(%rbp),%rcx
movswl (%rax,%rcx,2),%eax
mov    -0x20(%rbp),%rcx
movsbq -0x13(%rbp),%rdx
movswl (%rcx,%rdx,2),%ecx
add    %ecx,%eax
movswl -0x16(%rbp),%ecx
cmp    %ecx,%eax
jne    12ad <main+0x14d>
mov    -0x10(%rbp),%rdi
movsbl -0x12(%rbp),%eax
add    $0x1,%eax
mov    %al,%cl
movsbl -0x13(%rbp),%eax
add    $0x1,%eax
lea    0xd90(%rip),%rsi
movsbl %cl,%edx
movsbl %al,%ecx
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
jmp    12f1 <main+0x191>
jmp    12b2 <main+0x152>
mov    -0x13(%rbp),%al
add    $0x1,%al
mov    %al,-0x13(%rbp)
jmp    123a <main+0xda>
jmp    12c4 <main+0x164>
mov    -0x12(%rbp),%al
add    $0x1,%al
mov    %al,-0x12(%rbp)
jmp    121d <main+0xbd>
mov    -0x10(%rbp),%rsi
lea    0xd4c(%rip),%rdi
call   1040 <fputs@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xe8c(%rip),%rdi
lea    0xe8d(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r12
lea    0xe80(%rip),%rsi
lea    0xd(%rsp),%rdx
lea    0xe(%rsp),%rcx
mov    %rax,%rdi
xor    %eax,%eax
call   1040 <fscanf@plt>
mov    0xd(%rsp),%bl
lea    (%rbx,%rbx,1),%eax
movsbl %al,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
test   %bl,%bl
jle    11e3 <main+0x83>
lea    0xe54(%rip),%r14
mov    %r15,%r13
xor    %ebx,%ebx
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1040 <fscanf@plt>
add    $0x1,%rbx
movsbq 0xd(%rsp),%rax
add    $0x2,%r13
cmp    %rax,%rbx
jl     11c0 <main+0x60>
mov    %r12,%rdi
call   1030 <fclose@plt>
lea    0xe21(%rip),%rdi
lea    0xe22(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%r14
movsbl 0xd(%rsp),%r9d
cmp    $0x2,%r9d
jl     1266 <main+0x106>
movswl 0xe(%rsp),%r11d
movslq %r9d,%r8
mov    $0x1,%eax
xor    %r10d,%r10d
jmp    1230 <main+0xd0>
add    $0x1,%r10b
movsbl %r10b,%eax
add    $0x1,%eax
cmp    %r9d,%eax
jge    1266 <main+0x106>
cmp    %al,%r9b
jle    1220 <main+0xc0>
movsbq %r10b,%rcx
movswl (%r15,%rcx,2),%esi
movsbq %al,%rbx
lea    (%r15,%rbx,2),%rcx
mov    %r8,%rdi
sub    %rbx,%rdi
xor    %ebx,%ebx
xchg   %ax,%ax
movswl (%rcx,%rbx,2),%edx
add    %esi,%edx
cmp    %r11d,%edx
je     1281 <main+0x121>
add    $0x1,%rbx
cmp    %rbx,%rdi
jne    1250 <main+0xf0>
jmp    1220 <main+0xc0>
lea    0xdbb(%rip),%rdi
mov    $0x3,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1080 <fwrite@plt>
jmp    129e <main+0x13e>
lea    0x1(%rax),%ecx
movzbl %cl,%ecx
add    %ebx,%ecx
movsbl %cl,%ecx
movsbl %al,%edx
lea    0xd87(%rip),%rsi
mov    %r14,%rdi
call   1050 <fprintf@plt>
mov    %r14,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"INP.TXT\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"%hhd %hd\00"
@.str.3 = [4 x i8] c"%hd\00"
@.str.4 = [8 x i8] c"OUT.TXT\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [11 x i8] c"%hhd %hhd\0A\00"
@.str.7 = [4 x i8] c"-1\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i16
%7 = alloca i16*
store i32 0, i32* %1
%8 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %2
%9 = load i32*, i32** %2
%10 = call i32 (i32*, i8*, ...) @fscanf(i32* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %3, i16* %6)
%11 = load i8, i8* %3
%12 = sext i8 %11 to i64
%13 = mul i64 %12, 2
%14 = trunc i64 %13 to i8
%15 = call i16* @malloc(i8 signext %14)
store i16* %15, i16** %7
store i8 0, i8* %4
br label %16
16: ; preds = %30, %0
%17 = load i8, i8* %4
%18 = sext i8 %17 to i32
%19 = load i8, i8* %3
%20 = sext i8 %19 to i32
%21 = icmp slt i32 %18, %20
br i1 %21, label %22, label %33
22: ; preds = %16
%23 = load i32*, i32** %2
%24 = load i16*, i16** %7
%25 = load i8, i8* %4
%26 = sext i8 %25 to i32
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i16, i16* %24, i64 %27
%29 = call i32 (i32*, i8*, ...) @fscanf(i32* %23, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i16* %28)
br label %30
30: ; preds = %22
%31 = load i8, i8* %4
%32 = add i8 %31, 1
store i8 %32, i8* %4
br label %16
33: ; preds = %16
%34 = load i32*, i32** %2
%35 = call i32 @fclose(i32* %34)
%36 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %36, i32** %2
store i8 0, i8* %4
br label %37
37: ; preds = %90, %33
%38 = load i8, i8* %4
%39 = sext i8 %38 to i32
%40 = add nsw i32 %39, 1
%41 = load i8, i8* %3
%42 = sext i8 %41 to i32
%43 = icmp slt i32 %40, %42
br i1 %43, label %44, label %93
44: ; preds = %37
%45 = load i8, i8* %4
%46 = sext i8 %45 to i32
%47 = add nsw i32 %46, 1
%48 = trunc i32 %47 to i8
store i8 %48, i8* %5
br label %49
49: ; preds = %86, %44
%50 = load i8, i8* %5
%51 = sext i8 %50 to i32
%52 = load i8, i8* %3
%53 = sext i8 %52 to i32
%54 = icmp slt i32 %51, %53
br i1 %54, label %55, label %89
55: ; preds = %49
%56 = load i16*, i16** %7
%57 = load i8, i8* %4
%58 = sext i8 %57 to i64
%59 = getelementptr inbounds i16, i16* %56, i64 %58
%60 = load i16, i16* %59
%61 = sext i16 %60 to i32
%62 = load i16*, i16** %7
%63 = load i8, i8* %5
%64 = sext i8 %63 to i64
%65 = getelementptr inbounds i16, i16* %62, i64 %64
%66 = load i16, i16* %65
%67 = sext i16 %66 to i32
%68 = add nsw i32 %61, %67
%69 = load i16, i16* %6
%70 = sext i16 %69 to i32
%71 = icmp eq i32 %68, %70
br i1 %71, label %72, label %85
72: ; preds = %55
%73 = load i32*, i32** %2
%74 = load i8, i8* %4
%75 = sext i8 %74 to i32
%76 = add nsw i32 %75, 1
%77 = trunc i32 %76 to i8
%78 = load i8, i8* %5
%79 = sext i8 %78 to i32
%80 = add nsw i32 %79, 1
%81 = trunc i32 %80 to i8
%82 = call i32 @fprintf(i32* %73, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8 signext %77, i8 signext %81)
%83 = load i32*, i32** %2
%84 = call i32 @fclose(i32* %83)
store i32 0, i32* %1
br label %98
85: ; preds = %55
br label %86
86: ; preds = %85
%87 = load i8, i8* %5
%88 = add i8 %87, 1
store i8 %88, i8* %5
br label %49
89: ; preds = %49
br label %90
90: ; preds = %89
%91 = load i8, i8* %4
%92 = add i8 %91, 1
store i8 %92, i8* %4
br label %37
93: ; preds = %37
%94 = load i32*, i32** %2
%95 = call i32 @fputs(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i32* %94)
%96 = load i32*, i32** %2
%97 = call i32 @fclose(i32* %96)
store i32 0, i32* %1
br label %98
98: ; preds = %93, %72
%99 = load i32, i32* %1
ret i32 %99
}

LLVM IR (-O2):
@.str = [8 x i8] c"INP.TXT\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [9 x i8] c"%hhd %hd\00"
@.str.3 = [4 x i8] c"%hd\00"
@.str.4 = [8 x i8] c"OUT.TXT\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [11 x i8] c"%hhd %hhd\0A\00"
@.str.7 = [4 x i8] c"-1\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i16
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = bitcast i16* %2 to i8*
%5 = call i32 (i32*, i8*, ...) @fscanf(i32* %3, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %1, i16* %2)
%6 = load i8, i8* %1
%7 = shl i8 %6, 1
%8 = call i16* @malloc(i8 signext %7)
%9 = icmp sgt i8 %6, 0
br i1 %9, label %10, label %18
10: ; preds = %0, %10
%11 = phi i64 [ %14, %10 ], [ 0, %0 ]
%12 = getelementptr inbounds i16, i16* %8, i64 %11
%13 = call i32 (i32*, i8*, ...) @fscanf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i16* %12)
%14 = add nuw nsw i64 %11, 1
%15 = load i8, i8* %1
%16 = sext i8 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %10, label %18
18: ; preds = %10, %0
%19 = call i32 @fclose(i32* %3)
%20 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%21 = load i8, i8* %1
%22 = sext i8 %21 to i32
%23 = icmp sgt i8 %21, 1
br i1 %23, label %24, label %59
24: ; preds = %18
%25 = load i16, i16* %2
%26 = sext i16 %25 to i32
%27 = sext i8 %21 to i64
br label %28
28: ; preds = %24, %54
%29 = phi i32 [ 1, %24 ], [ %57, %54 ]
%30 = phi i8 [ 0, %24 ], [ %55, %54 ]
%31 = trunc i32 %29 to i8
%32 = icmp sgt i8 %21, %31
br i1 %32, label %33, label %54
33: ; preds = %28
%34 = sext i8 %30 to i64
%35 = getelementptr inbounds i16, i16* %8, i64 %34
%36 = load i16, i16* %35
%37 = sext i16 %36 to i32
%38 = sext i8 %31 to i64
br label %39
39: ; preds = %33, %51
%40 = phi i64 [ %38, %33 ], [ %52, %51 ]
%41 = getelementptr inbounds i16, i16* %8, i64 %40
%42 = load i16, i16* %41
%43 = sext i16 %42 to i32
%44 = add nsw i32 %43, %37
%45 = icmp eq i32 %44, %26
br i1 %45, label %46, label %51
46: ; preds = %39
%47 = trunc i32 %29 to i8
%48 = trunc i64 %40 to i8
%49 = add nsw i8 %48, 1
%50 = call i32 @fprintf(i32* %20, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0), i8 signext %47, i8 signext %49)
br label %61
51: ; preds = %39
%52 = add nsw i64 %40, 1
%53 = icmp eq i64 %52, %27
br i1 %53, label %54, label %39
54: ; preds = %51, %28
%55 = add i8 %30, 1
%56 = sext i8 %55 to i32
%57 = add nsw i32 %56, 1
%58 = icmp slt i32 %57, %22
br i1 %58, label %28, label %59
59: ; preds = %54, %18
%60 = call i64 @fwrite(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i64 3, i64 1, i32* %20)
br label %61
61: ; preds = %59, %46
%62 = call i32 @fclose(i32* %20)
ret i32 0
}