#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*/ freopen(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ qubits(short, char, char, char);
int /*<<< orphan*/ scanf(char *, short *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main() {
  short N;
  freopen("qubits.in", "r", stdin);
  freopen("qubits.out", "w", stdout);
  scanf("%hd", &N);
  qubits(N, 'A', 'C', 'B');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edx
lea    0xeb1(%rip),%rdi
lea    0xeb4(%rip),%rsi
call   1040 <freopen@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%edx
lea    0xea1(%rip),%rdi
lea    0xea5(%rip),%rsi
call   1040 <freopen@plt>
lea    0xe9b(%rip),%rdi
lea    -0x6(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x41,%esi
mov    $0x43,%edx
mov    $0x42,%ecx
movswl -0x6(%rbp),%edi
call   1030 <qubits@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2eb0(%rip),%rax
mov    (%rax),%edx
lea    0xebf(%rip),%rdi
lea    0xec2(%rip),%rsi
call   1040 <freopen@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edx
lea    0xeaf(%rip),%rdi
lea    0xeb3(%rip),%rsi
call   1040 <freopen@plt>
lea    0xea9(%rip),%rdi
lea    0x6(%rsp),%rsi
call   1050 <scanf@plt>
movswl 0x6(%rsp),%edi
mov    $0x41,%esi
mov    $0x43,%edx
mov    $0x42,%ecx
call   1030 <qubits@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"qubits.in\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [11 x i8] c"qubits.out\00"
@.str.3 = [2 x i8] c"w\00"
@stdout = global i32 0
@.str.4 = [4 x i8] c"%hd\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i16
store i32 0, i32* %1
%3 = load i32, i32* @stdin
%4 = call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @stdout
%6 = call i32 @freopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %5)
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i16* %2)
%8 = load i16, i16* %2
%9 = call i32 @qubits(i16 signext %8, i8 signext 65, i8 signext 67, i8 signext 66)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"qubits.in\00"
@.str.1 = [2 x i8] c"r\00"
@stdin = global i32 0
@.str.2 = [11 x i8] c"qubits.out\00"
@.str.3 = [2 x i8] c"w\00"
@stdout = global i32 0
@.str.4 = [4 x i8] c"%hd\00"
define i32 @main() {
%1 = alloca i16
%2 = bitcast i16* %1 to i8*
%3 = load i32, i32* @stdin
%4 = tail call i32 @freopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @stdout
%6 = tail call i32 @freopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i32 %5)
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i16* %1)
%8 = load i16, i16* %1
%9 = call i32 @qubits(i16 signext %8, i8 signext 65, i8 signext 67, i8 signext 66)
ret i32 0
}