#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 trienode {
  int dummy;
};

/* Variables and functions */
int addString(struct trienode *, char *);
struct trienode *getNode();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  struct trienode *root = getNode();
  int n, flag;
  scanf("%d", &n);
  while (n--) {
    char str[61];
    scanf("%s", str);
    flag = addString(root, str);
    if (flag) {
      printf("BAD SET\n");
      printf("%s\n", str);
      break;
    }
  }
  if (!flag) {
    printf("GOOD SET\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <getNode@plt>
mov    %rax,-0x10(%rbp)
lea    0xe9f(%rip),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     11d6 <main+0x96>
lea    -0x60(%rbp),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <addString@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     11d1 <main+0x91>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rsi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d6 <main+0x96>
jmp    116c <main+0x2c>
cmpl   $0x0,-0x18(%rbp)
jne    11ee <main+0xae>
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
xor    %eax,%eax
call   1060 <getNode@plt>
mov    %rax,%r15
lea    0xea6(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
subl   $0x1,0xc(%rsp)
jb     11a3 <main+0x63>
lea    0xe8f(%rip),%r14
lea    0x10(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <addString@plt>
test   %eax,%eax
jne    11ac <main+0x6c>
subl   $0x1,0xc(%rsp)
jae    1180 <main+0x40>
lea    0xe5c(%rip),%rdi
jmp    11bd <main+0x7d>
lea    0xe5c(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
%struct.trienode = type { i32 }
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@str = [9 x i8] c"GOOD SET\00"
@str.5 = [8 x i8] c"BAD SET\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [61 x i8]
%3 = tail call %struct.trienode* (...) @getNode()
%4 = bitcast i32* %1 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, -1
store i32 %7, i32* %1
%8 = icmp eq i32 %6, 0
br i1 %8, label %22, label %9
9: ; preds = %0
%10 = getelementptr inbounds [61 x i8], [61 x i8]* %2, i64 0, i64 0
br label %11
11: ; preds = %9, %15
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%13 = call i32 @addString(%struct.trienode* %3, i8* %10)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %11
%16 = load i32, i32* %1
%17 = add nsw i32 %16, -1
store i32 %17, i32* %1
%18 = icmp eq i32 %16, 0
br i1 %18, label %22, label %11
19: ; preds = %11
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.5, i64 0, i64 0))
%21 = call i32 @puts(i8* %10)
br label %24
22: ; preds = %15, %0
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %24
24: ; preds = %19, %22
ret i32 0
}