#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 */
char EOF;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
char getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int check_success(FILE *response) {
  if (response == NULL) {
    return 0;
  }
  char skipping_token[9] = "skipping:";
  char error_token[18] = "incorrect password";
  char success_token[10] = "extracting";
  char success_token2[9] = "inflating";
  int s = 0, e = 0, k = 0, i = 0, success_flag = 0;
  char c;
  while ((c = getc(response)) != EOF) {
    if (c == skipping_token[s]) {
      s++;
      if (s == 9)
        return 0;
    } else {
      s = 0;
    }
    if (c == error_token[e]) {
      e++;
      if (e == 18)
        return 0;
    } else {
      e = 0;
    }
    if (c == success_token[k]) {
      k++;
      if (k == 10)
        success_flag = 1;
    } else {
      k = 0;
    }
    if (c == success_token2[i]) {
      i++;
      if (i == 9)
        success_flag = 1;
    } else {
      i = 0;
    }
  }
  if (success_flag) {
    return 1;
  } else {
    fprintf(stderr, "Unexpected zip response.\n");
    return -1;
  }
}


x86 assembly (clang, -O0):
<check_success>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1143 <check_success+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1313 <check_success+0x1f3>
mov    0xeb6(%rip),%rax
mov    %rax,-0x19(%rbp)
mov    0xeb4(%rip),%al
mov    %al,-0x11(%rbp)
mov    0xeb2(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeaf(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeac(%rip),%ax
mov    %ax,-0x20(%rbp)
mov    0xea3(%rip),%rax
mov    %rax,-0x3a(%rbp)
mov    0xea0(%rip),%ax
mov    %ax,-0x32(%rbp)
mov    0xe97(%rip),%rax
mov    %rax,-0x43(%rbp)
mov    0xe95(%rip),%al
mov    %al,-0x3b(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <getc@plt>
mov    %al,-0x59(%rbp)
movsbl %al,%eax
mov    0x2e0d(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     12e1 <check_success+0x1c1>
movsbl -0x59(%rbp),%eax
movslq -0x48(%rbp),%rcx
movsbl -0x19(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    121f <check_success+0xff>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
cmpl   $0x9,-0x48(%rbp)
jne    121a <check_success+0xfa>
movl   $0x0,-0x4(%rbp)
jmp    1313 <check_success+0x1f3>
jmp    1226 <check_success+0x106>
movl   $0x0,-0x48(%rbp)
movsbl -0x59(%rbp),%eax
movslq -0x4c(%rbp),%rcx
movsbl -0x30(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    125f <check_success+0x13f>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
cmpl   $0x12,-0x4c(%rbp)
jne    125a <check_success+0x13a>
movl   $0x0,-0x4(%rbp)
jmp    1313 <check_success+0x1f3>
jmp    1266 <check_success+0x146>
movl   $0x0,-0x4c(%rbp)
movsbl -0x59(%rbp),%eax
movslq -0x50(%rbp),%rcx
movsbl -0x3a(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    129a <check_success+0x17a>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
cmpl   $0xa,-0x50(%rbp)
jne    1295 <check_success+0x175>
movl   $0x1,-0x58(%rbp)
jmp    12a1 <check_success+0x181>
movl   $0x0,-0x50(%rbp)
movsbl -0x59(%rbp),%eax
movslq -0x54(%rbp),%rcx
movsbl -0x43(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    12d5 <check_success+0x1b5>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x9,-0x54(%rbp)
jne    12d0 <check_success+0x1b0>
movl   $0x1,-0x58(%rbp)
jmp    12dc <check_success+0x1bc>
movl   $0x0,-0x54(%rbp)
jmp    11c5 <check_success+0xa5>
cmpl   $0x0,-0x58(%rbp)
je     12f7 <check_success+0x1d7>
movl   $0x1,-0x4(%rbp)
jmp    1313 <check_success+0x1f3>
mov    0x2cda(%rip),%rax
mov    (%rax),%edi
lea    0xd2e(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_success>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rdi,%rdi
je     122b <check_success+0x10b>
mov    %rdi,%rbp
call   1040 <getc@plt>
mov    0x2ea5(%rip),%rbx
cmp    (%rbx),%al
jne    1166 <check_success+0x46>
mov    0x2e8a(%rip),%rax
mov    (%rax),%edi
lea    0xede(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
jmp    122d <check_success+0x10d>
mov    %rbp,(%rsp)
xor    %r15d,%r15d
xor    %ecx,%ecx
xor    %r12d,%r12d
xor    %edx,%edx
xor    %esi,%esi
jmp    11e8 <check_success+0xc8>
nopl   0x0(%rax,%rax,1)
movslq %r12d,%rdx
lea    0x1(%rdx),%r12d
lea    0x1(%rcx),%r13d
cmp    $0xa,%r12d
mov    %r15d,%esi
mov    $0x1,%r8d
cmove  %r8d,%esi
lea    0xe7f(%rip),%rdi
cmp    (%rdx,%rdi,1),%al
mov    $0x0,%edx
cmovne %edx,%r12d
movslq %ecx,%rcx
cmovne %r15d,%esi
cmp    $0x9,%r13d
mov    %esi,%r15d
cmove  %r8d,%r15d
lea    0xe64(%rip),%rdi
cmp    (%rcx,%rdi,1),%al
cmovne %edx,%r13d
cmovne %esi,%r15d
mov    (%rsp),%rdi
call   1040 <getc@plt>
mov    %r13d,%ecx
mov    %ebp,%edx
mov    %r14d,%esi
cmp    (%rbx),%al
je     123c <check_success+0x11c>
movslq %esi,%rdi
mov    $0x0,%r14d
lea    0xe08(%rip),%rbp
cmp    (%rdi,%rbp,1),%al
jne    1208 <check_success+0xe8>
add    $0x1,%esi
mov    %esi,%r14d
cmp    $0x9,%esi
je     122b <check_success+0x10b>
movslq %edx,%rsi
xor    %ebp,%ebp
lea    0xdfc(%rip),%rdi
cmp    (%rsi,%rdi,1),%al
jne    1180 <check_success+0x60>
add    $0x1,%edx
mov    %edx,%ebp
cmp    $0x12,%edx
jne    1180 <check_success+0x60>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%eax
test   %r15d,%r15d
jne    122d <check_success+0x10d>
jmp    1147 <check_success+0x27>

LLVM IR (-O0):
@__const.check_success.skipping_token = [9 x i8] c"skipping:"
@__const.check_success.error_token = [18 x i8] c"incorrect password"
@__const.check_success.success_token = [10 x i8] c"extracting"
@__const.check_success.success_token2 = [9 x i8] c"inflating"
@EOF = global i8 0
@stderr = global i32 0
@.str = [26 x i8] c"Unexpected zip response.\0A\00"
define i32 @check_success(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [9 x i8]
%5 = alloca [18 x i8]
%6 = alloca [10 x i8]
%7 = alloca [9 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8
store i32* %0, i32** %3
%14 = load i32*, i32** %3
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %17
16: ; preds = %1
store i32 0, i32* %2
br label %105
17: ; preds = %1
%18 = bitcast [9 x i8]* %4 to i8*
%19 = bitcast [18 x i8]* %5 to i8*
%20 = bitcast [10 x i8]* %6 to i8*
%21 = bitcast [9 x i8]* %7 to i8*
store i32 0, i32* %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
store i32 0, i32* %12
br label %22
22: ; preds = %97, %17
%23 = load i32*, i32** %3
%24 = call signext i8 @getc(i32* %23)
store i8 %24, i8* %13
%25 = sext i8 %24 to i32
%26 = load i8, i8* @EOF
%27 = sext i8 %26 to i32
%28 = icmp ne i32 %25, %27
br i1 %28, label %29, label %98
29: ; preds = %22
%30 = load i8, i8* %13
%31 = sext i8 %30 to i32
%32 = load i32, i32* %8
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %31, %36
br i1 %37, label %38, label %45
38: ; preds = %29
%39 = load i32, i32* %8
%40 = add nsw i32 %39, 1
store i32 %40, i32* %8
%41 = load i32, i32* %8
%42 = icmp eq i32 %41, 9
br i1 %42, label %43, label %44
43: ; preds = %38
store i32 0, i32* %2
br label %105
44: ; preds = %38
br label %46
45: ; preds = %29
store i32 0, i32* %8
br label %46
46: ; preds = %45, %44
%47 = load i8, i8* %13
%48 = sext i8 %47 to i32
%49 = load i32, i32* %9
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds [18 x i8], [18 x i8]* %5, i64 0, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = icmp eq i32 %48, %53
br i1 %54, label %55, label %62
55: ; preds = %46
%56 = load i32, i32* %9
%57 = add nsw i32 %56, 1
store i32 %57, i32* %9
%58 = load i32, i32* %9
%59 = icmp eq i32 %58, 18
br i1 %59, label %60, label %61
60: ; preds = %55
store i32 0, i32* %2
br label %105
61: ; preds = %55
br label %63
62: ; preds = %46
store i32 0, i32* %9
br label %63
63: ; preds = %62, %61
%64 = load i8, i8* %13
%65 = sext i8 %64 to i32
%66 = load i32, i32* %10
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [10 x i8], [10 x i8]* %6, i64 0, i64 %67
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %65, %70
br i1 %71, label %72, label %79
72: ; preds = %63
%73 = load i32, i32* %10
%74 = add nsw i32 %73, 1
store i32 %74, i32* %10
%75 = load i32, i32* %10
%76 = icmp eq i32 %75, 10
br i1 %76, label %77, label %78
77: ; preds = %72
store i32 1, i32* %12
br label %78
78: ; preds = %77, %72
br label %80
79: ; preds = %63
store i32 0, i32* %10
br label %80
80: ; preds = %79, %78
%81 = load i8, i8* %13
%82 = sext i8 %81 to i32
%83 = load i32, i32* %11
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [9 x i8], [9 x i8]* %7, i64 0, i64 %84
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = icmp eq i32 %82, %87
br i1 %88, label %89, label %96
89: ; preds = %80
%90 = load i32, i32* %11
%91 = add nsw i32 %90, 1
store i32 %91, i32* %11
%92 = load i32, i32* %11
%93 = icmp eq i32 %92, 9
br i1 %93, label %94, label %95
94: ; preds = %89
store i32 1, i32* %12
br label %95
95: ; preds = %94, %89
br label %97
96: ; preds = %80
store i32 0, i32* %11
br label %97
97: ; preds = %96, %95
br label %22
98: ; preds = %22
%99 = load i32, i32* %12
%100 = icmp ne i32 %99, 0
br i1 %100, label %101, label %102
101: ; preds = %98
store i32 1, i32* %2
br label %105
102: ; preds = %98
%103 = load i32, i32* @stderr
%104 = call i32 @fprintf(i32 %103, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %2
br label %105
105: ; preds = %102, %101, %60, %43, %16
%106 = load i32, i32* %2
ret i32 %106
}

LLVM IR (-O2):
@__const.check_success.skipping_token = [9 x i8] c"skipping:"
@__const.check_success.error_token = [18 x i8] c"incorrect password"
@__const.check_success.success_token = [10 x i8] c"extracting"
@__const.check_success.success_token2 = [9 x i8] c"inflating"
@EOF = global i8 0
@stderr = global i32 0
@.str = [26 x i8] c"Unexpected zip response.\0A\00"
define i32 @check_success(i32* %0) {
%2 = icmp eq i32* %0, null
br i1 %2, label %58, label %3
3: ; preds = %1
%4 = tail call signext i8 @getc(i32* %0)
%5 = load i8, i8* @EOF
%6 = icmp eq i8 %4, %5
br i1 %6, label %55, label %7
7: ; preds = %3, %30
%8 = phi i8 [ %50, %30 ], [ %4, %3 ]
%9 = phi i32 [ %49, %30 ], [ 0, %3 ]
%10 = phi i32 [ %46, %30 ], [ 0, %3 ]
%11 = phi i32 [ %38, %30 ], [ 0, %3 ]
%12 = phi i32 [ %31, %30 ], [ 0, %3 ]
%13 = phi i32 [ %22, %30 ], [ 0, %3 ]
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [9 x i8], [9 x i8]* @__const.check_success.skipping_token, i64 0, i64 %14
%16 = load i8, i8* %15
%17 = icmp eq i8 %8, %16
br i1 %17, label %18, label %21
18: ; preds = %7
%19 = add nsw i32 %13, 1
%20 = icmp eq i32 %19, 9
br i1 %20, label %58, label %21
21: ; preds = %7, %18
%22 = phi i32 [ %19, %18 ], [ 0, %7 ]
%23 = sext i32 %12 to i64
%24 = getelementptr inbounds [18 x i8], [18 x i8]* @__const.check_success.error_token, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = icmp eq i8 %8, %25
br i1 %26, label %27, label %30
27: ; preds = %21
%28 = add nsw i32 %12, 1
%29 = icmp eq i32 %28, 18
br i1 %29, label %58, label %30
30: ; preds = %21, %27
%31 = phi i32 [ %28, %27 ], [ 0, %21 ]
%32 = sext i32 %11 to i64
%33 = getelementptr inbounds [10 x i8], [10 x i8]* @__const.check_success.success_token, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = icmp eq i8 %8, %34
%36 = add nsw i32 %11, 1
%37 = icmp eq i32 %36, 10
%38 = select i1 %35, i32 %36, i32 0
%39 = select i1 %35, i1 %37, i1 false
%40 = sext i32 %10 to i64
%41 = getelementptr inbounds [9 x i8], [9 x i8]* @__const.check_success.success_token2, i64 0, i64 %40
%42 = load i8, i8* %41
%43 = icmp eq i8 %8, %42
%44 = add nsw i32 %10, 1
%45 = icmp eq i32 %44, 9
%46 = select i1 %43, i32 %44, i32 0
%47 = select i1 %43, i1 %45, i1 false
%48 = select i1 %47, i1 true, i1 %39
%49 = select i1 %48, i32 1, i32 %9
%50 = tail call signext i8 @getc(i32* %0)
%51 = load i8, i8* @EOF
%52 = icmp eq i8 %50, %51
br i1 %52, label %53, label %7
53: ; preds = %30
%54 = icmp eq i32 %49, 0
br i1 %54, label %55, label %58
55: ; preds = %3, %53
%56 = load i32, i32* @stderr
%57 = tail call i32 @fprintf(i32 %56, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
br label %58
58: ; preds = %18, %27, %55, %53, %1
%59 = phi i32 [ 0, %1 ], [ -1, %55 ], [ 1, %53 ], [ 0, %27 ], [ 0, %18 ]
ret i32 %59
}