#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 strlen(unsigned char *);
int /*<<< orphan*/ vMemcpy0(unsigned char *, unsigned char *, int);
int iGetTrack2ServiceCode(unsigned char *pszTrack2,
                          unsigned char *pszServiceCode) {
  int i;
  for (i = 0; i < 19; i++) {
    if (pszTrack2[i] == '=')
      break;
    if (pszTrack2[i] == 0)
      break;
  }
  if (i == 19 || pszTrack2[i] == 0)
    return (1);
  if (strlen(pszTrack2 + i) < 8)
    return (1);
  vMemcpy0(pszServiceCode, pszTrack2 + i + 1 + 4, 3);
  return (0);
}


x86 assembly (clang, -O0):
<iGetTrack2ServiceCode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x13,-0x1c(%rbp)
jge    1188 <iGetTrack2ServiceCode+0x68>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x3d,%eax
jne    115b <iGetTrack2ServiceCode+0x3b>
jmp    1188 <iGetTrack2ServiceCode+0x68>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    1175 <iGetTrack2ServiceCode+0x55>
jmp    1188 <iGetTrack2ServiceCode+0x68>
jmp    117a <iGetTrack2ServiceCode+0x5a>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1137 <iGetTrack2ServiceCode+0x17>
cmpl   $0x13,-0x1c(%rbp)
je     11a7 <iGetTrack2ServiceCode+0x87>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movzbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    11b3 <iGetTrack2ServiceCode+0x93>
movl   $0x1,-0x4(%rbp)
jmp    1200 <iGetTrack2ServiceCode+0xe0>
mov    -0x10(%rbp),%rdi
movslq -0x1c(%rbp),%rax
add    %rax,%rdi
call   1030 <strlen@plt>
cmp    $0x8,%eax
jge    11d8 <iGetTrack2ServiceCode+0xb8>
movl   $0x1,-0x4(%rbp)
jmp    1200 <iGetTrack2ServiceCode+0xe0>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x1c(%rbp),%rax
add    %rax,%rsi
add    $0x1,%rsi
add    $0x4,%rsi
mov    $0x3,%edx
call   1040 <vMemcpy0@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iGetTrack2ServiceCode>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%cl
xor    %eax,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0x1(%rbx),%cl
mov    $0x1,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0x2(%rbx),%cl
mov    $0x2,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0x3(%rbx),%cl
mov    $0x3,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0x4(%rbx),%cl
mov    $0x4,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0x5(%rbx),%cl
mov    $0x5,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0x6(%rbx),%cl
mov    $0x6,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0x7(%rbx),%cl
mov    $0x7,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0x8(%rbx),%cl
mov    $0x8,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0x9(%rbx),%cl
mov    $0x9,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0xa(%rbx),%cl
mov    $0xa,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0xb(%rbx),%cl
mov    $0xb,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0xc(%rbx),%cl
mov    $0xc,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0xd(%rbx),%cl
mov    $0xd,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0xe(%rbx),%cl
mov    $0xe,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0xf(%rbx),%cl
mov    $0xf,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0x10(%rbx),%cl
mov    $0x10,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0x11(%rbx),%cl
mov    $0x11,%eax
test   %cl,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    0x12(%rbx),%cl
mov    $0x12,%eax
cmp    $0x3d,%cl
je     12ca <iGetTrack2ServiceCode+0x1aa>
mov    $0x1,%ebp
test   %cl,%cl
jne    12fb <iGetTrack2ServiceCode+0x1db>
mov    $0x1,%ebp
cmpb   $0x0,(%rbx,%rax,1)
je     12fb <iGetTrack2ServiceCode+0x1db>
add    %rax,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x8,%eax
jl     12fb <iGetTrack2ServiceCode+0x1db>
add    $0x5,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1040 <vMemcpy0@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @iGetTrack2ServiceCode(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %6
br label %7
7: ; preds = %29, %2
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 19
br i1 %9, label %10, label %32
10: ; preds = %7
%11 = load i8*, i8** %4
%12 = load i32, i32* %6
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = icmp eq i32 %16, 61
br i1 %17, label %18, label %19
18: ; preds = %10
br label %32
19: ; preds = %10
%20 = load i8*, i8** %4
%21 = load i32, i32* %6
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = load i8, i8* %23
%25 = zext i8 %24 to i32
%26 = icmp eq i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %19
br label %32
28: ; preds = %19
br label %29
29: ; preds = %28
%30 = load i32, i32* %6
%31 = add nsw i32 %30, 1
store i32 %31, i32* %6
br label %7
32: ; preds = %27, %18, %7
%33 = load i32, i32* %6
%34 = icmp eq i32 %33, 19
br i1 %34, label %43, label %35
35: ; preds = %32
%36 = load i8*, i8** %4
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = load i8, i8* %39
%41 = zext i8 %40 to i32
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %35, %32
store i32 1, i32* %3
br label %61
44: ; preds = %35
%45 = load i8*, i8** %4
%46 = load i32, i32* %6
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %45, i64 %47
%49 = call i32 @strlen(i8* %48)
%50 = icmp slt i32 %49, 8
br i1 %50, label %51, label %52
51: ; preds = %44
store i32 1, i32* %3
br label %61
52: ; preds = %44
%53 = load i8*, i8** %5
%54 = load i8*, i8** %4
%55 = load i32, i32* %6
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i8, i8* %54, i64 %56
%58 = getelementptr inbounds i8, i8* %57, i64 1
%59 = getelementptr inbounds i8, i8* %58, i64 4
%60 = call i32 @vMemcpy0(i8* %53, i8* %59, i32 3)
store i32 0, i32* %3
br label %61
61: ; preds = %52, %51, %43
%62 = load i32, i32* %3
ret i32 %62
}

LLVM IR (-O2):
define i32 @iGetTrack2ServiceCode(i8* %0, i8* %1) {
%3 = load i8, i8* %0
switch i8 %3, label %4 [
i8 61, label %58
i8 0, label %58
]
4: ; preds = %2
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
switch i8 %6, label %7 [
i8 61, label %58
i8 0, label %58
]
7: ; preds = %4
%8 = getelementptr inbounds i8, i8* %0, i64 2
%9 = load i8, i8* %8
switch i8 %9, label %10 [
i8 61, label %58
i8 0, label %58
]
10: ; preds = %7
%11 = getelementptr inbounds i8, i8* %0, i64 3
%12 = load i8, i8* %11
switch i8 %12, label %13 [
i8 61, label %58
i8 0, label %58
]
13: ; preds = %10
%14 = getelementptr inbounds i8, i8* %0, i64 4
%15 = load i8, i8* %14
switch i8 %15, label %16 [
i8 61, label %58
i8 0, label %58
]
16: ; preds = %13
%17 = getelementptr inbounds i8, i8* %0, i64 5
%18 = load i8, i8* %17
switch i8 %18, label %19 [
i8 61, label %58
i8 0, label %58
]
19: ; preds = %16
%20 = getelementptr inbounds i8, i8* %0, i64 6
%21 = load i8, i8* %20
switch i8 %21, label %22 [
i8 61, label %58
i8 0, label %58
]
22: ; preds = %19
%23 = getelementptr inbounds i8, i8* %0, i64 7
%24 = load i8, i8* %23
switch i8 %24, label %25 [
i8 61, label %58
i8 0, label %58
]
25: ; preds = %22
%26 = getelementptr inbounds i8, i8* %0, i64 8
%27 = load i8, i8* %26
switch i8 %27, label %28 [
i8 61, label %58
i8 0, label %58
]
28: ; preds = %25
%29 = getelementptr inbounds i8, i8* %0, i64 9
%30 = load i8, i8* %29
switch i8 %30, label %31 [
i8 61, label %58
i8 0, label %58
]
31: ; preds = %28
%32 = getelementptr inbounds i8, i8* %0, i64 10
%33 = load i8, i8* %32
switch i8 %33, label %34 [
i8 61, label %58
i8 0, label %58
]
34: ; preds = %31
%35 = getelementptr inbounds i8, i8* %0, i64 11
%36 = load i8, i8* %35
switch i8 %36, label %37 [
i8 61, label %58
i8 0, label %58
]
37: ; preds = %34
%38 = getelementptr inbounds i8, i8* %0, i64 12
%39 = load i8, i8* %38
switch i8 %39, label %40 [
i8 61, label %58
i8 0, label %58
]
40: ; preds = %37
%41 = getelementptr inbounds i8, i8* %0, i64 13
%42 = load i8, i8* %41
switch i8 %42, label %43 [
i8 61, label %58
i8 0, label %58
]
43: ; preds = %40
%44 = getelementptr inbounds i8, i8* %0, i64 14
%45 = load i8, i8* %44
switch i8 %45, label %46 [
i8 61, label %58
i8 0, label %58
]
46: ; preds = %43
%47 = getelementptr inbounds i8, i8* %0, i64 15
%48 = load i8, i8* %47
switch i8 %48, label %49 [
i8 61, label %58
i8 0, label %58
]
49: ; preds = %46
%50 = getelementptr inbounds i8, i8* %0, i64 16
%51 = load i8, i8* %50
switch i8 %51, label %52 [
i8 61, label %58
i8 0, label %58
]
52: ; preds = %49
%53 = getelementptr inbounds i8, i8* %0, i64 17
%54 = load i8, i8* %53
switch i8 %54, label %55 [
i8 61, label %58
i8 0, label %58
]
55: ; preds = %52
%56 = getelementptr inbounds i8, i8* %0, i64 18
%57 = load i8, i8* %56
switch i8 %57, label %70 [
i8 61, label %58
i8 0, label %58
]
58: ; preds = %2, %2, %4, %4, %7, %7, %10, %10, %13, %13, %16, %16, %19, %19, %22, %22, %25, %25, %28, %28, %31, %31, %34, %34, %37, %37, %40, %40, %43, %43, %46, %46, %49, %49, %52, %52, %55, %55
%59 = phi i64 [ 0, %2 ], [ 0, %2 ], [ 1, %4 ], [ 1, %4 ], [ 2, %7 ], [ 2, %7 ], [ 3, %10 ], [ 3, %10 ], [ 4, %13 ], [ 4, %13 ], [ 5, %16 ], [ 5, %16 ], [ 6, %19 ], [ 6, %19 ], [ 7, %22 ], [ 7, %22 ], [ 8, %25 ], [ 8, %25 ], [ 9, %28 ], [ 9, %28 ], [ 10, %31 ], [ 10, %31 ], [ 11, %34 ], [ 11, %34 ], [ 12, %37 ], [ 12, %37 ], [ 13, %40 ], [ 13, %40 ], [ 14, %43 ], [ 14, %43 ], [ 15, %46 ], [ 15, %46 ], [ 16, %49 ], [ 16, %49 ], [ 17, %52 ], [ 17, %52 ], [ 18, %55 ], [ 18, %55 ]
%60 = getelementptr inbounds i8, i8* %0, i64 %59
%61 = load i8, i8* %60
%62 = icmp eq i8 %61, 0
br i1 %62, label %70, label %63
63: ; preds = %58
%64 = tail call i32 @strlen(i8* %60)
%65 = icmp slt i32 %64, 8
br i1 %65, label %70, label %66
66: ; preds = %63
%67 = getelementptr inbounds i8, i8* %60, i64 1
%68 = getelementptr inbounds i8, i8* %67, i64 4
%69 = tail call i32 @vMemcpy0(i8* %1, i8* %68, i32 3)
br label %70
70: ; preds = %55, %63, %58, %66
%71 = phi i32 [ 0, %66 ], [ 1, %58 ], [ 1, %63 ], [ 1, %55 ]
ret i32 %71
}