#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*/ scanf(char *, ...);
int main() {
  long long unsigned num, dim_arr[20];
  int dim, i, curr_dim;
  scanf("%d %llu", &dim, &num);
  num--;
  for (i = 0; i < dim; i++) {
    scanf("%llu", &dim_arr[i]);
  }
  for (i = 0; i < dim; i++) {
    curr_dim = num / dim_arr[i];
    num = num % dim_arr[i];
    printf("%d ", curr_dim);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0xb4(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
cmp    -0xb4(%rbp),%eax
jge    11aa <main+0x8a>
movslq -0xb8(%rbp),%rax
lea    -0xb0(%rbp),%rsi
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    1161 <main+0x41>
movl   $0x0,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
cmp    -0xb4(%rbp),%eax
jge    1220 <main+0x100>
mov    -0x10(%rbp),%rax
movslq -0xb8(%rbp),%rcx
xor    %edx,%edx
divq   -0xb0(%rbp,%rcx,8)
ff
mov    %eax,-0xbc(%rbp)
mov    -0x10(%rbp),%rax
movslq -0xb8(%rbp),%rcx
xor    %edx,%edx
divq   -0xb0(%rbp,%rcx,8)
ff
mov    %rdx,-0x10(%rbp)
mov    -0xbc(%rbp),%esi
lea    0xe01(%rip),%rdi
call   1030 <printf@plt>
mov    -0xb8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb8(%rbp)
jmp    11b4 <main+0x94>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xb0,%rsp
lea    0xecd(%rip),%rdi
lea    0x4(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
addq   $0xffffffffffffffff,0x8(%rsp)
cmpl   $0x0,0x4(%rsp)
jle    11e1 <main+0xc1>
lea    0x10(%rsp),%r15
lea    0xea2(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
add    $0x8,%r15
cmp    %rax,%rbx
jl     1170 <main+0x50>
test   %eax,%eax
jle    11e1 <main+0xc1>
xor    %ebx,%ebx
lea    0xe6c(%rip),%r14
jmp    11c3 <main+0xa3>
xchg   %ax,%ax
xor    %edx,%edx
div    %rcx
mov    %rax,%rsi
mov    %rdx,0x8(%rsp)
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
cmp    %rax,%rbx
jge    11e1 <main+0xc1>
mov    0x8(%rsp),%rax
mov    0x10(%rsp,%rbx,8),%rcx
mov    %rax,%rdx
or     %rcx,%rdx
shr    $0x20,%rdx
jne    11a0 <main+0x80>
xor    %edx,%edx
div    %ecx
mov    %eax,%esi
jmp    11a8 <main+0x88>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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