#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*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ system(char *);
void packCrack(char *pack, char *dict, int mode) {
  char cmd[256];
  if (mode == 1)
    sprintf(cmd,
            "xterm 2> /dev/null -T WpaCrack -e \"aircrack-ng %s*.cap -w %s ; "
            "read\" &",
            pack, dict);
  else if (mode == 2)
    sprintf(cmd,
            "xterm 2> /dev/null -T WepCrack-PTW -e \"aircrack-ng %s*.cap ; "
            "read\" &",
            pack);
  else if (mode == 3)
    sprintf(cmd,
            "xterm 2> /dev/null -T WepCrack-FMS_Korek -e \"aircrack-ng -K "
            "%s*.cap ; read\" &",
            pack);
  system(cmd);
}


x86 assembly (clang, -O0):
<packCrack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x1,-0x14(%rbp)
jne    1162 <packCrack+0x42>
lea    -0x120(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    11b7 <packCrack+0x97>
cmpl   $0x2,-0x14(%rbp)
jne    118a <packCrack+0x6a>
lea    -0x120(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xec9(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    11b2 <packCrack+0x92>
cmpl   $0x3,-0x14(%rbp)
jne    11ad <packCrack+0x8d>
lea    -0x120(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xee6(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
jmp    11b2 <packCrack+0x92>
jmp    11b7 <packCrack+0x97>
lea    -0x120(%rbp),%rdi
call   1030 <system@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<packCrack>:
sub    $0x108,%rsp
mov    %rdi,%rax
cmp    $0x3,%edx
je     1152 <packCrack+0x32>
cmp    $0x2,%edx
je     115b <packCrack+0x3b>
cmp    $0x1,%edx
jne    116f <packCrack+0x4f>
mov    %rsi,%rcx
lea    0xebd(%rip),%rsi
mov    %rsp,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
jmp    116f <packCrack+0x4f>
lea    0xf33(%rip),%rsi
jmp    1162 <packCrack+0x42>
lea    0xee5(%rip),%rsi
mov    %rsp,%rdi
mov    %rax,%rdx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %rsp,%rdi
call   1030 <system@plt>
add    $0x108,%rsp
ret

LLVM IR (-O0):
@.str = [71 x i8] c"xterm 2> /dev/null -T WpaCrack -e \22aircrack-ng %s*.cap -w %s ; read\22 &\00"
@.str.1 = [69 x i8] c"xterm 2> /dev/null -T WepCrack-PTW -e \22aircrack-ng %s*.cap ; read\22 &\00"
@.str.2 = [78 x i8] c"xterm 2> /dev/null -T WepCrack-FMS_Korek -e \22aircrack-ng -K %s*.cap ; read\22 &\00"
define void @packCrack(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [256 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %15
10: ; preds = %3
%11 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%12 = load i8*, i8** %4
%13 = load i8*, i8** %5
%14 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %11, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13)
br label %31
15: ; preds = %3
%16 = load i32, i32* %6
%17 = icmp eq i32 %16, 2
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%20 = load i8*, i8** %4
%21 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %19, i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %30
22: ; preds = %15
%23 = load i32, i32* %6
%24 = icmp eq i32 %23, 3
br i1 %24, label %25, label %29
25: ; preds = %22
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%27 = load i8*, i8** %4
%28 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %26, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0), i8* %27)
br label %29
29: ; preds = %25, %22
br label %30
30: ; preds = %29, %18
br label %31
31: ; preds = %30, %10
%32 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%33 = call i32 @system(i8* %32)
ret void
}

LLVM IR (-O2):
@.str = [71 x i8] c"xterm 2> /dev/null -T WpaCrack -e \22aircrack-ng %s*.cap -w %s ; read\22 &\00"
@.str.1 = [69 x i8] c"xterm 2> /dev/null -T WepCrack-PTW -e \22aircrack-ng %s*.cap ; read\22 &\00"
@.str.2 = [78 x i8] c"xterm 2> /dev/null -T WepCrack-FMS_Korek -e \22aircrack-ng -K %s*.cap ; read\22 &\00"
define void @packCrack(i8* %0, i8* %1, i32 %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
switch i32 %2, label %12 [
i32 1, label %6
i32 2, label %8
i32 3, label %10
]
6: ; preds = %3
%7 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
br label %12
8: ; preds = %3
%9 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %12
10: ; preds = %3
%11 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %12
12: ; preds = %3, %8, %10, %6
%13 = call i32 @system(i8* %5)
ret void
}