#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 n;
  int i;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    make_set(i, &root);
  }
  union_set(1, 5, &root);
  print_set(1, &root);
  union_set(3, 7, &root);
  print_set(3, &root);
  union_set(1, 4, &root);
  print_set(1, &root);
  union_set(5, 7, &root);
  print_set(5, &root);
  union_set(0, 8, &root);
  print_set(0, &root);
  union_set(6, 9, &root);
  print_set(6, &root);
  union_set(3, 9, &root);
  print_set(3, &root);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
lea    0xe9b(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    119b <main+0x5b>
mov    -0x20(%rbp),%edi
lea    -0x18(%rbp),%rsi
call   1050 <make_set@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1175 <main+0x35>
mov    $0x1,%edi
mov    $0x5,%esi
lea    -0x18(%rbp),%rdx
call   1040 <union_set@plt>
mov    $0x1,%edi
lea    -0x18(%rbp),%rsi
call   1030 <print_set@plt>
mov    $0x3,%edi
mov    $0x7,%esi
lea    -0x18(%rbp),%rdx
call   1040 <union_set@plt>
mov    $0x3,%edi
lea    -0x18(%rbp),%rsi
call   1030 <print_set@plt>
mov    $0x1,%edi
mov    $0x4,%esi
lea    -0x18(%rbp),%rdx
call   1040 <union_set@plt>
mov    $0x1,%edi
lea    -0x18(%rbp),%rsi
call   1030 <print_set@plt>
mov    $0x5,%edi
mov    $0x7,%esi
lea    -0x18(%rbp),%rdx
call   1040 <union_set@plt>
mov    $0x5,%edi
lea    -0x18(%rbp),%rsi
call   1030 <print_set@plt>
xor    %edi,%edi
mov    $0x8,%esi
lea    -0x18(%rbp),%rdx
call   1040 <union_set@plt>
xor    %edi,%edi
lea    -0x18(%rbp),%rsi
call   1030 <print_set@plt>
mov    $0x6,%edi
mov    $0x9,%esi
lea    -0x18(%rbp),%rdx
call   1040 <union_set@plt>
mov    $0x6,%edi
lea    -0x18(%rbp),%rsi
call   1030 <print_set@plt>
mov    $0x3,%edi
mov    $0x9,%esi
lea    -0x18(%rbp),%rdx
call   1040 <union_set@plt>
mov    $0x3,%edi
lea    -0x18(%rbp),%rsi
call   1030 <print_set@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movq   $0x0,0x10(%rsp)
lea    0xea9(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1183 <main+0x43>
xor    %ebx,%ebx
lea    0x10(%rsp),%r14
nop
mov    %ebx,%edi
mov    %r14,%rsi
call   1050 <make_set@plt>
add    $0x1,%ebx
cmp    0xc(%rsp),%ebx
jl     1170 <main+0x30>
lea    0x10(%rsp),%rbx
mov    $0x1,%edi
mov    $0x5,%esi
mov    %rbx,%rdx
call   1040 <union_set@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1030 <print_set@plt>
mov    $0x3,%edi
mov    $0x7,%esi
mov    %rbx,%rdx
call   1040 <union_set@plt>
mov    $0x3,%edi
mov    %rbx,%rsi
call   1030 <print_set@plt>
mov    $0x1,%edi
mov    $0x4,%esi
mov    %rbx,%rdx
call   1040 <union_set@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1030 <print_set@plt>
mov    $0x5,%edi
mov    $0x7,%esi
mov    %rbx,%rdx
call   1040 <union_set@plt>
mov    $0x5,%edi
mov    %rbx,%rsi
call   1030 <print_set@plt>
xor    %edi,%edi
mov    $0x8,%esi
mov    %rbx,%rdx
call   1040 <union_set@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1030 <print_set@plt>
mov    $0x6,%edi
mov    $0x9,%esi
mov    %rbx,%rdx
call   1040 <union_set@plt>
mov    $0x6,%edi
mov    %rbx,%rsi
call   1030 <print_set@plt>
mov    $0x3,%edi
mov    $0x9,%esi
mov    %rbx,%rdx
call   1040 <union_set@plt>
mov    $0x3,%edi
mov    %rbx,%rsi
call   1030 <print_set@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store %struct.tnode* null, %struct.tnode** %6
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %7)
store i32 0, i32* %8
br label %10
10: ; preds = %17, %2
%11 = load i32, i32* %8
%12 = load i32, i32* %7
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %20
14: ; preds = %10
%15 = load i32, i32* %8
%16 = call i32 @make_set(i32 %15, %struct.tnode** %6)
br label %17
17: ; preds = %14
%18 = load i32, i32* %8
%19 = add nsw i32 %18, 1
store i32 %19, i32* %8
br label %10
20: ; preds = %10
%21 = call i32 @union_set(i32 1, i32 5, %struct.tnode** %6)
%22 = call i32 @print_set(i32 1, %struct.tnode** %6)
%23 = call i32 @union_set(i32 3, i32 7, %struct.tnode** %6)
%24 = call i32 @print_set(i32 3, %struct.tnode** %6)
%25 = call i32 @union_set(i32 1, i32 4, %struct.tnode** %6)
%26 = call i32 @print_set(i32 1, %struct.tnode** %6)
%27 = call i32 @union_set(i32 5, i32 7, %struct.tnode** %6)
%28 = call i32 @print_set(i32 5, %struct.tnode** %6)
%29 = call i32 @union_set(i32 0, i32 8, %struct.tnode** %6)
%30 = call i32 @print_set(i32 0, %struct.tnode** %6)
%31 = call i32 @union_set(i32 6, i32 9, %struct.tnode** %6)
%32 = call i32 @print_set(i32 6, %struct.tnode** %6)
%33 = call i32 @union_set(i32 3, i32 9, %struct.tnode** %6)
%34 = call i32 @print_set(i32 3, %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 = bitcast %struct.tnode** %3 to i8*
store %struct.tnode* null, %struct.tnode** %3
%6 = bitcast i32* %4 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%8 = load i32, i32* %4
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %2, %10
%11 = phi i32 [ %13, %10 ], [ 0, %2 ]
%12 = call i32 @make_set(i32 %11, %struct.tnode** %3)
%13 = add nuw nsw i32 %11, 1
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %10, label %16
16: ; preds = %10, %2
%17 = call i32 @union_set(i32 1, i32 5, %struct.tnode** %3)
%18 = call i32 @print_set(i32 1, %struct.tnode** %3)
%19 = call i32 @union_set(i32 3, i32 7, %struct.tnode** %3)
%20 = call i32 @print_set(i32 3, %struct.tnode** %3)
%21 = call i32 @union_set(i32 1, i32 4, %struct.tnode** %3)
%22 = call i32 @print_set(i32 1, %struct.tnode** %3)
%23 = call i32 @union_set(i32 5, i32 7, %struct.tnode** %3)
%24 = call i32 @print_set(i32 5, %struct.tnode** %3)
%25 = call i32 @union_set(i32 0, i32 8, %struct.tnode** %3)
%26 = call i32 @print_set(i32 0, %struct.tnode** %3)
%27 = call i32 @union_set(i32 6, i32 9, %struct.tnode** %3)
%28 = call i32 @print_set(i32 6, %struct.tnode** %3)
%29 = call i32 @union_set(i32 3, i32 9, %struct.tnode** %3)
%30 = call i32 @print_set(i32 3, %struct.tnode** %3)
ret i32 0
}