#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*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
void solve(int n, int k) {
  if (k == 0) {
    for (int i = 1; i <= n; i++) {
      printf("%d ", i);
    }
  } else if (k == 1 && n != 3) {
    for (int i = n; i > 0 && i <= n; i--) {
      printf("%d ", i);
    }
  } else if (k * 2 == n) {
    for (int i = k + 1; i <= n; i++) {
      printf("%d ", i);
    }
    for (int i = 1; i <= k; i++) {
      printf("%d ", i);
    }
  } else {
    puts("-1");
    return;
  }
  puts("");
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    116d <solve+0x4d>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1168 <solve+0x48>
mov    -0xc(%rbp),%esi
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113f <solve+0x1f>
jmp    1265 <solve+0x145>
cmpl   $0x1,-0x8(%rbp)
jne    11d4 <solve+0xb4>
cmpl   $0x3,-0x4(%rbp)
je     11d4 <solve+0xb4>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x19(%rbp)
jle    11a2 <solve+0x82>
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
setle  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11b2 <solve+0x92>
jmp    11cf <solve+0xaf>
mov    -0x10(%rbp),%esi
lea    0xe44(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1187 <solve+0x67>
jmp    1260 <solve+0x140>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
cmp    -0x4(%rbp),%eax
jne    124a <solve+0x12a>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1215 <solve+0xf5>
mov    -0x14(%rbp),%esi
lea    0xdfe(%rip),%rdi
call   1040 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11ec <solve+0xcc>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1245 <solve+0x125>
mov    -0x18(%rbp),%esi
lea    0xdce(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    121c <solve+0xfc>
jmp    125b <solve+0x13b>
lea    0xdb3(%rip),%rdi
call   1030 <puts@plt>
jmp    1271 <solve+0x151>
jmp    1260 <solve+0x140>
jmp    1265 <solve+0x145>
lea    0xd97(%rip),%rdi
call   1030 <puts@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
test   %esi,%esi
je     117f <solve+0x4f>
mov    %esi,%r14d
cmp    $0x3,%ebx
je     11be <solve+0x8e>
cmp    $0x1,%r14d
jne    11be <solve+0x8e>
test   %ebx,%ebx
jle    122d <solve+0xfd>
lea    0xea6(%rip),%r14
mov    %ebx,%ebp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebp,%esi
call   1050 <printf@plt>
cmp    $0x2,%ebp
jb     122d <solve+0xfd>
add    $0xffffffff,%ebp
cmp    %ebx,%ebp
jle    1160 <solve+0x30>
jmp    122d <solve+0xfd>
test   %ebx,%ebx
jle    122d <solve+0xfd>
neg    %ebx
mov    $0x1,%ebp
lea    0xe6b(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %ebp,%esi
call   1050 <printf@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    11a0 <solve+0x70>
jmp    122d <solve+0xfd>
lea    (%r14,%r14,1),%eax
cmp    %ebx,%eax
jne    1241 <solve+0x111>
cmp    %ebx,%r14d
jge    11fc <solve+0xcc>
neg    %ebx
lea    0x1(%r14),%ebp
lea    0xe28(%rip),%r15
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %ebp,%esi
call   1050 <printf@plt>
lea    (%rbx,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    11e0 <solve+0xb0>
test   %r14d,%r14d
jle    122d <solve+0xfd>
neg    %r14d
mov    $0x1,%ebp
lea    0xdf0(%rip),%rbx
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <printf@plt>
lea    (%r14,%rbp,1),%eax
add    $0x1,%eax
mov    %ebp,%ecx
add    $0x1,%ecx
mov    %ecx,%ebp
cmp    $0x1,%eax
jne    1210 <solve+0xe0>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>
lea    0xdbc(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [3 x i8] c"-1\00"
@.str.2 = [1 x i8] zeroinitializer
define void @solve(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %23
11: ; preds = %2
store i32 1, i32* %5
br label %12
12: ; preds = %19, %11
%13 = load i32, i32* %5
%14 = load i32, i32* %3
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %22
16: ; preds = %12
%17 = load i32, i32* %5
%18 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
br label %19
19: ; preds = %16
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %12
22: ; preds = %12
br label %81
23: ; preds = %2
%24 = load i32, i32* %4
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %47
26: ; preds = %23
%27 = load i32, i32* %3
%28 = icmp ne i32 %27, 3
br i1 %28, label %29, label %47
29: ; preds = %26
%30 = load i32, i32* %3
store i32 %30, i32* %6
br label %31
31: ; preds = %43, %29
%32 = load i32, i32* %6
%33 = icmp sgt i32 %32, 0
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = load i32, i32* %6
%36 = load i32, i32* %3
%37 = icmp sle i32 %35, %36
br label %38
38: ; preds = %34, %31
%39 = phi i1 [ false, %31 ], [ %37, %34 ]
br i1 %39, label %40, label %46
40: ; preds = %38
%41 = load i32, i32* %6
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %41)
br label %43
43: ; preds = %40
%44 = load i32, i32* %6
%45 = add nsw i32 %44, -1
store i32 %45, i32* %6
br label %31
46: ; preds = %38
br label %80
47: ; preds = %26, %23
%48 = load i32, i32* %4
%49 = mul nsw i32 %48, 2
%50 = load i32, i32* %3
%51 = icmp eq i32 %49, %50
br i1 %51, label %52, label %77
52: ; preds = %47
%53 = load i32, i32* %4
%54 = add nsw i32 %53, 1
store i32 %54, i32* %7
br label %55
55: ; preds = %62, %52
%56 = load i32, i32* %7
%57 = load i32, i32* %3
%58 = icmp sle i32 %56, %57
br i1 %58, label %59, label %65
59: ; preds = %55
%60 = load i32, i32* %7
%61 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %60)
br label %62
62: ; preds = %59
%63 = load i32, i32* %7
%64 = add nsw i32 %63, 1
store i32 %64, i32* %7
br label %55
65: ; preds = %55
store i32 1, i32* %8
br label %66
66: ; preds = %73, %65
%67 = load i32, i32* %8
%68 = load i32, i32* %4
%69 = icmp sle i32 %67, %68
br i1 %69, label %70, label %76
70: ; preds = %66
%71 = load i32, i32* %8
%72 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %71)
br label %73
73: ; preds = %70
%74 = load i32, i32* %8
%75 = add nsw i32 %74, 1
store i32 %75, i32* %8
br label %66
76: ; preds = %66
br label %79
77: ; preds = %47
%78 = call i32 @puts(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %83
79: ; preds = %76
br label %80
80: ; preds = %79, %46
br label %81
81: ; preds = %80, %22
%82 = call i32 @puts(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %83
83: ; preds = %81, %77
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
@.str.1 = [3 x i8] c"-1\00"
define void @solve(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = icmp slt i32 %0, 1
br i1 %5, label %43, label %6
6: ; preds = %4, %6
%7 = phi i32 [ %9, %6 ], [ 1, %4 ]
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = add nuw i32 %7, 1
%10 = icmp eq i32 %7, %0
br i1 %10, label %43, label %6
11: ; preds = %2
%12 = icmp eq i32 %1, 1
%13 = icmp ne i32 %0, 3
%14 = and i1 %13, %12
br i1 %14, label %15, label %24
15: ; preds = %11
%16 = icmp sgt i32 %0, 0
br i1 %16, label %17, label %43
17: ; preds = %15, %17
%18 = phi i32 [ %20, %17 ], [ %0, %15 ]
%19 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = add nsw i32 %18, -1
%21 = icmp ugt i32 %18, 1
%22 = icmp sle i32 %20, %0
%23 = and i1 %21, %22
br i1 %23, label %17, label %43
24: ; preds = %11
%25 = shl nsw i32 %1, 1
%26 = icmp eq i32 %25, %0
br i1 %26, label %27, label %41
27: ; preds = %24
%28 = icmp slt i32 %1, %0
br i1 %28, label %31, label %29
29: ; preds = %31, %27
%30 = icmp slt i32 %1, 1
br i1 %30, label %43, label %36
31: ; preds = %27, %31
%32 = phi i32 [ %33, %31 ], [ %1, %27 ]
%33 = add nsw i32 %32, 1
%34 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %33)
%35 = icmp eq i32 %33, %0
br i1 %35, label %29, label %31
36: ; preds = %29, %36
%37 = phi i32 [ %39, %36 ], [ 1, %29 ]
%38 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %37)
%39 = add nuw i32 %37, 1
%40 = icmp eq i32 %37, %1
br i1 %40, label %43, label %36
41: ; preds = %24
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %45
43: ; preds = %36, %17, %6, %29, %15, %4
%44 = tail call i32 @putchar(i32 10)
br label %45
45: ; preds = %43, %41
ret void
}