#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') {
    i++;
  }
  if (buff[i] != '\0') {
    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    136c <isDirectiveAddressing+0x1fc>
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    136c <isDirectiveAddressing+0x1fc>
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    136c <isDirectiveAddressing+0x1fc>
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     12e0 <isDirectiveAddressing+0x170>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
test   $0x1,%al
jne    12f0 <isDirectiveAddressing+0x180>
jmp    12fe <isDirectiveAddressing+0x18e>
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     1339 <isDirectiveAddressing+0x1c9>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xd0f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    136c <isDirectiveAddressing+0x1fc>
cmpl   $0x1e,-0x1c(%rbp)
jle    1365 <isDirectiveAddressing+0x1f5>
mov    -0x14(%rbp),%edx
lea    0xcfa(%rip),%rdi
mov    $0x1e,%esi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    136c <isDirectiveAddressing+0x1fc>
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     127b <isDirectiveAddressing+0x10b>
movsbl (%rbx),%edi
call   1060 <isspace@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     128b <isDirectiveAddressing+0x11b>
mov    %rbx,%rdi
call   1030 <isAction@plt>
cmp    $0xfffffffe,%eax
jne    1263 <isDirectiveAddressing+0xf3>
mov    %rbx,%rdi
call   1090 <isDirective@plt>
cmp    $0xfffffffe,%eax
jne    1263 <isDirectiveAddressing+0xf3>
mov    %rbx,%rdi
call   1070 <isRegister@plt>
cmp    $0xfffffffe,%eax
jne    1263 <isDirectiveAddressing+0xf3>
mov    %ebp,%r15d
movsbl (%rbx,%r15,1),%edi
call   1060 <isspace@plt>
test   %rax,%rax
je     122f <isDirectiveAddressing+0xbf>
cs nopw 0x0(%rax,%rax,1)
cmpb   $0xa,(%rbx,%r15,1)
je     12c4 <isDirectiveAddressing+0x154>
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
jne    12c6 <isDirectiveAddressing+0x156>
mov    $0x1,%eax
cmp    $0x1f,%ebp
jb     1280 <isDirectiveAddressing+0x110>
lea    0xdfa(%rip),%rdi
mov    $0x1e,%esi
mov    %r14d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%eax
jmp    1280 <isDirectiveAddressing+0x110>
lea    0xd96(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xffffffff,%eax
jmp    1280 <isDirectiveAddressing+0x110>
mov    $0xfffffffe,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
nopl   (%rax)
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    1280 <isDirectiveAddressing+0x110>
mov    $0xa,%al
movsbl %al,%esi
lea    0xd65(%rip),%rdi
jmp    126d <isDirectiveAddressing+0xfd>

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 %114
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 %114
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 %114
69: ; preds = %62
br label %70
70: ; preds = %88, %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 %86
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 label %86
86: ; preds = %78, %70
%87 = phi i1 [ false, %70 ], [ %85, %78 ]
br i1 %87, label %88, label %91
88: ; preds = %86
%89 = load i32, i32* %6
%90 = add nsw i32 %89, 1
store i32 %90, i32* %6
br label %70
91: ; preds = %86
%92 = load i8*, i8** %4
%93 = load i32, i32* %6
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i8, i8* %92, i64 %94
%96 = load i8, i8* %95
%97 = sext i8 %96 to i32
%98 = icmp ne i32 %97, 0
br i1 %98, label %99, label %107
99: ; preds = %91
%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 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %105)
store i32 -1, i32* %3
br label %114
107: ; preds = %91
%108 = load i32, i32* %7
%109 = icmp sgt i32 %108, 30
br i1 %109, label %110, label %113
110: ; preds = %107
%111 = load i32, i32* %5
%112 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.2, i64 0, i64 0), i32 30, i32 %111)
store i32 -1, i32* %3
br label %114
113: ; preds = %107
store i32 1, i32* %3
br label %114
114: ; preds = %113, %110, %99, %66, %49, %21
%115 = load i32, i32* %3
ret i32 %115
}

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 %75, 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 %75, 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 %63, label %57
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 %75
52: ; preds = %57
%53 = getelementptr inbounds i8, i8* %4, i64 %62
%54 = load i8, i8* %53
%55 = tail call i64 @isspace(i8 signext %54)
%56 = icmp eq i64 %55, 0
br i1 %56, label %63, label %57
57: ; preds = %44, %52
%58 = phi i64 [ %62, %52 ], [ %45, %44 ]
%59 = phi i8* [ %53, %52 ], [ %46, %44 ]
%60 = load i8, i8* %59
%61 = icmp eq i8 %60, 10
%62 = add nuw i64 %58, 1
br i1 %61, label %67, label %52
63: ; preds = %52, %44
%64 = phi i8* [ %46, %44 ], [ %53, %52 ]
%65 = load i8, i8* %64
%66 = icmp eq i8 %65, 0
br i1 %66, label %71, label %67
67: ; preds = %57, %63
%68 = phi i8 [ %65, %63 ], [ 10, %57 ]
%69 = sext i8 %68 to i32
%70 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %69)
br label %75
71: ; preds = %63
%72 = icmp ugt i32 %35, 30
br i1 %72, label %73, label %75
73: ; preds = %71
%74 = 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 %75
75: ; preds = %22, %71, %9, %73, %67, %50
%76 = phi i32 [ -1, %50 ], [ -1, %67 ], [ -1, %73 ], [ -2, %9 ], [ 1, %71 ], [ 0, %22 ]
ret i32 %76
}