#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, double);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ printf(char *, int);
double rtclock();
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int, char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ *strcasestr(char *, char *);
int main() {
  FILE *fp;
  char finalcmd[300] = "unzip -P%d -t %s 2>&1";
  int nt;
  char filename[100];
  char ret[200];
  char cmd[400];
  double t_start, t_end;
  int i;
  scanf("%d", &nt);
  scanf("%s", filename);
  t_start = rtclock();
  for (i = 0; i < 500000; i++) {
    sprintf((char *)&cmd, finalcmd, i, filename);
    fp = popen(cmd, "r");
    while (!feof(fp)) {
      fgets((char *)&ret, 200, fp);
      if (strcasestr(ret, "ok") != NULL) {
        printf("Senha:%d\n", i);
        i = 500000;
      }
    }
    pclose(fp);
  }
  t_end = rtclock();
  fprintf(stdout, "%0.6lf\n", t_end - t_start);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x140(%rbp),%rdi
lea    0xe30(%rip),%rsi
mov    $0x12c,%edx
call   1090 <memcpy@plt>
lea    0xf4b(%rip),%rdi
lea    -0x144(%rbp),%rsi
mov    $0x0,%al
call   10a0 <scanf@plt>
lea    -0x1b0(%rbp),%rsi
lea    0xf32(%rip),%rdi
mov    $0x0,%al
call   10a0 <scanf@plt>
mov    $0x0,%al
call   1030 <rtclock@plt>
movsd  %xmm0,-0x418(%rbp)
ff
movl   $0x0,-0x424(%rbp)
cmpl   $0x7a120,-0x424(%rbp)
jge    12f2 <main+0x142>
lea    -0x410(%rbp),%rdi
lea    -0x140(%rbp),%rsi
mov    -0x424(%rbp),%edx
lea    -0x1b0(%rbp),%rcx
call   10d0 <sprintf@plt>
lea    -0x410(%rbp),%rdi
lea    0xed7(%rip),%rsi
call   10b0 <popen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1282 <main+0xd2>
jmp    12d5 <main+0x125>
lea    -0x280(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0xc8,%esi
call   1060 <fgets@plt>
lea    -0x280(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   10c0 <strcasestr@plt>
cmp    $0x0,%rax
je     12d0 <main+0x120>
mov    -0x424(%rbp),%esi
lea    0xe76(%rip),%rdi
call   1040 <printf@plt>
movl   $0x7a120,-0x424(%rbp)
jmp    1264 <main+0xb4>
mov    -0x10(%rbp),%rdi
call   1050 <pclose@plt>
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    121d <main+0x6d>
mov    $0x0,%al
call   1030 <rtclock@plt>
movsd  %xmm0,-0x420(%rbp)
mov    0x2cd8(%rip),%rax
mov    (%rax),%edi
movsd  -0x420(%rbp),%xmm0
ff
subsd  -0x418(%rbp),%xmm0
ff
lea    0xe20(%rip),%rsi
call   1070 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
lea    0xe38(%rip),%rsi
lea    0x80(%rsp),%rdi
mov    $0x12c,%edx
call   1090 <memcpy@plt>
lea    0xf4b(%rip),%rdi
xor    %ebx,%ebx
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
lea    0xf39(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   10a0 <scanf@plt>
xor    %eax,%eax
call   1030 <rtclock@plt>
movsd  %xmm0,(%rsp)
lea    0x280(%rsp),%r12
lea    0x1b0(%rsp),%rbp
lea    0xf0f(%rip),%r14
lea    0xf0b(%rip),%r15
jmp    1245 <main+0x95>
xchg   %ax,%ax
mov    %r13,%rdi
call   1050 <pclose@plt>
lea    0x1(%rbx),%eax
cmp    $0x7a11f,%ebx
mov    %eax,%ebx
jge    12bd <main+0x10d>
mov    %r12,%rdi
lea    0x80(%rsp),%rsi
mov    %ebx,%edx
lea    0x10(%rsp),%rcx
call   10d0 <sprintf@plt>
mov    %r12,%rdi
lea    0xecc(%rip),%rsi
call   10b0 <popen@plt>
mov    %rax,%r13
mov    %rax,%rdi
jmp    1283 <main+0xd3>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    1230 <main+0x80>
mov    %rbp,%rdi
mov    $0xc8,%esi
mov    %r13,%rdx
call   1060 <fgets@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   10c0 <strcasestr@plt>
test   %rax,%rax
je     1280 <main+0xd0>
mov    %r15,%rdi
mov    %ebx,%esi
call   1040 <printf@plt>
mov    $0x7a120,%ebx
jmp    1280 <main+0xd0>
xor    %eax,%eax
call   1030 <rtclock@plt>
mov    0x2d15(%rip),%rax
mov    (%rax),%edi
subsd  (%rsp),%xmm0
lea    0xe68(%rip),%rsi
call   1070 <fprintf@plt>
xor    %eax,%eax
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.finalcmd = [300 x i8] c"unzip -P%d -t %s 2>&1\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [3 x i8] c"ok\00"
@.str.4 = [10 x i8] c"Senha:%d\0A\00"
@stdout = global i32 0
@.str.5 = [8 x i8] c"%0.6lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [300 x i8]
%4 = alloca i32
%5 = alloca [100 x i8]
%6 = alloca [200 x i8]
%7 = alloca [400 x i8]
%8 = alloca double
%9 = alloca double
%10 = alloca i32
store i32 0, i32* %1
%11 = bitcast [300 x i8]* %3 to i8*
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%13 = getelementptr inbounds [100 x i8], [100 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 = call double (...) @rtclock()
store double %15, double* %8
store i32 0, i32* %10
br label %16
16: ; preds = %46, %0
%17 = load i32, i32* %10
%18 = icmp slt i32 %17, 500000
br i1 %18, label %19, label %49
19: ; preds = %16
%20 = bitcast [400 x i8]* %7 to i8*
%21 = getelementptr inbounds [300 x i8], [300 x i8]* %3, i64 0, i64 0
%22 = load i32, i32* %10
%23 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%24 = call i32 @sprintf(i8* %20, i8* %21, i32 %22, i8* %23)
%25 = getelementptr inbounds [400 x i8], [400 x i8]* %7, i64 0, i64 0
%26 = call i32* @popen(i8* %25, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %26, i32** %2
br label %27
27: ; preds = %42, %19
%28 = load i32*, i32** %2
%29 = call i32 @feof(i32* %28)
%30 = icmp ne i32 %29, 0
%31 = xor i1 %30, true
br i1 %31, label %32, label %43
32: ; preds = %27
%33 = bitcast [200 x i8]* %6 to i8*
%34 = load i32*, i32** %2
%35 = call i32 @fgets(i8* %33, i32 200, i32* %34)
%36 = getelementptr inbounds [200 x i8], [200 x i8]* %6, i64 0, i64 0
%37 = call i32* @strcasestr(i8* %36, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%38 = icmp ne i32* %37, null
br i1 %38, label %39, label %42
39: ; preds = %32
%40 = load i32, i32* %10
%41 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %40)
store i32 500000, i32* %10
br label %42
42: ; preds = %39, %32
br label %27
43: ; preds = %27
%44 = load i32*, i32** %2
%45 = call i32 @pclose(i32* %44)
br label %46
46: ; preds = %43
%47 = load i32, i32* %10
%48 = add nsw i32 %47, 1
store i32 %48, i32* %10
br label %16
49: ; preds = %16
%50 = call double (...) @rtclock()
store double %50, double* %9
%51 = load i32, i32* @stdout
%52 = load double, double* %9
%53 = load double, double* %8
%54 = fsub double %52, %53
%55 = call i32 @fprintf(i32 %51, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), double %54)
%56 = load i32, i32* %1
ret i32 %56
}

LLVM IR (-O2):
@__const.main.finalcmd = [300 x i8] c"unzip -P%d -t %s 2>&1\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [3 x i8] c"ok\00"
@.str.4 = [10 x i8] c"Senha:%d\0A\00"
@stdout = global i32 0
@.str.5 = [8 x i8] c"%0.6lf\0A\00"
define i32 @main() {
%1 = alloca [300 x i8]
%2 = alloca i32
%3 = alloca [100 x i8]
%4 = alloca [200 x i8]
%5 = alloca [400 x i8]
%6 = getelementptr inbounds [300 x i8], [300 x i8]* %1, i64 0, i64 0
%7 = bitcast i32* %2 to i8*
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [200 x i8], [200 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [400 x i8], [400 x i8]* %5, i64 0, i64 0
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%13 = call double (...) @rtclock()
br label %14
14: ; preds = %0, %31
%15 = phi i32 [ 0, %0 ], [ %34, %31 ]
%16 = call i32 @sprintf(i8* %10, i8* %6, i32 %15, i8* %8)
%17 = call i32* @popen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @feof(i32* %17)
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %31
20: ; preds = %14, %27
%21 = phi i32 [ %28, %27 ], [ %15, %14 ]
%22 = call i32 @fgets(i8* %9, i32 200, i32* %17)
%23 = call i32* @strcasestr(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i32* %23, null
br i1 %24, label %27, label %25
25: ; preds = %20
%26 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %21)
br label %27
27: ; preds = %25, %20
%28 = phi i32 [ 500000, %25 ], [ %21, %20 ]
%29 = call i32 @feof(i32* %17)
%30 = icmp eq i32 %29, 0
br i1 %30, label %20, label %31
31: ; preds = %27, %14
%32 = phi i32 [ %15, %14 ], [ %28, %27 ]
%33 = call i32 @pclose(i32* %17)
%34 = add nsw i32 %32, 1
%35 = icmp slt i32 %32, 499999
br i1 %35, label %14, label %36
36: ; preds = %31
%37 = call double (...) @rtclock()
%38 = load i32, i32* @stdout
%39 = fsub double %37, %13
%40 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), double %39)
ret i32 0
}