#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*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ id_registered(char *);
scalar_t__ id_tagged(char *);
scalar_t__ input_sanitized(int, char **);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ tag_id(char *);
int main(int argc, char **argv) {
  if (input_sanitized(argc, argv)) {
    if (id_registered(argv[1])) {
      printf("[OK] ID is valid\n\n");
      if (id_tagged(argv[1])) {
        printf("[EXITING] Level already tagged by you...\n\n");
        exit(EXIT_SUCCESS);
      } else {
        printf("[OK] Level not tagged by you\n\n");
        tag_id(argv[1]);
        printf("[OK] Level tagged\n\n");
        exit(EXIT_SUCCESS);
      }
    } else {
      printf("[EXITING] ID is not valid\n\n");
      exit(EXIT_FAILURE);
    }
  } else {
    printf("Usage: %s XXXX\n", argv[0]);
    printf("Where XXXX is your user ID\n\n");
    exit(EXIT_FAILURE);
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1060 <input_sanitized@plt>
cmp    $0x0,%rax
je     1237 <main+0xd7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <id_registered@plt>
cmp    $0x0,%rax
je     121b <main+0xbb>
lea    0xe56(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1080 <id_tagged@plt>
cmp    $0x0,%rax
je     11e4 <main+0x84>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2dfb(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <tag_id@plt>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2dc4(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
lea    0xe4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d7f(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
call   1070 <input_sanitized@plt>
test   %rax,%rax
jne    1198 <main+0x28>
mov    (%rbx),%rsi
lea    0xe78(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe7a(%rip),%rdi
jmp    11ad <main+0x3d>
mov    0x8(%rbx),%rdi
call   1040 <id_registered@plt>
test   %rax,%rax
jne    11c0 <main+0x50>
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e27(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>
lea    0xe80(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rbx),%rdi
call   1090 <id_tagged@plt>
test   %rax,%rax
jne    11f8 <main+0x88>
lea    0xe78(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rbx),%rdi
call   1060 <tag_id@plt>
lea    0xe81(%rip),%rdi
jmp    11ff <main+0x8f>
lea    0xe8b(%rip),%rdi
call   1030 <puts@plt>
mov    0x2dcd(%rip),%rax
mov    (%rax),%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"[OK] ID is valid\0A\0A\00"
@.str.1 = [43 x i8] c"[EXITING] Level already tagged by you...\0A\0A\00"
@EXIT_SUCCESS = global i32 0
@.str.2 = [31 x i8] c"[OK] Level not tagged by you\0A\0A\00"
@.str.3 = [20 x i8] c"[OK] Level tagged\0A\0A\00"
@.str.4 = [28 x i8] c"[EXITING] ID is not valid\0A\0A\00"
@EXIT_FAILURE = global i32 0
@.str.5 = [16 x i8] c"Usage: %s XXXX\0A\00"
@.str.6 = [29 x i8] c"Where XXXX is your user ID\0A\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i64 @input_sanitized(i32 %6, i8** %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %40
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @id_registered(i8* %13)
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %36
16: ; preds = %10
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = call i64 @id_tagged(i8* %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %27
23: ; preds = %16
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%25 = load i32, i32* @EXIT_SUCCESS
%26 = call i32 @exit(i32 %25)
unreachable
27: ; preds = %16
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @tag_id(i8* %31)
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%34 = load i32, i32* @EXIT_SUCCESS
%35 = call i32 @exit(i32 %34)
unreachable
36: ; preds = %10
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0))
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %2
%41 = load i8**, i8*** %5
%42 = getelementptr inbounds i8*, i8** %41, i64 0
%43 = load i8*, i8** %42
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* %43)
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%46 = load i32, i32* @EXIT_FAILURE
%47 = call i32 @exit(i32 %46)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@EXIT_FAILURE = global i32 0
@.str.5 = [16 x i8] c"Usage: %s XXXX\0A\00"
@str = [28 x i8] c"Where XXXX is your user ID\0A\00"
@str.7 = [27 x i8] c"[EXITING] ID is not valid\0A\00"
@str.8 = [18 x i8] c"[OK] ID is valid\0A\00"
@str.9 = [30 x i8] c"[OK] Level not tagged by you\0A\00"
@str.10 = [19 x i8] c"[OK] Level tagged\0A\00"
@str.11 = [42 x i8] c"[EXITING] Level already tagged by you...\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i64 @input_sanitized(i32 %0, i8** %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %30, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i64 @id_registered(i8* %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %26, label %10
10: ; preds = %5
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.8, i64 0, i64 0))
%12 = load i8*, i8** %6
%13 = tail call i64 @id_tagged(i8* %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %10
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.11, i64 0, i64 0))
%17 = load i32, i32* @EXIT_SUCCESS
%18 = tail call i32 @exit(i32 %17)
unreachable
19: ; preds = %10
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.9, i64 0, i64 0))
%21 = load i8*, i8** %6
%22 = tail call i32 @tag_id(i8* %21)
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.10, i64 0, i64 0))
%24 = load i32, i32* @EXIT_SUCCESS
%25 = tail call i32 @exit(i32 %24)
unreachable
26: ; preds = %5
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.7, i64 0, i64 0))
%28 = load i32, i32* @EXIT_FAILURE
%29 = tail call i32 @exit(i32 %28)
unreachable
30: ; preds = %2
%31 = load i8*, i8** %1
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), i8* %31)
%33 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%34 = load i32, i32* @EXIT_FAILURE
%35 = tail call i32 @exit(i32 %34)
unreachable
}