#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 /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int n;
  scanf("%d", &n);
  int b = n / 100;
  int s = n / 10 % 10;
  int g = n % 10;
  for (int i = 0; i < b; i++)
    printf("B");
  for (int i = 0; i < s; i++)
    printf("S");
  for (int i = 1; i <= g; i++)
    printf("%c", i + '0');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a0 <main+0x80>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1178 <main+0x58>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11cf <main+0xaf>
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a7 <main+0x87>
movl   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     1204 <main+0xe4>
mov    -0x20(%rbp),%esi
add    $0x30,%esi
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11d6 <main+0xb6>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed2(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%r14
imul   $0x66666667,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %eax,%ebx
sub    %ecx,%ebx
add    %eax,%eax
lea    (%rax,%rax,4),%r15d
cmp    $0x64,%r14
jl     119f <main+0x7f>
imul   $0x51eb851f,%r14,%rbp
mov    %rbp,%rax
shr    $0x3f,%rax
sar    $0x25,%rbp
add    %eax,%ebp
mov    $0x42,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
jne    1190 <main+0x70>
sub    %r15d,%r14d
test   %ebx,%ebx
jle    11bf <main+0x9f>
cs nopw 0x0(%rax,%rax,1)
mov    $0x53,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11b0 <main+0x90>
test   %r14d,%r14d
jle    11ea <main+0xca>
neg    %r14d
mov    $0x31,%ebx
nopl   0x0(%rax)
mov    %ebx,%edi
call   1030 <putchar@plt>
lea    (%r14,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x31,%eax
jne    11d0 <main+0xb0>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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