#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 */
struct tnode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ make_set(int, struct tnode **);
int /*<<< orphan*/ print_set(int, struct tnode **);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ union_set(int, int, struct tnode **);
int main(int argc, char *argv[]) {
  struct tnode *root = NULL;
  int data;
  int n;
  int key1;
  int key2;
  scanf("%d", &n);
  while (n--) {
    scanf("%d", &data);
    make_set(data, &root);
  }
  scanf("%d", &key1);
  scanf("%d", &key2);
  print_set(key1, &root);
  print_set(key2, &root);
  union_set(key1, key2, &root);
  print_set(key1, &root);
  print_set(key2, &root);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xe9b(%rip),%rdi
lea    -0x20(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x20(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x20(%rbp)
cmp    $0x0,%eax
je     11a3 <main+0x63>
lea    0xe77(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x1c(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1050 <make_set@plt>
jmp    116e <main+0x2e>
lea    0xe56(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe46(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x24(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1030 <print_set@plt>
mov    -0x28(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1030 <print_set@plt>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
lea    -0x18(%rbp),%rdx
call   1040 <union_set@plt>
mov    -0x24(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1030 <print_set@plt>
mov    -0x28(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1030 <print_set@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movq   $0x0,0x18(%rsp)
lea    0xea7(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1060 <scanf@plt>
subl   $0x1,0x10(%rsp)
jb     119e <main+0x5e>
lea    0xe8f(%rip),%r14
lea    0x14(%rsp),%r15
lea    0x18(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
mov    0x14(%rsp),%edi
mov    %rbx,%rsi
call   1050 <make_set@plt>
subl   $0x1,0x10(%rsp)
jae    1180 <main+0x40>
lea    0xe5b(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    0xc(%rsp),%edi
lea    0x18(%rsp),%rbx
mov    %rbx,%rsi
call   1030 <print_set@plt>
mov    0x8(%rsp),%edi
mov    %rbx,%rsi
call   1030 <print_set@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    %rbx,%rdx
call   1040 <union_set@plt>
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
call   1030 <print_set@plt>
mov    0x8(%rsp),%edi
mov    %rbx,%rsi
call   1030 <print_set@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
%struct.tnode = type { i32 }
@.str = [3 x i8] c"%d\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.tnode*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = bitcast %struct.tnode** %3 to i8*
store %struct.tnode* null, %struct.tnode** %3
%9 = bitcast i32* %4 to i8*
%10 = bitcast i32* %5 to i8*
%11 = bitcast i32* %6 to i8*
%12 = bitcast i32* %7 to i8*
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%14 = load i32, i32* %5
%15 = add nsw i32 %14, -1
store i32 %15, i32* %5
%16 = icmp eq i32 %14, 0
br i1 %16, label %24, label %17
17: ; preds = %2, %17
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%19 = load i32, i32* %4
%20 = call i32 @make_set(i32 %19, %struct.tnode** %3)
%21 = load i32, i32* %5
%22 = add nsw i32 %21, -1
store i32 %22, i32* %5
%23 = icmp eq i32 %21, 0
br i1 %23, label %24, label %17
24: ; preds = %17, %2
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
%27 = load i32, i32* %6
%28 = call i32 @print_set(i32 %27, %struct.tnode** %3)
%29 = load i32, i32* %7
%30 = call i32 @print_set(i32 %29, %struct.tnode** %3)
%31 = load i32, i32* %6
%32 = load i32, i32* %7
%33 = call i32 @union_set(i32 %31, i32 %32, %struct.tnode** %3)
%34 = load i32, i32* %6
%35 = call i32 @print_set(i32 %34, %struct.tnode** %3)
%36 = load i32, i32* %7
%37 = call i32 @print_set(i32 %36, %struct.tnode** %3)
ret i32 0
}