#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 /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
int /*<<< orphan*/ system(char *);
int main() {
  char nome[31];
  char A[] = "ABCDEFGHIJLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$";
  char B[] = "1234567890";
  int i, j, count = 0, count2, total;
  printf("Digite o nome para uma variável: ");
  gets(nome);
  for (j = 0; j < strlen(A); j++) {
    if (nome[0] != A[j])
      count++;
  }
  if (count == strlen(A)) {
    printf("\nNome de variável inválido!!!\n\n");
    system("pause");
    return (0);
  }
  strcat(A, B);
  for (i = 0; i < strlen(nome); i++) {
    count2 = total = 0;
    for (j = 0; j < strlen(A); j++) {
      total++;
      if (nome[i] != A[j])
        count2++;
    }
    if (count2 == total) {
      printf("\nNome de variável inválido!!!\n\n");
      system("pause");
      return (0);
    }
  }
  printf("\nNome de variável válido!!!\n\n");
  system("pause");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xe83(%rip),%rsi
mov    $0x36,%edx
call   1060 <memcpy@plt>
mov    0xea8(%rip),%rax
mov    %rax,-0x7b(%rbp)
mov    0xea5(%rip),%ax
mov    %ax,-0x73(%rbp)
mov    0xe9d(%rip),%al
mov    %al,-0x71(%rbp)
movl   $0x0,-0x88(%rbp)
lea    0xe8a(%rip),%rdi
call   1050 <printf@plt>
lea    -0x30(%rbp),%rdi
call   1070 <gets@plt>
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0x94(%rbp)
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x94(%rbp),%eax
cmp    %ecx,%eax
jge    1234 <main+0xd4>
movsbl -0x30(%rbp),%eax
movslq -0x84(%rbp),%rcx
movsbl -0x70(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     121b <main+0xbb>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    1220 <main+0xc0>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    11cf <main+0x6f>
mov    -0x88(%rbp),%eax
mov    %eax,-0x98(%rbp)
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x98(%rbp),%eax
cmp    %ecx,%eax
jne    127d <main+0x11d>
lea    0xe04(%rip),%rdi
call   1050 <printf@plt>
lea    0xe1a(%rip),%rdi
call   1040 <system@plt>
movl   $0x0,-0x4(%rbp)
jmp    13b2 <main+0x252>
lea    -0x70(%rbp),%rdi
lea    -0x7b(%rbp),%rsi
call   1080 <strcat@plt>
movl   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%eax
mov    %eax,-0x9c(%rbp)
lea    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x9c(%rbp),%eax
cmp    %ecx,%eax
jge    1393 <main+0x233>
movl   $0x0,-0x90(%rbp)
movl   $0x0,-0x8c(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
mov    %eax,-0xa0(%rbp)
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xa0(%rbp),%eax
cmp    %ecx,%eax
jge    134a <main+0x1ea>
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
movslq -0x80(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
movslq -0x84(%rbp),%rcx
movsbl -0x70(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
je     1331 <main+0x1d1>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1336 <main+0x1d6>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    12d1 <main+0x171>
mov    -0x8c(%rbp),%eax
cmp    -0x90(%rbp),%eax
jne    1380 <main+0x220>
lea    0xd01(%rip),%rdi
call   1050 <printf@plt>
lea    0xd17(%rip),%rdi
call   1040 <system@plt>
movl   $0x0,-0x4(%rbp)
jmp    13b2 <main+0x252>
jmp    1385 <main+0x225>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    1291 <main+0x131>
lea    0xcf2(%rip),%rdi
call   1050 <printf@plt>
lea    0xce0(%rip),%rdi
call   1040 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
movaps 0xeab(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe8f(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe73(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movabs $0x245f7a79787776,%rax
mov    %rax,0x3e(%rsp)
movabs $0x3837363534333231,%rax
36 37 38
mov    %rax,(%rsp)
movl   $0x303938,0x7(%rsp)
lea    0xe83(%rip),%rdi
call   1060 <printf@plt>
lea    0x50(%rsp),%rdi
call   1070 <gets@plt>
lea    0x10(%rsp),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1215 <main+0xb5>
xor    %ebx,%ebx
lea    0x10(%rsp),%r14
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x50(%rsp),%eax
xor    %ecx,%ecx
cmp    0x10(%rsp,%rbx,1),%al
setne  %cl
add    %ecx,%ebp
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     11f0 <main+0x90>
jmp    1217 <main+0xb7>
xor    %ebp,%ebp
lea    0x10(%rsp),%rdi
call   1040 <strlen@plt>
lea    0xe61(%rip),%r14
cmp    %eax,%ebp
je     12c9 <main+0x169>
lea    0x10(%rsp),%rdi
mov    %rsp,%rsi
call   1080 <strcat@plt>
lea    0x50(%rsp),%rdi
call   1040 <strlen@plt>
lea    0xe1c(%rip),%rcx
test   %eax,%eax
jle    12c6 <main+0x166>
xor    %ebx,%ebx
lea    0x10(%rsp),%r13
lea    0x50(%rsp),%r15
xchg   %ax,%ax
mov    %r13,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    12c9 <main+0x169>
xor    %r12d,%r12d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movzbl 0x50(%rsp,%rbx,1),%eax
xor    %ecx,%ecx
cmp    0x10(%rsp,%r12,1),%al
lea    0x1(%r12),%r12
setne  %cl
add    %ecx,%ebp
mov    %r13,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%r12
jl     1280 <main+0x120>
cmp    %ebp,%r12d
je     12c9 <main+0x169>
add    $0x1,%rbx
mov    %r15,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1260 <main+0x100>
lea    0xda6(%rip),%r14
jmp    12c9 <main+0x169>
mov    %rcx,%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xd8c(%rip),%rdi
call   1050 <system@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.A = [54 x i8] c"ABCDEFGHIJLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$\00"
@__const.main.B = [11 x i8] c"1234567890\00"
@.str = [35 x i8] c"Digite o nome para uma vari\C3\A1vel: \00"
@.str.1 = [34 x i8] c"\0ANome de vari\C3\A1vel inv\C3\A1lido!!!\0A\0A\00"
@.str.2 = [6 x i8] c"pause\00"
@.str.3 = [32 x i8] c"\0ANome de vari\C3\A1vel v\C3\A1lido!!!\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [31 x i8]
%3 = alloca [54 x i8]
%4 = alloca [11 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
%10 = bitcast [54 x i8]* %3 to i8*
%11 = bitcast [11 x i8]* %4 to i8*
store i32 0, i32* %7
%12 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%13 = getelementptr inbounds [31 x i8], [31 x i8]* %2, i64 0, i64 0
%14 = call i32 @gets(i8* %13)
store i32 0, i32* %6
br label %15
15: ; preds = %34, %0
%16 = load i32, i32* %6
%17 = getelementptr inbounds [54 x i8], [54 x i8]* %3, i64 0, i64 0
%18 = call i32 @strlen(i8* %17)
%19 = icmp slt i32 %16, %18
br i1 %19, label %20, label %37
20: ; preds = %15
%21 = getelementptr inbounds [31 x i8], [31 x i8]* %2, i64 0, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [54 x i8], [54 x i8]* %3, i64 0, i64 %25
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp ne i32 %23, %28
br i1 %29, label %30, label %33
30: ; preds = %20
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %33
33: ; preds = %30, %20
br label %34
34: ; preds = %33
%35 = load i32, i32* %6
%36 = add nsw i32 %35, 1
store i32 %36, i32* %6
br label %15
37: ; preds = %15
%38 = load i32, i32* %7
%39 = getelementptr inbounds [54 x i8], [54 x i8]* %3, i64 0, i64 0
%40 = call i32 @strlen(i8* %39)
%41 = icmp eq i32 %38, %40
br i1 %41, label %42, label %45
42: ; preds = %37
%43 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%44 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %95
45: ; preds = %37
%46 = getelementptr inbounds [54 x i8], [54 x i8]* %3, i64 0, i64 0
%47 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%48 = call i32 @strcat(i8* %46, i8* %47)
store i32 0, i32* %5
br label %49
49: ; preds = %89, %45
%50 = load i32, i32* %5
%51 = getelementptr inbounds [31 x i8], [31 x i8]* %2, i64 0, i64 0
%52 = call i32 @strlen(i8* %51)
%53 = icmp slt i32 %50, %52
br i1 %53, label %54, label %92
54: ; preds = %49
store i32 0, i32* %9
store i32 0, i32* %8
store i32 0, i32* %6
br label %55
55: ; preds = %78, %54
%56 = load i32, i32* %6
%57 = getelementptr inbounds [54 x i8], [54 x i8]* %3, i64 0, i64 0
%58 = call i32 @strlen(i8* %57)
%59 = icmp slt i32 %56, %58
br i1 %59, label %60, label %81
60: ; preds = %55
%61 = load i32, i32* %9
%62 = add nsw i32 %61, 1
store i32 %62, i32* %9
%63 = load i32, i32* %5
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds [31 x i8], [31 x i8]* %2, i64 0, i64 %64
%66 = load i8, i8* %65
%67 = sext i8 %66 to i32
%68 = load i32, i32* %6
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds [54 x i8], [54 x i8]* %3, i64 0, i64 %69
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp ne i32 %67, %72
br i1 %73, label %74, label %77
74: ; preds = %60
%75 = load i32, i32* %8
%76 = add nsw i32 %75, 1
store i32 %76, i32* %8
br label %77
77: ; preds = %74, %60
br label %78
78: ; preds = %77
%79 = load i32, i32* %6
%80 = add nsw i32 %79, 1
store i32 %80, i32* %6
br label %55
81: ; preds = %55
%82 = load i32, i32* %8
%83 = load i32, i32* %9
%84 = icmp eq i32 %82, %83
br i1 %84, label %85, label %88
85: ; preds = %81
%86 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
%87 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %95
88: ; preds = %81
br label %89
89: ; preds = %88
%90 = load i32, i32* %5
%91 = add nsw i32 %90, 1
store i32 %91, i32* %5
br label %49
92: ; preds = %49
%93 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0))
%94 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %95
95: ; preds = %92, %85, %42
%96 = load i32, i32* %1
ret i32 %96
}

LLVM IR (-O2):
@__const.main.A = [54 x i8] c"ABCDEFGHIJLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_$\00"
@__const.main.B = [11 x i8] c"1234567890\00"
@.str = [35 x i8] c"Digite o nome para uma vari\C3\A1vel: \00"
@.str.2 = [6 x i8] c"pause\00"
@str = [31 x i8] c"\0ANome de vari\C3\A1vel v\C3\A1lido!!!\0A\00"
@str.5 = [33 x i8] c"\0ANome de vari\C3\A1vel inv\C3\A1lido!!!\0A\00"
define i32 @main() {
%1 = alloca [31 x i8]
%2 = alloca [54 x i8]
%3 = alloca [11 x i8]
%4 = getelementptr inbounds [31 x i8], [31 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [54 x i8], [54 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 0
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @gets(i8* %4)
%9 = call i32 @strlen(i8* %5)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %24
11: ; preds = %0, %11
%12 = phi i64 [ %20, %11 ], [ 0, %0 ]
%13 = phi i32 [ %19, %11 ], [ 0, %0 ]
%14 = load i8, i8* %4
%15 = getelementptr inbounds [54 x i8], [54 x i8]* %2, i64 0, i64 %12
%16 = load i8, i8* %15
%17 = icmp ne i8 %14, %16
%18 = zext i1 %17 to i32
%19 = add nuw nsw i32 %13, %18
%20 = add nuw nsw i64 %12, 1
%21 = call i32 @strlen(i8* %5)
%22 = sext i32 %21 to i64
%23 = icmp slt i64 %20, %22
br i1 %23, label %11, label %24
24: ; preds = %11, %0
%25 = phi i32 [ 0, %0 ], [ %19, %11 ]
%26 = call i32 @strlen(i8* %5)
%27 = icmp eq i32 %25, %26
br i1 %27, label %59, label %28
28: ; preds = %24
%29 = call i32 @strcat(i8* %5, i8* %6)
%30 = call i32 @strlen(i8* %4)
%31 = icmp sgt i32 %30, 0
br i1 %31, label %36, label %59
32: ; preds = %55
%33 = call i32 @strlen(i8* %4)
%34 = sext i32 %33 to i64
%35 = icmp slt i64 %58, %34
br i1 %35, label %36, label %59
36: ; preds = %28, %32
%37 = phi i64 [ %58, %32 ], [ 0, %28 ]
%38 = call i32 @strlen(i8* %5)
%39 = icmp sgt i32 %38, 0
br i1 %39, label %40, label %59
40: ; preds = %36
%41 = getelementptr inbounds [31 x i8], [31 x i8]* %1, i64 0, i64 %37
br label %42
42: ; preds = %40, %42
%43 = phi i64 [ 0, %40 ], [ %45, %42 ]
%44 = phi i32 [ 0, %40 ], [ %51, %42 ]
%45 = add nuw nsw i64 %43, 1
%46 = load i8, i8* %41
%47 = getelementptr inbounds [54 x i8], [54 x i8]* %2, i64 0, i64 %43
%48 = load i8, i8* %47
%49 = icmp ne i8 %46, %48
%50 = zext i1 %49 to i32
%51 = add nuw nsw i32 %44, %50
%52 = call i32 @strlen(i8* %5)
%53 = sext i32 %52 to i64
%54 = icmp slt i64 %45, %53
br i1 %54, label %42, label %55
55: ; preds = %42
%56 = trunc i64 %45 to i32
%57 = icmp eq i32 %51, %56
%58 = add nuw nsw i64 %37, 1
br i1 %57, label %59, label %32
59: ; preds = %32, %55, %36, %28, %24
%60 = phi i8* [ getelementptr inbounds ([33 x i8], [33 x i8]* @str.5, i64 0, i64 0), %24 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0), %28 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @str.5, i64 0, i64 0), %36 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @str.5, i64 0, i64 0), %55 ], [ getelementptr inbounds ([31 x i8], [31 x i8]* @str, i64 0, i64 0), %32 ]
%61 = call i32 @puts(i8* dereferenceable(1) %60)
%62 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}