#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__ EOF;
int /*<<< orphan*/ printf(char *, int, int);
scalar_t__ scanf(char *, int *, int *);
int main() {
  int base, exp;
  scanf("%d %d", &base, &exp);
  if (exp == 0) {
    printf("%d %d", 0, 0);
  } else {
    printf("%d %d", base * exp, exp - 1);
    while ((scanf("%d %d", &base, &exp)) != EOF) {
      if (exp == 0) {
        ;
      } else {
        printf(" %d %d", base * exp, exp - 1);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecb(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    1162 <main+0x42>
lea    0xead(%rip),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <printf@plt>
jmp    11d1 <main+0xb1>
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
lea    0xe7f(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    0x2e52(%rip),%rcx
cmp    (%rcx),%rax
je     11cc <main+0xac>
cmpl   $0x0,-0xc(%rbp)
jne    11ae <main+0x8e>
jmp    11c7 <main+0xa7>
mov    -0x8(%rbp),%esi
imul   -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
jmp    117b <main+0x5b>
jmp    11d1 <main+0xb1>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecd(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
mov    0x8(%rsp),%edx
test   %edx,%edx
je     11e0 <main+0xc0>
mov    0xc(%rsp),%esi
imul   %edx,%esi
add    $0xffffffff,%edx
lea    0xea1(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0x2e67(%rip),%r13
cmp    0x0(%r13),%rax
je     11f0 <main+0xd0>
lea    0xe73(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x8(%rsp),%rbx
lea    0xe61(%rip),%r12
jmp    11c4 <main+0xa4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1040 <scanf@plt>
cmp    0x0(%r13),%rax
je     11f0 <main+0xd0>
mov    0x8(%rsp),%edx
test   %edx,%edx
je     11b0 <main+0x90>
mov    0xc(%rsp),%esi
imul   %edx,%esi
add    $0xffffffff,%edx
mov    %r12,%rdi
call   1030 <printf@plt>
jmp    11b0 <main+0x90>
lea    0xe1a(%rip),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@EOF = global i64 0
@.str.1 = [7 x i8] c" %d %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 0, i32 0)
br label %33
9: ; preds = %0
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = mul nsw i32 %10, %11
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 1
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %12, i32 %14)
br label %16
16: ; preds = %31, %9
%17 = call i64 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3)
%18 = load i64, i64* @EOF
%19 = icmp ne i64 %17, %18
br i1 %19, label %20, label %32
20: ; preds = %16
%21 = load i32, i32* %3
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %20
br label %31
24: ; preds = %20
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = mul nsw i32 %25, %26
%28 = load i32, i32* %3
%29 = sub nsw i32 %28, 1
%30 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %27, i32 %29)
br label %31
31: ; preds = %24, %23
br label %16
32: ; preds = %16
br label %33
33: ; preds = %32, %7
ret i32 0
}

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