#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 getPowerSequence(int, int, int *);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, int *, int *);
int main(void) {
  int n, base, powerSequence[200], lenSeq, i;
  while (scanf("%d %d", &n, &base) > 0) {
    lenSeq = getPowerSequence(n, base, powerSequence);
    if (lenSeq < 0)
      printf("Boring!\n");
    else {
      printf("%d", powerSequence[0]);
      for (i = 1; i < lenSeq; i++)
        printf(" %d", powerSequence[i]);
      printf("\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
cmp    $0x0,%rax
jle    120b <main+0xdb>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
lea    -0x330(%rbp),%rdx
call   1040 <getPowerSequence@plt>
mov    %eax,-0x334(%rbp)
cmpl   $0x0,-0x334(%rbp)
jge    1198 <main+0x68>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1206 <main+0xd6>
mov    -0x330(%rbp),%esi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x338(%rbp)
mov    -0x338(%rbp),%eax
cmp    -0x334(%rbp),%eax
jge    11f8 <main+0xc8>
movslq -0x338(%rbp),%rax
mov    -0x330(%rbp,%rax,4),%esi
lea    0xe25(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x338(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x338(%rbp)
jmp    11b6 <main+0x86>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1142 <main+0x12>
xor    %eax,%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x338,%rsp
lea    0xe98(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1070 <scanf@plt>
test   %rax,%rax
jle    1231 <main+0xe1>
lea    0xe79(%rip),%r12
lea    0xc(%rsp),%r13
lea    0x8(%rsp),%rbx
lea    0xe6a(%rip),%r14
jmp    11bd <main+0x6d>
nopw   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1070 <scanf@plt>
test   %rax,%rax
jle    1231 <main+0xe1>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
lea    0x10(%rsp),%rdx
call   1060 <getPowerSequence@plt>
test   %eax,%eax
js     1220 <main+0xd0>
mov    %eax,%ebp
mov    0x10(%rsp),%esi
lea    0xe23(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x2,%ebp
jb     11a0 <main+0x50>
mov    %ebp,%ebp
mov    $0x1,%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x10(%rsp,%r15,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r15
cmp    %r15,%rbp
jne    1200 <main+0xb0>
jmp    11a0 <main+0x50>
nopw   0x0(%rax,%rax,1)
lea    0xddf(%rip),%rdi
call   1040 <puts@plt>
jmp    11aa <main+0x5a>
xor    %eax,%eax
add    $0x338,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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