#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(int /*<<< orphan*/);
char *malloc(int);
int /*<<< orphan*/ printf(char *, char *);
int rand();
int /*<<< orphan*/ remove(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  char *path = argv[1];
  char *captcha = malloc(5);
  char *sure = malloc(20);
  printf("romve %s , you sure ?[y/n]:", path);
  scanf("%s", sure);
  if (sure[0] != 'Y' && sure[0] != 'y')
    exit(0);
  srand(time(NULL));
  char CAPTCHA[5];
  while (1) {
    CAPTCHA[0] = rand() % 94 + 33;
    CAPTCHA[1] = rand() % 94 + 33;
    CAPTCHA[2] = rand() % 94 + 33;
    CAPTCHA[3] = rand() % 94 + 33;
    CAPTCHA[4] = 0;
    printf("please enter the captcha |%s| :", CAPTCHA);
    scanf("%s", captcha);
    if (!strcmp(captcha, CAPTCHA))
      break;
  }
  remove(path);
  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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    $0x5,%edi
call   1080 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x14,%edi
call   1080 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe27(%rip),%rdi
call   1040 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe33(%rip),%rdi
call   1090 <scanf@plt>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x59,%eax
je     1215 <main+0x85>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x79,%eax
je     1215 <main+0x85>
xor    %edi,%edi
call   10a0 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    $0x0,%al
call   10b0 <rand@plt>
mov    $0x5e,%ecx
cltd
idiv   %ecx
add    $0x21,%edx
mov    %dl,%al
mov    %al,-0x2d(%rbp)
mov    $0x0,%al
call   10b0 <rand@plt>
mov    $0x5e,%ecx
cltd
idiv   %ecx
add    $0x21,%edx
mov    %dl,%al
mov    %al,-0x2c(%rbp)
mov    $0x0,%al
call   10b0 <rand@plt>
mov    $0x5e,%ecx
cltd
idiv   %ecx
add    $0x21,%edx
mov    %dl,%al
mov    %al,-0x2b(%rbp)
mov    $0x0,%al
call   10b0 <rand@plt>
mov    $0x5e,%ecx
cltd
idiv   %ecx
add    $0x21,%edx
mov    %dl,%al
mov    %al,-0x2a(%rbp)
movb   $0x0,-0x29(%rbp)
lea    -0x2d(%rbp),%rsi
lea    0xd8f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x20(%rbp),%rsi
lea    0xd7c(%rip),%rdi
call   1090 <scanf@plt>
mov    -0x20(%rbp),%rdi
lea    -0x2d(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    12c0 <main+0x130>
jmp    12c5 <main+0x135>
jmp    1225 <main+0x95>
mov    -0x18(%rbp),%rdi
call   1030 <remove@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    0x8(%rsi),%r14
mov    $0x5,%edi
call   1080 <malloc@plt>
mov    %rax,%rbx
mov    $0x14,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
lea    0xe3e(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
lea    0xe4b(%rip),%rdi
mov    %r15,%rsi
call   1090 <scanf@plt>
mov    (%r15),%al
or     $0x20,%al
cmp    $0x79,%al
jne    1302 <main+0x172>
xor    %edi,%edi
call   1070 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
lea    0xe24(%rip),%r15
lea    0xb(%rsp),%r12
lea    0xe15(%rip),%r13
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   10b0 <rand@plt>
cltq
imul   $0xffffffffae4c415d,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x6,%ecx
add    %edx,%ecx
imul   $0x5e,%ecx,%ecx
sub    %ecx,%eax
add    $0x21,%al
mov    %al,0xb(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
cltq
imul   $0xffffffffae4c415d,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x6,%ecx
add    %edx,%ecx
imul   $0x5e,%ecx,%ecx
sub    %ecx,%eax
add    $0x21,%al
mov    %al,0xc(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
cltq
imul   $0xffffffffae4c415d,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x6,%ecx
add    %edx,%ecx
imul   $0x5e,%ecx,%ecx
sub    %ecx,%eax
add    $0x21,%al
mov    %al,0xd(%rsp)
xor    %eax,%eax
call   10b0 <rand@plt>
cltq
imul   $0xffffffffae4c415d,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x6,%ecx
add    %edx,%ecx
imul   $0x5e,%ecx,%ecx
sub    %ecx,%eax
add    $0x21,%al
mov    %al,0xe(%rsp)
movb   $0x0,0xf(%rsp)
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <printf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1090 <scanf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <strcmp@plt>
test   %eax,%eax
jne    1210 <main+0x80>
mov    %r14,%rdi
call   1030 <remove@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
xor    %edi,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"romve %s , you sure ?[y/n]:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [32 x i8] c"please enter the captcha |%s| :\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [5 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
store i8* %12, i8** %6
%13 = call i8* @malloc(i32 5)
store i8* %13, i8** %7
%14 = call i8* @malloc(i32 20)
store i8* %14, i8** %8
%15 = load i8*, i8** %6
%16 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load i8*, i8** %8
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %17)
%19 = load i8*, i8** %8
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 89
br i1 %23, label %24, label %32
24: ; preds = %2
%25 = load i8*, i8** %8
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %28, 121
br i1 %29, label %30, label %32
30: ; preds = %24
%31 = call i32 @exit(i32 0)
unreachable
32: ; preds = %24, %2
%33 = call i32 @time(i32* null)
%34 = call i32 @srand(i32 %33)
br label %35
35: ; preds = %32, %66
%36 = call i32 (...) @rand()
%37 = srem i32 %36, 94
%38 = add nsw i32 %37, 33
%39 = trunc i32 %38 to i8
%40 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
store i8 %39, i8* %40
%41 = call i32 (...) @rand()
%42 = srem i32 %41, 94
%43 = add nsw i32 %42, 33
%44 = trunc i32 %43 to i8
%45 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 1
store i8 %44, i8* %45
%46 = call i32 (...) @rand()
%47 = srem i32 %46, 94
%48 = add nsw i32 %47, 33
%49 = trunc i32 %48 to i8
%50 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 2
store i8 %49, i8* %50
%51 = call i32 (...) @rand()
%52 = srem i32 %51, 94
%53 = add nsw i32 %52, 33
%54 = trunc i32 %53 to i8
%55 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 3
store i8 %54, i8* %55
%56 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 4
store i8 0, i8* %56
%57 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%58 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %57)
%59 = load i8*, i8** %7
%60 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %59)
%61 = load i8*, i8** %7
%62 = getelementptr inbounds [5 x i8], [5 x i8]* %9, i64 0, i64 0
%63 = call i32 @strcmp(i8* %61, i8* %62)
%64 = icmp ne i32 %63, 0
br i1 %64, label %66, label %65
65: ; preds = %35
br label %67
66: ; preds = %35
br label %35
67: ; preds = %65
%68 = load i8*, i8** %6
%69 = call i32 @remove(i8* %68)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"romve %s , you sure ?[y/n]:\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [32 x i8] c"please enter the captcha |%s| :\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [5 x i8]
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call dereferenceable_or_null(5) i8* @malloc(i32 5)
%7 = tail call dereferenceable_or_null(20) i8* @malloc(i32 20)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %5)
%9 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%10 = load i8, i8* %7
switch i8 %10, label %11 [
i8 89, label %13
i8 121, label %13
]
11: ; preds = %2
%12 = tail call i32 @exit(i32 0)
unreachable
13: ; preds = %2, %2
%14 = tail call i32 @time(i32* null)
%15 = tail call i32 @srand(i32 %14)
%16 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 1
%18 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 2
%19 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 3
%20 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 4
br label %21
21: ; preds = %21, %13
%22 = call i32 (...) @rand()
%23 = srem i32 %22, 94
%24 = trunc i32 %23 to i8
%25 = add nsw i8 %24, 33
store i8 %25, i8* %16
%26 = call i32 (...) @rand()
%27 = srem i32 %26, 94
%28 = trunc i32 %27 to i8
%29 = add nsw i8 %28, 33
store i8 %29, i8* %17
%30 = call i32 (...) @rand()
%31 = srem i32 %30, 94
%32 = trunc i32 %31 to i8
%33 = add nsw i8 %32, 33
store i8 %33, i8* %18
%34 = call i32 (...) @rand()
%35 = srem i32 %34, 94
%36 = trunc i32 %35 to i8
%37 = add nsw i8 %36, 33
store i8 %37, i8* %19
store i8 0, i8* %20
%38 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%39 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%40 = call i32 @strcmp(i8* dereferenceable(1) %6, i8* %16)
%41 = icmp eq i32 %40, 0
br i1 %41, label %42, label %21
42: ; preds = %21
%43 = call i32 @remove(i8* %5)
ret i32 0
}