#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int getNodeName(FILE *inputDB, char node[]) {
  int i = 0;
  int error = 0;
  char tmpChar;
  do {
    if (i > 32 - 2) {
      printf("To long node name or some file errors\n");
      error = 1;
      while (tmpChar != ' ') {
        tmpChar = fgetc(inputDB);
      }
    } else
      node[i] = fgetc(inputDB);
    i++;
  } while (node[i - 1] != ' ' && node[i - 1] != '\n' && !error);
  node[i - 1] = '\0';
  return error;
}


x86 assembly (clang, -O0):
<getNodeName>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x1e,-0x14(%rbp)
jle    117e <getNodeName+0x5e>
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x18(%rbp)
movsbl -0x19(%rbp),%eax
cmp    $0x20,%eax
je     1179 <getNodeName+0x59>
mov    -0x8(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,-0x19(%rbp)
jmp    115b <getNodeName+0x3b>
jmp    1194 <getNodeName+0x74>
mov    -0x8(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x1a(%rbp)
je     11e7 <getNodeName+0xc7>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x1a(%rbp)
je     11e7 <getNodeName+0xc7>
cmpl   $0x0,-0x18(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    113e <getNodeName+0x1e>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getNodeName>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
lea    0xec6(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %rax,%rbp
cmp    $0x1f,%rax
jb     1180 <getNodeName+0x60>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    $0x1,%r12d
cmp    $0x20,%r13b
je     116c <getNodeName+0x4c>
nopl   (%rax)
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    $0x20,%al
jne    1160 <getNodeName+0x40>
mov    $0x20,%r13b
jmp    118f <getNodeName+0x6f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <fgetc@plt>
mov    %al,(%r14,%rbp,1)
xor    %r12d,%r12d
mov    (%r14,%rbp,1),%al
cmp    $0xa,%al
je     11a5 <getNodeName+0x85>
cmp    $0x20,%al
je     11a5 <getNodeName+0x85>
lea    0x1(%rbp),%rax
cmp    $0x20,%rax
jne    1140 <getNodeName+0x20>
mov    %ebp,%eax
movb   $0x0,(%r14,%rax,1)
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [39 x i8] c"To long node name or some file errors\0A\00"
define i32 @getNodeName(i32* %0, i8* %1) {
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8
store i32* %0, i32** %3
store i8* %1, i8** %4
store i32 0, i32* %5
store i32 0, i32* %6
br label %8
8: ; preds = %53, %2
%9 = load i32, i32* %5
%10 = icmp sgt i32 %9, 30
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %6
br label %13
13: ; preds = %17, %11
%14 = load i8, i8* %7
%15 = sext i8 %14 to i32
%16 = icmp ne i32 %15, 32
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i32*, i32** %3
%19 = call signext i8 @fgetc(i32* %18)
store i8 %19, i8* %7
br label %13
20: ; preds = %13
br label %28
21: ; preds = %8
%22 = load i32*, i32** %3
%23 = call signext i8 @fgetc(i32* %22)
%24 = load i8*, i8** %4
%25 = load i32, i32* %5
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
store i8 %23, i8* %27
br label %28
28: ; preds = %21, %20
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %31
31: ; preds = %28
%32 = load i8*, i8** %4
%33 = load i32, i32* %5
%34 = sub nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %32, i64 %35
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp ne i32 %38, 32
br i1 %39, label %40, label %53
40: ; preds = %31
%41 = load i8*, i8** %4
%42 = load i32, i32* %5
%43 = sub nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %41, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %47, 10
br i1 %48, label %49, label %53
49: ; preds = %40
%50 = load i32, i32* %6
%51 = icmp ne i32 %50, 0
%52 = xor i1 %51, true
br label %53
53: ; preds = %49, %40, %31
%54 = phi i1 [ false, %40 ], [ false, %31 ], [ %52, %49 ]
br i1 %54, label %8, label %55
55: ; preds = %53
%56 = load i8*, i8** %4
%57 = load i32, i32* %5
%58 = sub nsw i32 %57, 1
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %56, i64 %59
store i8 0, i8* %60
%61 = load i32, i32* %6
ret i32 %61
}

LLVM IR (-O2):
@str = [38 x i8] c"To long node name or some file errors\00"
define i32 @getNodeName(i32* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %21, %2
%4 = phi i64 [ %22, %21 ], [ 0, %2 ]
%5 = phi i8 [ %18, %21 ], [ undef, %2 ]
%6 = icmp ugt i64 %4, 30
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%9 = icmp eq i8 %5, 32
br i1 %9, label %16, label %10
10: ; preds = %7, %10
%11 = tail call signext i8 @fgetc(i32* %0)
%12 = icmp eq i8 %11, 32
br i1 %12, label %16, label %10
13: ; preds = %3
%14 = tail call signext i8 @fgetc(i32* %0)
%15 = getelementptr inbounds i8, i8* %1, i64 %4
store i8 %14, i8* %15
br label %16
16: ; preds = %10, %7, %13
%17 = phi i32 [ 0, %13 ], [ 1, %7 ], [ 1, %10 ]
%18 = phi i8 [ %5, %13 ], [ 32, %7 ], [ 32, %10 ]
%19 = getelementptr inbounds i8, i8* %1, i64 %4
%20 = load i8, i8* %19
switch i8 %20, label %21 [
i8 32, label %24
i8 10, label %24
]
21: ; preds = %16
%22 = add nuw nsw i64 %4, 1
%23 = icmp eq i64 %22, 32
br i1 %23, label %24, label %3
24: ; preds = %16, %16, %21
%25 = and i64 %4, 4294967295
%26 = getelementptr inbounds i8, i8* %1, i64 %25
store i8 0, i8* %26
ret i32 %17
}