#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 isAction(char *);
int isDirective(char *);
int isRegister(char *);
int /*<<< orphan*/ isalnum(char);
int /*<<< orphan*/ isalpha(char);
scalar_t__ isspace(char);
int /*<<< orphan*/ printf(char *, int, ...);
int isDirectiveAddressing(char *buff, int line) {
  int i;
  int labelLen;
  while (isspace(*buff)) {
    buff++;
  }
  if ((!isalpha(*buff))) {
    return -2;
  }
  i = 0;
  while (!isspace(buff[i]) && buff[i] != '\0') {
    if (!isalnum(buff[i])) {
      return 0;
    }
    i++;
  }
  labelLen = i;
  if ((isAction(buff) != -2) || (isDirective(buff) != -2) ||
      isRegister(buff) != -2) {
    printf("error:line %d: operend cannot be a reserved word!! \n", line);
    return -1;
  }
  while (isspace(buff[i]) && buff[i] != '\n' && buff[i] != '[') {
    i++;
  }
  if (buff[i] != '\0' && buff[i] != '[') {
    printf("error !!! = %c  \n", buff[i]);
    return -1;
  }
  if (labelLen > 30) {
    printf("ERROR:line %d:max lenght of label is %d ", 30, line);
    return -1;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isDirectiveAddressing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isspace@plt>
cmp    $0x0,%rax
je     11a6 <isDirectiveAddressing+0x36>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    117f <isDirectiveAddressing+0xf>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1080 <isalpha@plt>
cmp    $0x0,%eax
jne    11c7 <isDirectiveAddressing+0x57>
movl   $0xfffffffe,-0x4(%rbp)
jmp    139b <isDirectiveAddressing+0x22b>
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1060 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x1d(%rbp)
jne    1206 <isDirectiveAddressing+0x96>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    1216 <isDirectiveAddressing+0xa6>
jmp    124a <isDirectiveAddressing+0xda>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1050 <isalnum@plt>
cmp    $0x0,%eax
jne    123c <isDirectiveAddressing+0xcc>
movl   $0x0,-0x4(%rbp)
jmp    139b <isDirectiveAddressing+0x22b>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11ce <isDirectiveAddressing+0x5e>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <isAction@plt>
cmp    $0xfffffffe,%eax
jne    1286 <isDirectiveAddressing+0x116>
mov    -0x10(%rbp),%rdi
call   1090 <isDirective@plt>
cmp    $0xfffffffe,%eax
jne    1286 <isDirectiveAddressing+0x116>
mov    -0x10(%rbp),%rdi
call   1070 <isRegister@plt>
cmp    $0xfffffffe,%eax
je     12a3 <isDirectiveAddressing+0x133>
mov    -0x14(%rbp),%esi
lea    0xd70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    139b <isDirectiveAddressing+0x22b>
jmp    12a8 <isDirectiveAddressing+0x138>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1060 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x1e(%rbp)
je     12fa <isDirectiveAddressing+0x18a>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x1e(%rbp)
je     12fa <isDirectiveAddressing+0x18a>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5b,%eax
setne  %al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
test   $0x1,%al
jne    130a <isDirectiveAddressing+0x19a>
jmp    1318 <isDirectiveAddressing+0x1a8>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    12a8 <isDirectiveAddressing+0x138>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1368 <isDirectiveAddressing+0x1f8>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5b,%eax
je     1368 <isDirectiveAddressing+0x1f8>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xce0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    139b <isDirectiveAddressing+0x22b>
cmpl   $0x1e,-0x1c(%rbp)
jle    1394 <isDirectiveAddressing+0x224>
mov    -0x14(%rbp),%edx
lea    0xccb(%rip),%rdi
mov    $0x1e,%esi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    139b <isDirectiveAddressing+0x22b>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isDirectiveAddressing>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1060 <isspace@plt>
test   %rax,%rax
jne    1190 <isDirectiveAddressing+0x20>
movsbl (%rbx),%edi
call   1080 <isalpha@plt>
test   %eax,%eax
je     127c <isDirectiveAddressing+0x10c>
movsbl (%rbx),%edi
call   1060 <isspace@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     128c <isDirectiveAddressing+0x11c>
mov    %rbx,%rdi
call   1030 <isAction@plt>
cmp    $0xfffffffe,%eax
jne    1264 <isDirectiveAddressing+0xf4>
mov    %rbx,%rdi
call   1090 <isDirective@plt>
cmp    $0xfffffffe,%eax
jne    1264 <isDirectiveAddressing+0xf4>
mov    %rbx,%rdi
call   1070 <isRegister@plt>
cmp    $0xfffffffe,%eax
jne    1264 <isDirectiveAddressing+0xf4>
mov    %ebp,%r15d
movsbl (%rbx,%r15,1),%edi
call   1060 <isspace@plt>
test   %rax,%rax
je     1231 <isDirectiveAddressing+0xc1>
cs nopw 0x0(%rax,%rax,1)
movzbl (%rbx,%r15,1),%eax
cmp    $0xa,%al
je     1236 <isDirectiveAddressing+0xc6>
cmp    $0x5b,%al
je     1236 <isDirectiveAddressing+0xc6>
movsbl 0x1(%rbx,%r15,1),%edi
call   1060 <isspace@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1210 <isDirectiveAddressing+0xa0>
add    %r15,%rbx
mov    (%rbx),%al
test   %al,%al
je     1242 <isDirectiveAddressing+0xd2>
cmp    $0x5b,%al
jne    12c4 <isDirectiveAddressing+0x154>
mov    $0x1,%eax
cmp    $0x1f,%ebp
jb     1281 <isDirectiveAddressing+0x111>
lea    0xdf4(%rip),%rdi
mov    $0x1e,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1275 <isDirectiveAddressing+0x105>
lea    0xd95(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%eax
jmp    1281 <isDirectiveAddressing+0x111>
mov    $0xfffffffe,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
xchg   %ax,%ax
movzbl (%rbx,%rbp,1),%eax
test   %al,%al
je     11c5 <isDirectiveAddressing+0x55>
movsbl %al,%edi
call   1050 <isalnum@plt>
test   %eax,%eax
je     12c0 <isDirectiveAddressing+0x150>
movsbl 0x1(%rbx,%rbp,1),%edi
add    $0x1,%rbp
call   1060 <isspace@plt>
test   %rax,%rax
je     1290 <isDirectiveAddressing+0x120>
jmp    11c5 <isDirectiveAddressing+0x55>
xor    %eax,%eax
jmp    1281 <isDirectiveAddressing+0x111>
movsbl %al,%esi
lea    0xd67(%rip),%rdi
jmp    126e <isDirectiveAddressing+0xfe>

LLVM IR (-O0):
@.str = [53 x i8] c"error:line %d: operend cannot be a reserved word!! \0A\00"
@.str.1 = [18 x i8] c"error !!! = %c \0A\00"
@.str.2 = [41 x i8] c"ERROR:line %d:max lenght of label is %d \00"
define i32 @isDirectiveAddressing(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
br label %8
8: ; preds = %13, %2
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = call i64 @isspace(i8 signext %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %4
br label %8
16: ; preds = %8
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = call i32 @isalpha(i8 signext %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %16
store i32 -2, i32* %3
br label %130
22: ; preds = %16
store i32 0, i32* %6
br label %23
23: ; preds = %50, %22
%24 = load i8*, i8** %4
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
%29 = call i64 @isspace(i8 signext %28)
%30 = icmp ne i64 %29, 0
br i1 %30, label %39, label %31
31: ; preds = %23
%32 = load i8*, i8** %4
%33 = load i32, i32* %6
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp ne i32 %37, 0
br label %39
39: ; preds = %31, %23
%40 = phi i1 [ false, %23 ], [ %38, %31 ]
br i1 %40, label %41, label %53
41: ; preds = %39
%42 = load i8*, i8** %4
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
%46 = load i8, i8* %45
%47 = call i32 @isalnum(i8 signext %46)
%48 = icmp ne i32 %47, 0
br i1 %48, label %50, label %49
49: ; preds = %41
store i32 0, i32* %3
br label %130
50: ; preds = %41
%51 = load i32, i32* %6
%52 = add nsw i32 %51, 1
store i32 %52, i32* %6
br label %23
53: ; preds = %39
%54 = load i32, i32* %6
store i32 %54, i32* %7
%55 = load i8*, i8** %4
%56 = call i32 @isAction(i8* %55)
%57 = icmp ne i32 %56, -2
br i1 %57, label %66, label %58
58: ; preds = %53
%59 = load i8*, i8** %4
%60 = call i32 @isDirective(i8* %59)
%61 = icmp ne i32 %60, -2
br i1 %61, label %66, label %62
62: ; preds = %58
%63 = load i8*, i8** %4
%64 = call i32 @isRegister(i8* %63)
%65 = icmp ne i32 %64, -2
br i1 %65, label %66, label %69
66: ; preds = %62, %58, %53
%67 = load i32, i32* %5
%68 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %67)
store i32 -1, i32* %3
br label %130
69: ; preds = %62
br label %70
70: ; preds = %96, %69
%71 = load i8*, i8** %4
%72 = load i32, i32* %6
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8, i8* %71, i64 %73
%75 = load i8, i8* %74
%76 = call i64 @isspace(i8 signext %75)
%77 = icmp ne i64 %76, 0
br i1 %77, label %78, label %94
78: ; preds = %70
%79 = load i8*, i8** %4
%80 = load i32, i32* %6
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds i8, i8* %79, i64 %81
%83 = load i8, i8* %82
%84 = sext i8 %83 to i32
%85 = icmp ne i32 %84, 10
br i1 %85, label %86, label %94
86: ; preds = %78
%87 = load i8*, i8** %4
%88 = load i32, i32* %6
%89 = sext i32 %88 to i64
%90 = getelementptr inbounds i8, i8* %87, i64 %89
%91 = load i8, i8* %90
%92 = sext i8 %91 to i32
%93 = icmp ne i32 %92, 91
br label %94
94: ; preds = %86, %78, %70
%95 = phi i1 [ false, %78 ], [ false, %70 ], [ %93, %86 ]
br i1 %95, label %96, label %99
96: ; preds = %94
%97 = load i32, i32* %6
%98 = add nsw i32 %97, 1
store i32 %98, i32* %6
br label %70
99: ; preds = %94
%100 = load i8*, i8** %4
%101 = load i32, i32* %6
%102 = sext i32 %101 to i64
%103 = getelementptr inbounds i8, i8* %100, i64 %102
%104 = load i8, i8* %103
%105 = sext i8 %104 to i32
%106 = icmp ne i32 %105, 0
br i1 %106, label %107, label %123
107: ; preds = %99
%108 = load i8*, i8** %4
%109 = load i32, i32* %6
%110 = sext i32 %109 to i64
%111 = getelementptr inbounds i8, i8* %108, i64 %110
%112 = load i8, i8* %111
%113 = sext i8 %112 to i32
%114 = icmp ne i32 %113, 91
br i1 %114, label %115, label %123
115: ; preds = %107
%116 = load i8*, i8** %4
%117 = load i32, i32* %6
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i8, i8* %116, i64 %118
%120 = load i8, i8* %119
%121 = sext i8 %120 to i32
%122 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %121)
store i32 -1, i32* %3
br label %130
123: ; preds = %107, %99
%124 = load i32, i32* %7
%125 = icmp sgt i32 %124, 30
br i1 %125, label %126, label %129
126: ; preds = %123
%127 = load i32, i32* %5
%128 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 30, i32 %127)
store i32 -1, i32* %3
br label %130
129: ; preds = %123
store i32 1, i32* %3
br label %130
130: ; preds = %129, %126, %115, %66, %49, %21
%131 = load i32, i32* %3
ret i32 %131
}

LLVM IR (-O2):
@.str = [53 x i8] c"error:line %d: operend cannot be a reserved word!! \0A\00"
@.str.1 = [18 x i8] c"error !!! = %c \0A\00"
@.str.2 = [41 x i8] c"ERROR:line %d:max lenght of label is %d \00"
define i32 @isDirectiveAddressing(i8* %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = load i8, i8* %4
%6 = tail call i64 @isspace(i8 signext %5)
%7 = icmp eq i64 %6, 0
%8 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = load i8, i8* %4
%11 = tail call i32 @isalpha(i8 signext %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %74, label %13
13: ; preds = %9
%14 = load i8, i8* %4
%15 = tail call i64 @isspace(i8 signext %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %34
17: ; preds = %13, %25
%18 = phi i64 [ %26, %25 ], [ 0, %13 ]
%19 = phi i8* [ %27, %25 ], [ %4, %13 ]
%20 = load i8, i8* %19
%21 = icmp eq i8 %20, 0
br i1 %21, label %31, label %22
22: ; preds = %17
%23 = tail call i32 @isalnum(i8 signext %20)
%24 = icmp eq i32 %23, 0
br i1 %24, label %74, label %25
25: ; preds = %22
%26 = add nuw i64 %18, 1
%27 = getelementptr inbounds i8, i8* %4, i64 %26
%28 = load i8, i8* %27
%29 = tail call i64 @isspace(i8 signext %28)
%30 = icmp eq i64 %29, 0
br i1 %30, label %17, label %31
31: ; preds = %25, %17
%32 = phi i64 [ %18, %17 ], [ %26, %25 ]
%33 = trunc i64 %32 to i32
br label %34
34: ; preds = %31, %13
%35 = phi i32 [ 0, %13 ], [ %33, %31 ]
%36 = tail call i32 @isAction(i8* %4)
%37 = icmp eq i32 %36, -2
br i1 %37, label %38, label %50
38: ; preds = %34
%39 = tail call i32 @isDirective(i8* %4)
%40 = icmp eq i32 %39, -2
br i1 %40, label %41, label %50
41: ; preds = %38
%42 = tail call i32 @isRegister(i8* %4)
%43 = icmp eq i32 %42, -2
br i1 %43, label %44, label %50
44: ; preds = %41
%45 = zext i32 %35 to i64
%46 = getelementptr inbounds i8, i8* %4, i64 %45
%47 = load i8, i8* %46
%48 = tail call i64 @isspace(i8 signext %47)
%49 = icmp eq i64 %48, 0
br i1 %49, label %62, label %52
50: ; preds = %41, %38, %34
%51 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i32 %1)
br label %74
52: ; preds = %44, %56
%53 = phi i64 [ %57, %56 ], [ %45, %44 ]
%54 = phi i8* [ %58, %56 ], [ %46, %44 ]
%55 = load i8, i8* %54
switch i8 %55, label %56 [
i8 10, label %65
i8 91, label %65
]
56: ; preds = %52
%57 = add nuw i64 %53, 1
%58 = getelementptr inbounds i8, i8* %4, i64 %57
%59 = load i8, i8* %58
%60 = tail call i64 @isspace(i8 signext %59)
%61 = icmp eq i64 %60, 0
br i1 %61, label %62, label %52
62: ; preds = %56, %44
%63 = phi i8* [ %46, %44 ], [ %58, %56 ]
%64 = load i8, i8* %63
br label %65
65: ; preds = %52, %52, %62
%66 = phi i8 [ %64, %62 ], [ %55, %52 ], [ %55, %52 ]
switch i8 %66, label %67 [
i8 0, label %70
i8 91, label %70
]
67: ; preds = %65
%68 = sext i8 %66 to i32
%69 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %68)
br label %74
70: ; preds = %65, %65
%71 = icmp ugt i32 %35, 30
br i1 %71, label %72, label %74
72: ; preds = %70
%73 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 30, i32 %1)
br label %74
74: ; preds = %22, %70, %9, %72, %67, %50
%75 = phi i32 [ -1, %50 ], [ -1, %67 ], [ -1, %72 ], [ -2, %9 ], [ 1, %70 ], [ 0, %22 ]
ret i32 %75
}