#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*/ addUnion(int, int);
int /*<<< orphan*/ createUF(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int isConnected(int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, ...);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  int conn, count, p, q;
  char str[80], *s;
  char command;
  int keepReading = 1;
  do {
    scanf("%s", str);
    sscanf(str, "%c:", &command);
    s = str + 2;
    switch (command) {
    case 'T':
      sscanf(s, "%d\n", &count);
      createUF(count);
      break;
    case 'U':
      sscanf(s, "%d,%d\n", &p, &q);
      addUnion(p, q);
      break;
    case 'C':
      sscanf(s, "%d,%d\n", &p, &q);
      conn = isConnected(p, q);
      if (conn) {
        printf("TRUE\n");
      } else {
        printf("FALSE\n");
      }
      fflush(stdout);
      break;
    case 'F':
    default:
      keepReading = 0;
      break;
    }
  } while (keepReading);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x80(%rbp)
lea    0xeb5(%rip),%rdi
lea    -0x70(%rbp),%rsi
mov    %rsi,-0x90(%rbp)
call   1090 <scanf@plt>
mov    -0x90(%rbp),%rdi
lea    0xe9a(%rip),%rsi
xor    %eax,%eax
lea    -0x79(%rbp),%rdx
call   1080 <sscanf@plt>
lea    -0x6e(%rbp),%rax
mov    %rax,-0x78(%rbp)
movsbl -0x79(%rbp),%eax
add    $0xffffffbd,%eax
mov    %eax,%ecx
mov    %rcx,-0x88(%rbp)
sub    $0x12,%eax
ja     12ac <main+0x13c>
mov    -0x88(%rbp),%rax
lea    0xe11(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x78(%rbp),%rdi
lea    0xe53(%rip),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1080 <sscanf@plt>
mov    -0x18(%rbp),%edi
call   1060 <createUF@plt>
jmp    12b3 <main+0x143>
mov    -0x78(%rbp),%rdi
lea    0xe2d(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1080 <sscanf@plt>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1030 <addUnion@plt>
jmp    12b3 <main+0x143>
mov    -0x78(%rbp),%rdi
lea    0xe03(%rip),%rsi
lea    -0x1c(%rbp),%rdx
lea    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1080 <sscanf@plt>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1040 <isConnected@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1288 <main+0x118>
lea    0xddc(%rip),%rdi
call   1050 <printf@plt>
jmp    1294 <main+0x124>
lea    0xdd1(%rip),%rdi
call   1050 <printf@plt>
mov    0x2d45(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
jmp    12b3 <main+0x143>
jmp    12ac <main+0x13c>
movl   $0x0,-0x80(%rbp)
jmp    12b8 <main+0x148>
cmpl   $0x0,-0x80(%rbp)
jne    1190 <main+0x20>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
lea    0x12(%rsp),%r14
lea    0xe76(%rip),%r15
lea    0x10(%rsp),%rbx
lea    0xe6d(%rip),%r12
lea    0x3(%rsp),%r13
lea    0x8(%rsp),%rbp
jmp    11d6 <main+0x66>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
lea    0xe4d(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1080 <sscanf@plt>
mov    0x4(%rsp),%edi
mov    0x8(%rsp),%esi
call   1030 <addUnion@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1090 <scanf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1080 <sscanf@plt>
movsbl 0x3(%rsp),%eax
cmp    $0x43,%eax
je     1230 <main+0xc0>
cmp    $0x55,%eax
je     11b0 <main+0x40>
cmp    $0x54,%eax
jne    1282 <main+0x112>
mov    %r14,%rdi
lea    0xdfb(%rip),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1080 <sscanf@plt>
mov    0xc(%rsp),%edi
call   1060 <createUF@plt>
jmp    11d6 <main+0x66>
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
lea    0xdcd(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rbp,%rcx
xor    %eax,%eax
call   1080 <sscanf@plt>
mov    0x4(%rsp),%edi
mov    0x8(%rsp),%esi
call   1050 <isConnected@plt>
test   %eax,%eax
lea    0xdb5(%rip),%rdi
lea    0xda8(%rip),%rax
cmove  %rax,%rdi
call   1040 <puts@plt>
mov    0x2d6a(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
jmp    11d6 <main+0x66>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%c:\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [7 x i8] c"%d,%d\0A\00"
@.str.4 = [6 x i8] c"TRUE\0A\00"
@.str.5 = [7 x i8] c"FALSE\0A\00"
@stdout = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [80 x i8]
%11 = alloca i8*
%12 = alloca i8
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %13
br label %14
14: ; preds = %52, %2
%15 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 0
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 0
%18 = call i32 (i8*, i8*, ...) @sscanf(i8* %17, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %10, i64 0, i64 0
%20 = getelementptr inbounds i8, i8* %19, i64 2
store i8* %20, i8** %11
%21 = load i8, i8* %12
%22 = sext i8 %21 to i32
switch i32 %22, label %50 [
i32 84, label %23
i32 85, label %28
i32 67, label %34
i32 70, label %49
]
23: ; preds = %14
%24 = load i8*, i8** %11
%25 = call i32 (i8*, i8*, ...) @sscanf(i8* %24, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %7)
%26 = load i32, i32* %7
%27 = call i32 @createUF(i32 %26)
br label %51
28: ; preds = %14
%29 = load i8*, i8** %11
%30 = call i32 (i8*, i8*, ...) @sscanf(i8* %29, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32* %8, i32* %9)
%31 = load i32, i32* %8
%32 = load i32, i32* %9
%33 = call i32 @addUnion(i32 %31, i32 %32)
br label %51
34: ; preds = %14
%35 = load i8*, i8** %11
%36 = call i32 (i8*, i8*, ...) @sscanf(i8* %35, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32* %8, i32* %9)
%37 = load i32, i32* %8
%38 = load i32, i32* %9
%39 = call i32 @isConnected(i32 %37, i32 %38)
store i32 %39, i32* %6
%40 = load i32, i32* %6
%41 = icmp ne i32 %40, 0
br i1 %41, label %42, label %44
42: ; preds = %34
%43 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %46
44: ; preds = %34
%45 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
br label %46
46: ; preds = %44, %42
%47 = load i32, i32* @stdout
%48 = call i32 @fflush(i32 %47)
br label %51
49: ; preds = %14
br label %50
50: ; preds = %14, %49
store i32 0, i32* %13
br label %51
51: ; preds = %50, %46, %28, %23
br label %52
52: ; preds = %51
%53 = load i32, i32* %13
%54 = icmp ne i32 %53, 0
br i1 %54, label %14, label %55
55: ; preds = %52
%56 = load i32, i32* %3
ret i32 %56
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%c:\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [7 x i8] c"%d,%d\0A\00"
@stdout = global i32 0
@str = [6 x i8] c"FALSE\00"
@str.6 = [5 x i8] c"TRUE\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [80 x i8]
%7 = alloca i8
%8 = bitcast i32* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 2
br label %13
13: ; preds = %22, %2
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
%15 = call i32 (i8*, i8*, ...) @sscanf(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%16 = load i8, i8* %7
%17 = sext i8 %16 to i32
switch i32 %17, label %38 [
i32 84, label %18
i32 85, label %23
i32 67, label %28
]
18: ; preds = %13
%19 = call i32 (i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%20 = load i32, i32* %3
%21 = call i32 @createUF(i32 %20)
br label %22
22: ; preds = %18, %23, %28
br label %13
23: ; preds = %13
%24 = call i32 (i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32* %4, i32* %5)
%25 = load i32, i32* %4
%26 = load i32, i32* %5
%27 = call i32 @addUnion(i32 %25, i32 %26)
br label %22
28: ; preds = %13
%29 = call i32 (i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32* %4, i32* %5)
%30 = load i32, i32* %4
%31 = load i32, i32* %5
%32 = call i32 @isConnected(i32 %30, i32 %31)
%33 = icmp eq i32 %32, 0
%34 = select i1 %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.6, i64 0, i64 0)
%35 = call i32 @puts(i8* dereferenceable(1) %34)
%36 = load i32, i32* @stdout
%37 = call i32 @fflush(i32 %36)
br label %22
38: ; preds = %13
ret i32 0
}