#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*/ main_program(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int valid_key(char *);
int main(int arg, char *argsv[]) {
  char *typedkey;
  if (arg <= 1) {
    printf("\t%s\n", "\tNot valid!");
  } else {
    printf("Type the password: ");
    scanf("%s", typedkey);
    if (valid_key(typedkey) == 1) {
      main_program(typedkey);
    }
  }
}


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)
cmpl   $0x1,-0x8(%rbp)
jg     117a <main+0x3a>
lea    0xe99(%rip),%rdi
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11b8 <main+0x78>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <valid_key@plt>
cmp    $0x1,%eax
jne    11b3 <main+0x73>
mov    -0x18(%rbp),%rdi
call   1060 <main_program@plt>
jmp    11b8 <main+0x78>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
jg     115d <main+0x1d>
lea    0xeb3(%rip),%rdi
lea    0xeb1(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1186 <main+0x46>
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
call   1050 <scanf@plt>
call   1030 <valid_key@plt>
cmp    $0x1,%eax
jne    1186 <main+0x46>
call   1060 <main_program@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\09%s\0A\00"
@.str.1 = [12 x i8] c"\09Not valid!\00"
@.str.2 = [20 x i8] c"Type the password: \00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sle i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %22
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%13 = load i8*, i8** %6
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %13)
%15 = load i8*, i8** %6
%16 = call i32 @valid_key(i8* %15)
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %21
18: ; preds = %11
%19 = load i8*, i8** %6
%20 = call i32 @main_program(i8* %19)
br label %21
21: ; preds = %18, %11
br label %22
22: ; preds = %21, %9
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@.str = [5 x i8] c"\09%s\0A\00"
@.str.1 = [12 x i8] c"\09Not valid!\00"
@.str.2 = [20 x i8] c"Type the password: \00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %13
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* undef)
%9 = tail call i32 @valid_key(i8* undef)
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %6
%12 = tail call i32 @main_program(i8* undef)
br label %13
13: ; preds = %6, %11, %4
ret i32 0
}