#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 input_line(char *, char *, int);
int /*<<< orphan*/ printf(char *, char *, ...);
int sscanf(char *, char *, double *);
int /*<<< orphan*/ str_isdigit(char *);
scalar_t__ str_isspace(char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int cmdshell_init_write(char src[], char dst[], char offset[], char cipher[]) {
  char input[1000];
  int retval, retin;
  int f_bad_offset, f_bad_cipher;
  *input = '\0';
  f_bad_offset = f_bad_cipher = 0;
  retin = input_line("Input source (path): ", input, sizeof input);
  if (!retin || str_isspace(input)) {
    printf("Ok unchanged \"%s\"\n", src);
  } else {
    strcpy(src, input);
    printf("Ok \"%s\"\n", input);
  }
  *input = '\0';
  retin = input_line("Input destination (path): ", input, sizeof input);
  if (!retin || str_isspace(input)) {
    printf("Ok unchanged \"%s\"\n", dst);
  } else {
    strcpy(dst, input);
    printf("Ok \"%s\"\n", input);
  }
  *input = '\0';
  retin = input_line("Input offset (number >= 0): ", input, sizeof input);
  if (!retin || str_isspace(input)) {
    printf("Ok unchanged \"%s\"\n", offset);
  } else {
    double tmp;
    if (strlen(input) > 15) {
      f_bad_offset = 1;
      printf("Fail \"%s\", should be between 1 and %d digits\n", input, 15);
    } else if (!str_isdigit(input)) {
      f_bad_offset = 1;
      printf("Fail \"%s\", should be an unsigned number\n", input);
    } else if (sscanf(input, "%lf", &tmp) == 1) {
      strcpy(offset, input);
      printf("Ok \"%s\"\n", input);
    } else {
      f_bad_offset = 1;
      printf("Fail \"%s\", should be a number\n", input);
    }
  }
  *input = '\0';
  retin = input_line("Input cipher (xor, none): ", input, sizeof input);
  if (!retin || str_isspace(input)) {
    printf("Ok unchanged \"%s\"\n", cipher);
  } else {
    if (strcmp(input, "xor") == 0) {
      strcpy(cipher, input);
      printf("Ok \"%s\"\n", input);
    } else if (strcmp(input, "none") == 0) {
      strcpy(cipher, input);
      printf("Ok \"%s\"\n", input);
    } else {
      f_bad_cipher = 1;
      printf("Fail \"%s\", unknown type\n", input);
    }
  }
  retval = !(f_bad_offset || f_bad_cipher);
  return retval;
}


x86 assembly (clang, -O0):
<cmdshell_init_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movb   $0x0,-0x410(%rbp)
movl   $0x0,-0x420(%rbp)
movl   $0x0,-0x41c(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xe3c(%rip),%rdi
mov    $0x3e8,%edx
call   1080 <input_line@plt>
mov    %eax,-0x418(%rbp)
cmpl   $0x0,-0x418(%rbp)
je     11f7 <cmdshell_init_write+0x77>
lea    -0x410(%rbp),%rdi
call   1040 <str_isspace@plt>
cmp    $0x0,%rax
je     120e <cmdshell_init_write+0x8e>
mov    -0x8(%rbp),%rsi
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1233 <cmdshell_init_write+0xb3>
mov    -0x8(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x410(%rbp),%rsi
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movb   $0x0,-0x410(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xdea(%rip),%rdi
mov    $0x3e8,%edx
call   1080 <input_line@plt>
mov    %eax,-0x418(%rbp)
cmpl   $0x0,-0x418(%rbp)
je     127b <cmdshell_init_write+0xfb>
lea    -0x410(%rbp),%rdi
call   1040 <str_isspace@plt>
cmp    $0x0,%rax
je     1292 <cmdshell_init_write+0x112>
mov    -0x10(%rbp),%rsi
lea    0xd90(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    12b7 <cmdshell_init_write+0x137>
mov    -0x10(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x410(%rbp),%rsi
lea    0xd79(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movb   $0x0,-0x410(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xd81(%rip),%rdi
mov    $0x3e8,%edx
call   1080 <input_line@plt>
mov    %eax,-0x418(%rbp)
cmpl   $0x0,-0x418(%rbp)
je     12ff <cmdshell_init_write+0x17f>
lea    -0x410(%rbp),%rdi
call   1040 <str_isspace@plt>
cmp    $0x0,%rax
je     1316 <cmdshell_init_write+0x196>
mov    -0x18(%rbp),%rsi
lea    0xd0c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1408 <cmdshell_init_write+0x288>
lea    -0x410(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0xf,%eax
jle    1354 <cmdshell_init_write+0x1d4>
movl   $0x1,-0x41c(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xd27(%rip),%rdi
mov    $0xf,%edx
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1403 <cmdshell_init_write+0x283>
lea    -0x410(%rbp),%rdi
call   1090 <str_isdigit@plt>
cmp    $0x0,%eax
jne    138d <cmdshell_init_write+0x20d>
movl   $0x1,-0x41c(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xd17(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    13fe <cmdshell_init_write+0x27e>
lea    -0x410(%rbp),%rdi
lea    0xd26(%rip),%rsi
lea    -0x428(%rbp),%rdx
call   10a0 <sscanf@plt>
cmp    $0x1,%eax
jne    13da <cmdshell_init_write+0x25a>
mov    -0x18(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x410(%rbp),%rsi
lea    0xc5b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    13f9 <cmdshell_init_write+0x279>
movl   $0x1,-0x41c(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xcd3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    13fe <cmdshell_init_write+0x27e>
jmp    1403 <cmdshell_init_write+0x283>
jmp    1408 <cmdshell_init_write+0x288>
movb   $0x0,-0x410(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xcc7(%rip),%rdi
mov    $0x3e8,%edx
call   1080 <input_line@plt>
mov    %eax,-0x418(%rbp)
cmpl   $0x0,-0x418(%rbp)
je     1450 <cmdshell_init_write+0x2d0>
lea    -0x410(%rbp),%rdi
call   1040 <str_isspace@plt>
cmp    $0x0,%rax
je     1467 <cmdshell_init_write+0x2e7>
mov    -0x20(%rbp),%rsi
lea    0xbbb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    151e <cmdshell_init_write+0x39e>
lea    -0x410(%rbp),%rdi
lea    0xc8a(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    14ae <cmdshell_init_write+0x32e>
mov    -0x20(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x410(%rbp),%rsi
lea    0xb87(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1519 <cmdshell_init_write+0x399>
lea    -0x410(%rbp),%rdi
lea    0xc47(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
jne    14f5 <cmdshell_init_write+0x375>
mov    -0x20(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x410(%rbp),%rsi
lea    0xb40(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1514 <cmdshell_init_write+0x394>
movl   $0x1,-0x420(%rbp)
lea    -0x410(%rbp),%rsi
lea    0xbfb(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1519 <cmdshell_init_write+0x399>
jmp    151e <cmdshell_init_write+0x39e>
mov    $0x1,%al
cmpl   $0x0,-0x41c(%rbp)
mov    %al,-0x429(%rbp)
jne    1543 <cmdshell_init_write+0x3c3>
cmpl   $0x0,-0x420(%rbp)
setne  %al
mov    %al,-0x429(%rbp)
mov    -0x429(%rbp),%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x414(%rbp)
mov    -0x414(%rbp),%eax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdshell_init_write>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x3f8,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
movb   $0x0,0x10(%rsp)
lea    0xe57(%rip),%rdi
lea    0x10(%rsp),%rsi
mov    $0x3e8,%edx
call   1080 <input_line@plt>
test   %eax,%eax
je     11cb <cmdshell_init_write+0x4b>
lea    0x10(%rsp),%rdi
call   1040 <str_isspace@plt>
test   %rax,%rax
je     11d7 <cmdshell_init_write+0x57>
lea    0xe44(%rip),%rdi
mov    %rbx,%rsi
jmp    11f1 <cmdshell_init_write+0x71>
lea    0x10(%rsp),%r13
mov    %rbx,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
lea    0xe3b(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
movb   $0x0,0x10(%rsp)
lea    0xe2e(%rip),%rdi
lea    0x10(%rsp),%rsi
mov    $0x3e8,%edx
call   1080 <input_line@plt>
test   %eax,%eax
je     1226 <cmdshell_init_write+0xa6>
lea    0x10(%rsp),%rdi
call   1040 <str_isspace@plt>
test   %rax,%rax
je     1232 <cmdshell_init_write+0xb2>
lea    0xde9(%rip),%rdi
mov    %r12,%rsi
jmp    124c <cmdshell_init_write+0xcc>
lea    0x10(%rsp),%rbx
mov    %r12,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xde0(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
movb   $0x0,0x10(%rsp)
lea    0xdee(%rip),%rdi
lea    0x10(%rsp),%rsi
mov    $0x3e8,%edx
call   1080 <input_line@plt>
test   %eax,%eax
je     1281 <cmdshell_init_write+0x101>
lea    0x10(%rsp),%rdi
call   1040 <str_isspace@plt>
test   %rax,%rax
je     12f4 <cmdshell_init_write+0x174>
lea    0xd8e(%rip),%rdi
xor    %ebp,%ebp
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
movb   $0x0,0x10(%rsp)
lea    0xe44(%rip),%rdi
lea    0x10(%rsp),%rsi
mov    $0x3e8,%edx
call   1080 <input_line@plt>
test   %eax,%eax
je     12c2 <cmdshell_init_write+0x142>
lea    0x10(%rsp),%rdi
call   1040 <str_isspace@plt>
test   %rax,%rax
je     1324 <cmdshell_init_write+0x1a4>
lea    0xd4d(%rip),%rdi
xor    %ebx,%ebx
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
test   %ebp,%ebp
sete   %al
xor    $0x1,%bl
and    %al,%bl
movzbl %bl,%eax
add    $0x3f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x10(%rsp),%rdi
call   1050 <strlen@plt>
cmp    $0x10,%eax
jl     138b <cmdshell_init_write+0x20b>
lea    0xd5c(%rip),%rdi
lea    0x10(%rsp),%rsi
mov    $0xf,%edx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    13f1 <cmdshell_init_write+0x271>
lea    0xdd4(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     136a <cmdshell_init_write+0x1ea>
lea    0xdc2(%rip),%rsi
lea    0x10(%rsp),%rdi
call   1070 <strcmp@plt>
test   %rax,%rax
je     136a <cmdshell_init_write+0x1ea>
lea    0xdb1(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%bl
jmp    12d5 <cmdshell_init_write+0x155>
lea    0x10(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
lea    0xca8(%rip),%rdi
xor    %ebx,%ebx
mov    %r15,%rsi
jmp    12ce <cmdshell_init_write+0x14e>
lea    0x10(%rsp),%rdi
call   1090 <str_isdigit@plt>
test   %eax,%eax
je     13d5 <cmdshell_init_write+0x255>
lea    0xd21(%rip),%rsi
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rdx
call   10a0 <sscanf@plt>
cmp    $0x1,%eax
jne    13de <cmdshell_init_write+0x25e>
lea    0x10(%rsp),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0xc5e(%rip),%rdi
xor    %ebp,%ebp
mov    %rbx,%rsi
jmp    128d <cmdshell_init_write+0x10d>
lea    0xcbc(%rip),%rdi
jmp    13e5 <cmdshell_init_write+0x265>
lea    0xce0(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x1,%ebp
jmp    1294 <cmdshell_init_write+0x114>

LLVM IR (-O0):
@.str = [22 x i8] c"Input source (path): \00"
@.str.1 = [19 x i8] c"Ok unchanged \22%s\22\0A\00"
@.str.2 = [9 x i8] c"Ok \22%s\22\0A\00"
@.str.3 = [27 x i8] c"Input destination (path): \00"
@.str.4 = [29 x i8] c"Input offset (number >= 0): \00"
@.str.5 = [46 x i8] c"Fail \22%s\22, should be between 1 and %d digits\0A\00"
@.str.6 = [41 x i8] c"Fail \22%s\22, should be an unsigned number\0A\00"
@.str.7 = [4 x i8] c"%lf\00"
@.str.8 = [31 x i8] c"Fail \22%s\22, should be a number\0A\00"
@.str.9 = [27 x i8] c"Input cipher (xor, none): \00"
@.str.10 = [4 x i8] c"xor\00"
@.str.11 = [5 x i8] c"none\00"
@.str.12 = [25 x i8] c"Fail \22%s\22, unknown type\0A\00"
define i32 @cmdshell_init_write(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [1000 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%15 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
store i8 0, i8* %15
store i32 0, i32* %13
store i32 0, i32* %12
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%17 = call i32 @input_line(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %16, i32 1000)
store i32 %17, i32* %11
%18 = load i32, i32* %11
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %4
%21 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%22 = call i64 @str_isspace(i8* %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %20, %4
%25 = load i8*, i8** %5
%26 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %25)
br label %33
27: ; preds = %20
%28 = load i8*, i8** %5
%29 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%30 = call i32 @strcpy(i8* %28, i8* %29)
%31 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%32 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %31)
br label %33
33: ; preds = %27, %24
%34 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
store i8 0, i8* %34
%35 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%36 = call i32 @input_line(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %35, i32 1000)
store i32 %36, i32* %11
%37 = load i32, i32* %11
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %33
%40 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%41 = call i64 @str_isspace(i8* %40)
%42 = icmp ne i64 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %39, %33
%44 = load i8*, i8** %6
%45 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %44)
br label %52
46: ; preds = %39
%47 = load i8*, i8** %6
%48 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%49 = call i32 @strcpy(i8* %47, i8* %48)
%50 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%51 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %50)
br label %52
52: ; preds = %46, %43
%53 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
store i8 0, i8* %53
%54 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%55 = call i32 @input_line(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %54, i32 1000)
store i32 %55, i32* %11
%56 = load i32, i32* %11
%57 = icmp ne i32 %56, 0
br i1 %57, label %58, label %62
58: ; preds = %52
%59 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%60 = call i64 @str_isspace(i8* %59)
%61 = icmp ne i64 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %58, %52
%63 = load i8*, i8** %7
%64 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %63)
br label %95
65: ; preds = %58
%66 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%67 = call i32 @strlen(i8* %66)
%68 = icmp sgt i32 %67, 15
br i1 %68, label %69, label %72
69: ; preds = %65
store i32 1, i32* %12
%70 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%71 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i8* %70, i32 15)
br label %94
72: ; preds = %65
%73 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%74 = call i32 @str_isdigit(i8* %73)
%75 = icmp ne i32 %74, 0
br i1 %75, label %79, label %76
76: ; preds = %72
store i32 1, i32* %12
%77 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%78 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), i8* %77)
br label %93
79: ; preds = %72
%80 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%81 = call i32 @sscanf(i8* %80, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), double* %14)
%82 = icmp eq i32 %81, 1
br i1 %82, label %83, label %89
83: ; preds = %79
%84 = load i8*, i8** %7
%85 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%86 = call i32 @strcpy(i8* %84, i8* %85)
%87 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%88 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %87)
br label %92
89: ; preds = %79
store i32 1, i32* %12
%90 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%91 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %90)
br label %92
92: ; preds = %89, %83
br label %93
93: ; preds = %92, %76
br label %94
94: ; preds = %93, %69
br label %95
95: ; preds = %94, %62
%96 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
store i8 0, i8* %96
%97 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%98 = call i32 @input_line(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i8* %97, i32 1000)
store i32 %98, i32* %11
%99 = load i32, i32* %11
%100 = icmp ne i32 %99, 0
br i1 %100, label %101, label %105
101: ; preds = %95
%102 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%103 = call i64 @str_isspace(i8* %102)
%104 = icmp ne i64 %103, 0
br i1 %104, label %105, label %108
105: ; preds = %101, %95
%106 = load i8*, i8** %8
%107 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %106)
br label %133
108: ; preds = %101
%109 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%110 = call i64 @strcmp(i8* %109, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%111 = icmp eq i64 %110, 0
br i1 %111, label %112, label %118
112: ; preds = %108
%113 = load i8*, i8** %8
%114 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%115 = call i32 @strcpy(i8* %113, i8* %114)
%116 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%117 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %116)
br label %132
118: ; preds = %108
%119 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%120 = call i64 @strcmp(i8* %119, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%121 = icmp eq i64 %120, 0
br i1 %121, label %122, label %128
122: ; preds = %118
%123 = load i8*, i8** %8
%124 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%125 = call i32 @strcpy(i8* %123, i8* %124)
%126 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%127 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %126)
br label %131
128: ; preds = %118
store i32 1, i32* %13
%129 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%130 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.12, i64 0, i64 0), i8* %129)
br label %131
131: ; preds = %128, %122
br label %132
132: ; preds = %131, %112
br label %133
133: ; preds = %132, %105
%134 = load i32, i32* %12
%135 = icmp ne i32 %134, 0
br i1 %135, label %139, label %136
136: ; preds = %133
%137 = load i32, i32* %13
%138 = icmp ne i32 %137, 0
br label %139
139: ; preds = %136, %133
%140 = phi i1 [ true, %133 ], [ %138, %136 ]
%141 = xor i1 %140, true
%142 = zext i1 %141 to i32
store i32 %142, i32* %10
%143 = load i32, i32* %10
ret i32 %143
}

LLVM IR (-O2):
@.str = [22 x i8] c"Input source (path): \00"
@.str.1 = [19 x i8] c"Ok unchanged \22%s\22\0A\00"
@.str.2 = [9 x i8] c"Ok \22%s\22\0A\00"
@.str.3 = [27 x i8] c"Input destination (path): \00"
@.str.4 = [29 x i8] c"Input offset (number >= 0): \00"
@.str.5 = [46 x i8] c"Fail \22%s\22, should be between 1 and %d digits\0A\00"
@.str.6 = [41 x i8] c"Fail \22%s\22, should be an unsigned number\0A\00"
@.str.7 = [4 x i8] c"%lf\00"
@.str.8 = [31 x i8] c"Fail \22%s\22, should be a number\0A\00"
@.str.9 = [27 x i8] c"Input cipher (xor, none): \00"
@.str.10 = [4 x i8] c"xor\00"
@.str.11 = [5 x i8] c"none\00"
@.str.12 = [25 x i8] c"Fail \22%s\22, unknown type\0A\00"
define i32 @cmdshell_init_write(i8* %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca [1000 x i8]
%6 = alloca double
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
store i8 0, i8* %7
%8 = call i32 @input_line(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %7, i32 1000)
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %4
%11 = call i64 @str_isspace(i8* %7)
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10, %4
%14 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %18
15: ; preds = %10
%16 = call i32 @strcpy(i8* %0, i8* %7)
%17 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %7)
br label %18
18: ; preds = %15, %13
store i8 0, i8* %7
%19 = call i32 @input_line(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %7, i32 1000)
%20 = icmp eq i32 %19, 0
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = call i64 @str_isspace(i8* %7)
%23 = icmp eq i64 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %21, %18
%25 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %29
26: ; preds = %21
%27 = call i32 @strcpy(i8* %1, i8* %7)
%28 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %7)
br label %29
29: ; preds = %26, %24
store i8 0, i8* %7
%30 = call i32 @input_line(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %7, i32 1000)
%31 = icmp eq i32 %30, 0
br i1 %31, label %35, label %32
32: ; preds = %29
%33 = call i64 @str_isspace(i8* %7)
%34 = icmp eq i64 %33, 0
br i1 %34, label %37, label %35
35: ; preds = %32, %29
%36 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %58
37: ; preds = %32
%38 = bitcast double* %6 to i8*
%39 = call i32 @strlen(i8* %7)
%40 = icmp sgt i32 %39, 15
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.5, i64 0, i64 0), i8* %7, i32 15)
br label %56
43: ; preds = %37
%44 = call i32 @str_isdigit(i8* %7)
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.6, i64 0, i64 0), i8* %7)
br label %56
48: ; preds = %43
%49 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), double* %6)
%50 = icmp eq i32 %49, 1
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = call i32 @strcpy(i8* %2, i8* %7)
%53 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %7)
br label %56
54: ; preds = %48
%55 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), i8* %7)
br label %56
56: ; preds = %46, %54, %51, %41
%57 = phi i32 [ 1, %41 ], [ 0, %51 ], [ 1, %54 ], [ 1, %46 ]
br label %58
58: ; preds = %56, %35
%59 = phi i32 [ 0, %35 ], [ %57, %56 ]
store i8 0, i8* %7
%60 = call i32 @input_line(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i8* %7, i32 1000)
%61 = icmp eq i32 %60, 0
br i1 %61, label %65, label %62
62: ; preds = %58
%63 = call i64 @str_isspace(i8* %7)
%64 = icmp eq i64 %63, 0
br i1 %64, label %67, label %65
65: ; preds = %62, %58
%66 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %3)
br label %81
67: ; preds = %62
%68 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0))
%69 = icmp eq i64 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %67
%71 = call i32 @strcpy(i8* %3, i8* %7)
%72 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %7)
br label %81
73: ; preds = %67
%74 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0))
%75 = icmp eq i64 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %73
%77 = call i32 @strcpy(i8* %3, i8* %7)
%78 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %7)
br label %81
79: ; preds = %73
%80 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.12, i64 0, i64 0), i8* %7)
br label %81
81: ; preds = %70, %79, %76, %65
%82 = phi i1 [ false, %70 ], [ true, %79 ], [ false, %76 ], [ false, %65 ]
%83 = icmp ne i32 %59, 0
%84 = or i1 %83, %82
%85 = xor i1 %84, true
%86 = zext i1 %85 to i32
ret i32 %86
}