#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 convertCharacterToInt32(char);
int UpnCheck(char *upn) {
  int control = 0, helper = 0;
  if (upn[0] < '0' || upn[0] > '9')
    return 0;
  if (upn[1] < '0' || upn[1] > '9')
    return 0;
  if (convertCharacterToInt32(upn[2]) * 10 + convertCharacterToInt32(upn[3]) >
      52)
    return 0;
  if (upn[4] > '3' || upn[4] < '0')
    return 0;
  if (upn[4] == '3') {
    if (upn[5] != '1' || upn[5] != '0')
      return 0;
  }
  if (upn[5] < '0' || upn[5] > '9')
    return 0;
  control += convertCharacterToInt32(upn[0]) * 2;
  control += convertCharacterToInt32(upn[1]) * 4;
  control += convertCharacterToInt32(upn[2]) * 8;
  control += convertCharacterToInt32(upn[3]) * 5;
  control += convertCharacterToInt32(upn[4]) * 10;
  control += convertCharacterToInt32(upn[5]) * 9;
  control += convertCharacterToInt32(upn[6]) * 7;
  control += convertCharacterToInt32(upn[7]) * 3;
  control += convertCharacterToInt32(upn[8]) * 6;
  if (control % 11 < 10)
    helper = control % 11;
  if (control % 11 == 10)
    helper = 0;
  if (convertCharacterToInt32(upn[9]) != helper)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<UpnCheck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     114a <UpnCheck+0x3a>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jle    1156 <UpnCheck+0x46>
movl   $0x0,-0x4(%rbp)
jmp    138b <UpnCheck+0x27b>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x30,%eax
jl     1178 <UpnCheck+0x68>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x39,%eax
jle    1184 <UpnCheck+0x74>
movl   $0x0,-0x4(%rbp)
jmp    138b <UpnCheck+0x27b>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%edi
call   1030 <convertCharacterToInt32@plt>
imul   $0xa,%eax,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%edi
call   1030 <convertCharacterToInt32@plt>
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
cmp    $0x34,%eax
jle    11c0 <UpnCheck+0xb0>
movl   $0x0,-0x4(%rbp)
jmp    138b <UpnCheck+0x27b>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x33,%eax
jg     11e2 <UpnCheck+0xd2>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x30,%eax
jge    11ee <UpnCheck+0xde>
movl   $0x0,-0x4(%rbp)
jmp    138b <UpnCheck+0x27b>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x33,%eax
jne    1232 <UpnCheck+0x122>
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%eax
cmp    $0x31,%eax
jne    1221 <UpnCheck+0x111>
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%eax
cmp    $0x30,%eax
je     122d <UpnCheck+0x11d>
movl   $0x0,-0x4(%rbp)
jmp    138b <UpnCheck+0x27b>
jmp    1232 <UpnCheck+0x122>
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%eax
cmp    $0x30,%eax
jl     1254 <UpnCheck+0x144>
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%eax
cmp    $0x39,%eax
jle    1260 <UpnCheck+0x150>
movl   $0x0,-0x4(%rbp)
jmp    138b <UpnCheck+0x27b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <convertCharacterToInt32@plt>
shl    $0x1,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <convertCharacterToInt32@plt>
shl    $0x2,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%edi
call   1030 <convertCharacterToInt32@plt>
shl    $0x3,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%edi
call   1030 <convertCharacterToInt32@plt>
imul   $0x5,%eax,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%edi
call   1030 <convertCharacterToInt32@plt>
imul   $0xa,%eax,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%edi
call   1030 <convertCharacterToInt32@plt>
imul   $0x9,%eax,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x6(%rax),%edi
call   1030 <convertCharacterToInt32@plt>
imul   $0x7,%eax,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x7(%rax),%edi
call   1030 <convertCharacterToInt32@plt>
imul   $0x3,%eax,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x8(%rax),%edi
call   1030 <convertCharacterToInt32@plt>
imul   $0x6,%eax,%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xb,%ecx
cltd
idiv   %ecx
cmp    $0xa,%edx
jge    1347 <UpnCheck+0x237>
mov    -0x14(%rbp),%eax
mov    $0xb,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xb,%ecx
cltd
idiv   %ecx
cmp    $0xa,%edx
jne    1362 <UpnCheck+0x252>
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x9(%rax),%edi
call   1030 <convertCharacterToInt32@plt>
cmp    -0x18(%rbp),%eax
je     1384 <UpnCheck+0x274>
movl   $0x0,-0x4(%rbp)
jmp    138b <UpnCheck+0x27b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UpnCheck>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
add    $0xc6,%al
xor    %ebp,%ebp
cmp    $0xf6,%al
jb     123e <UpnCheck+0x12e>
mov    %rdi,%rbx
mov    0x1(%rdi),%al
add    $0xc6,%al
cmp    $0xf6,%al
jb     123e <UpnCheck+0x12e>
movsbl 0x2(%rbx),%edi
call   1030 <convertCharacterToInt32@plt>
lea    (%rax,%rax,4),%r14d
movsbl 0x3(%rbx),%edi
call   1030 <convertCharacterToInt32@plt>
lea    (%rax,%r14,2),%eax
cmp    $0x34,%eax
jg     123e <UpnCheck+0x12e>
mov    0x4(%rbx),%al
add    $0xcd,%al
cmp    $0xfd,%al
jb     123e <UpnCheck+0x12e>
mov    0x5(%rbx),%al
add    $0xc6,%al
cmp    $0xf6,%al
jb     123e <UpnCheck+0x12e>
movsbl (%rbx),%edi
call   1030 <convertCharacterToInt32@plt>
mov    %eax,%ebp
add    %ebp,%ebp
movsbl 0x1(%rbx),%edi
call   1030 <convertCharacterToInt32@plt>
lea    0x0(%rbp,%rax,4),%ebp
movsbl 0x2(%rbx),%edi
call   1030 <convertCharacterToInt32@plt>
lea    0x0(%rbp,%rax,8),%r14d
movsbl 0x3(%rbx),%edi
call   1030 <convertCharacterToInt32@plt>
lea    (%rax,%rax,4),%ebp
add    %r14d,%ebp
movsbl 0x4(%rbx),%edi
call   1030 <convertCharacterToInt32@plt>
lea    (%rax,%rax,4),%eax
lea    0x0(%rbp,%rax,2),%r14d
movsbl 0x5(%rbx),%edi
call   1030 <convertCharacterToInt32@plt>
lea    (%rax,%rax,8),%r15d
add    %r14d,%r15d
movsbl 0x6(%rbx),%edi
call   1030 <convertCharacterToInt32@plt>
lea    0x0(,%rax,8),%ebp
sub    %eax,%ebp
add    %r15d,%ebp
movsbl 0x7(%rbx),%edi
call   1030 <convertCharacterToInt32@plt>
lea    (%rax,%rax,2),%r14d
add    %ebp,%r14d
movsbl 0x8(%rbx),%edi
call   1030 <convertCharacterToInt32@plt>
lea    (%rax,%rax,2),%eax
lea    (%r14,%rax,2),%eax
movslq %eax,%r14
imul   $0x2e8ba2e9,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,2),%eax
sub    %eax,%r14d
xor    %eax,%eax
cmp    $0xa,%r14d
cmovge %eax,%r14d
cmove  %eax,%r14d
movsbl 0x9(%rbx),%edi
call   1030 <convertCharacterToInt32@plt>
xor    %ebp,%ebp
cmp    %r14d,%eax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @UpnCheck(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
store i32 0, i32* %5
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp slt i32 %9, 48
br i1 %10, label %17, label %11
11: ; preds = %1
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp sgt i32 %15, 57
br i1 %16, label %17, label %18
17: ; preds = %11, %1
store i32 0, i32* %2
br label %174
18: ; preds = %11
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i64 1
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp slt i32 %22, 48
br i1 %23, label %30, label %24
24: ; preds = %18
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp sgt i32 %28, 57
br i1 %29, label %30, label %31
30: ; preds = %24, %18
store i32 0, i32* %2
br label %174
31: ; preds = %24
%32 = load i8*, i8** %3
%33 = getelementptr inbounds i8, i8* %32, i64 2
%34 = load i8, i8* %33
%35 = call i32 @convertCharacterToInt32(i8 signext %34)
%36 = mul nsw i32 %35, 10
%37 = load i8*, i8** %3
%38 = getelementptr inbounds i8, i8* %37, i64 3
%39 = load i8, i8* %38
%40 = call i32 @convertCharacterToInt32(i8 signext %39)
%41 = add nsw i32 %36, %40
%42 = icmp sgt i32 %41, 52
br i1 %42, label %43, label %44
43: ; preds = %31
store i32 0, i32* %2
br label %174
44: ; preds = %31
%45 = load i8*, i8** %3
%46 = getelementptr inbounds i8, i8* %45, i64 4
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp sgt i32 %48, 51
br i1 %49, label %56, label %50
50: ; preds = %44
%51 = load i8*, i8** %3
%52 = getelementptr inbounds i8, i8* %51, i64 4
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp slt i32 %54, 48
br i1 %55, label %56, label %57
56: ; preds = %50, %44
store i32 0, i32* %2
br label %174
57: ; preds = %50
%58 = load i8*, i8** %3
%59 = getelementptr inbounds i8, i8* %58, i64 4
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = icmp eq i32 %61, 51
br i1 %62, label %63, label %77
63: ; preds = %57
%64 = load i8*, i8** %3
%65 = getelementptr inbounds i8, i8* %64, i64 5
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = icmp ne i32 %67, 49
br i1 %68, label %75, label %69
69: ; preds = %63
%70 = load i8*, i8** %3
%71 = getelementptr inbounds i8, i8* %70, i64 5
%72 = load i8, i8* %71
%73 = sext i8 %72 to i32
%74 = icmp ne i32 %73, 48
br i1 %74, label %75, label %76
75: ; preds = %69, %63
store i32 0, i32* %2
br label %174
76: ; preds = %69
br label %77
77: ; preds = %76, %57
%78 = load i8*, i8** %3
%79 = getelementptr inbounds i8, i8* %78, i64 5
%80 = load i8, i8* %79
%81 = sext i8 %80 to i32
%82 = icmp slt i32 %81, 48
br i1 %82, label %89, label %83
83: ; preds = %77
%84 = load i8*, i8** %3
%85 = getelementptr inbounds i8, i8* %84, i64 5
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = icmp sgt i32 %87, 57
br i1 %88, label %89, label %90
89: ; preds = %83, %77
store i32 0, i32* %2
br label %174
90: ; preds = %83
%91 = load i8*, i8** %3
%92 = getelementptr inbounds i8, i8* %91, i64 0
%93 = load i8, i8* %92
%94 = call i32 @convertCharacterToInt32(i8 signext %93)
%95 = mul nsw i32 %94, 2
%96 = load i32, i32* %4
%97 = add nsw i32 %96, %95
store i32 %97, i32* %4
%98 = load i8*, i8** %3
%99 = getelementptr inbounds i8, i8* %98, i64 1
%100 = load i8, i8* %99
%101 = call i32 @convertCharacterToInt32(i8 signext %100)
%102 = mul nsw i32 %101, 4
%103 = load i32, i32* %4
%104 = add nsw i32 %103, %102
store i32 %104, i32* %4
%105 = load i8*, i8** %3
%106 = getelementptr inbounds i8, i8* %105, i64 2
%107 = load i8, i8* %106
%108 = call i32 @convertCharacterToInt32(i8 signext %107)
%109 = mul nsw i32 %108, 8
%110 = load i32, i32* %4
%111 = add nsw i32 %110, %109
store i32 %111, i32* %4
%112 = load i8*, i8** %3
%113 = getelementptr inbounds i8, i8* %112, i64 3
%114 = load i8, i8* %113
%115 = call i32 @convertCharacterToInt32(i8 signext %114)
%116 = mul nsw i32 %115, 5
%117 = load i32, i32* %4
%118 = add nsw i32 %117, %116
store i32 %118, i32* %4
%119 = load i8*, i8** %3
%120 = getelementptr inbounds i8, i8* %119, i64 4
%121 = load i8, i8* %120
%122 = call i32 @convertCharacterToInt32(i8 signext %121)
%123 = mul nsw i32 %122, 10
%124 = load i32, i32* %4
%125 = add nsw i32 %124, %123
store i32 %125, i32* %4
%126 = load i8*, i8** %3
%127 = getelementptr inbounds i8, i8* %126, i64 5
%128 = load i8, i8* %127
%129 = call i32 @convertCharacterToInt32(i8 signext %128)
%130 = mul nsw i32 %129, 9
%131 = load i32, i32* %4
%132 = add nsw i32 %131, %130
store i32 %132, i32* %4
%133 = load i8*, i8** %3
%134 = getelementptr inbounds i8, i8* %133, i64 6
%135 = load i8, i8* %134
%136 = call i32 @convertCharacterToInt32(i8 signext %135)
%137 = mul nsw i32 %136, 7
%138 = load i32, i32* %4
%139 = add nsw i32 %138, %137
store i32 %139, i32* %4
%140 = load i8*, i8** %3
%141 = getelementptr inbounds i8, i8* %140, i64 7
%142 = load i8, i8* %141
%143 = call i32 @convertCharacterToInt32(i8 signext %142)
%144 = mul nsw i32 %143, 3
%145 = load i32, i32* %4
%146 = add nsw i32 %145, %144
store i32 %146, i32* %4
%147 = load i8*, i8** %3
%148 = getelementptr inbounds i8, i8* %147, i64 8
%149 = load i8, i8* %148
%150 = call i32 @convertCharacterToInt32(i8 signext %149)
%151 = mul nsw i32 %150, 6
%152 = load i32, i32* %4
%153 = add nsw i32 %152, %151
store i32 %153, i32* %4
%154 = load i32, i32* %4
%155 = srem i32 %154, 11
%156 = icmp slt i32 %155, 10
br i1 %156, label %157, label %160
157: ; preds = %90
%158 = load i32, i32* %4
%159 = srem i32 %158, 11
store i32 %159, i32* %5
br label %160
160: ; preds = %157, %90
%161 = load i32, i32* %4
%162 = srem i32 %161, 11
%163 = icmp eq i32 %162, 10
br i1 %163, label %164, label %165
164: ; preds = %160
store i32 0, i32* %5
br label %165
165: ; preds = %164, %160
%166 = load i8*, i8** %3
%167 = getelementptr inbounds i8, i8* %166, i64 9
%168 = load i8, i8* %167
%169 = call i32 @convertCharacterToInt32(i8 signext %168)
%170 = load i32, i32* %5
%171 = icmp ne i32 %169, %170
br i1 %171, label %172, label %173
172: ; preds = %165
store i32 0, i32* %2
br label %174
173: ; preds = %165
store i32 1, i32* %2
br label %174
174: ; preds = %173, %172, %89, %75, %56, %43, %30, %17
%175 = load i32, i32* %2
ret i32 %175
}

LLVM IR (-O2):
define i32 @UpnCheck(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = add i8 %2, -58
%4 = icmp ult i8 %3, -10
br i1 %4, label %79, label %5
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = add i8 %7, -58
%9 = icmp ult i8 %8, -10
br i1 %9, label %79, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = load i8, i8* %11
%13 = tail call i32 @convertCharacterToInt32(i8 signext %12)
%14 = mul nsw i32 %13, 10
%15 = getelementptr inbounds i8, i8* %0, i64 3
%16 = load i8, i8* %15
%17 = tail call i32 @convertCharacterToInt32(i8 signext %16)
%18 = add nsw i32 %17, %14
%19 = icmp sgt i32 %18, 52
br i1 %19, label %79, label %20
20: ; preds = %10
%21 = getelementptr inbounds i8, i8* %0, i64 4
%22 = load i8, i8* %21
%23 = add i8 %22, -51
%24 = icmp ult i8 %23, -3
br i1 %24, label %79, label %25
25: ; preds = %20
%26 = getelementptr inbounds i8, i8* %0, i64 5
%27 = load i8, i8* %26
%28 = add i8 %27, -58
%29 = icmp ult i8 %28, -10
br i1 %29, label %79, label %30
30: ; preds = %25
%31 = load i8, i8* %0
%32 = tail call i32 @convertCharacterToInt32(i8 signext %31)
%33 = shl nsw i32 %32, 1
%34 = load i8, i8* %6
%35 = tail call i32 @convertCharacterToInt32(i8 signext %34)
%36 = shl nsw i32 %35, 2
%37 = add nsw i32 %36, %33
%38 = load i8, i8* %11
%39 = tail call i32 @convertCharacterToInt32(i8 signext %38)
%40 = shl nsw i32 %39, 3
%41 = add nsw i32 %37, %40
%42 = load i8, i8* %15
%43 = tail call i32 @convertCharacterToInt32(i8 signext %42)
%44 = mul nsw i32 %43, 5
%45 = add nsw i32 %41, %44
%46 = load i8, i8* %21
%47 = tail call i32 @convertCharacterToInt32(i8 signext %46)
%48 = mul nsw i32 %47, 10
%49 = add nsw i32 %45, %48
%50 = load i8, i8* %26
%51 = tail call i32 @convertCharacterToInt32(i8 signext %50)
%52 = mul nsw i32 %51, 9
%53 = add nsw i32 %49, %52
%54 = getelementptr inbounds i8, i8* %0, i64 6
%55 = load i8, i8* %54
%56 = tail call i32 @convertCharacterToInt32(i8 signext %55)
%57 = mul nsw i32 %56, 7
%58 = add nsw i32 %53, %57
%59 = getelementptr inbounds i8, i8* %0, i64 7
%60 = load i8, i8* %59
%61 = tail call i32 @convertCharacterToInt32(i8 signext %60)
%62 = mul nsw i32 %61, 3
%63 = add nsw i32 %58, %62
%64 = getelementptr inbounds i8, i8* %0, i64 8
%65 = load i8, i8* %64
%66 = tail call i32 @convertCharacterToInt32(i8 signext %65)
%67 = mul nsw i32 %66, 6
%68 = add nsw i32 %63, %67
%69 = srem i32 %68, 11
%70 = icmp slt i32 %69, 10
%71 = select i1 %70, i32 %69, i32 0
%72 = icmp eq i32 %69, 10
%73 = select i1 %72, i32 0, i32 %71
%74 = getelementptr inbounds i8, i8* %0, i64 9
%75 = load i8, i8* %74
%76 = tail call i32 @convertCharacterToInt32(i8 signext %75)
%77 = icmp eq i32 %76, %73
%78 = zext i1 %77 to i32
br label %79
79: ; preds = %30, %25, %20, %10, %5, %1
%80 = phi i32 [ 0, %1 ], [ 0, %5 ], [ 0, %10 ], [ 0, %20 ], [ 0, %25 ], [ %78, %30 ]
ret i32 %80
}