#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 */
struct bitmask {
  int dummy;
};

/* Variables and functions */
struct bitmask *numa_parse_nodestring(char *);
struct bitmask *numa_parse_nodestring_all(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ usage_msg(char *);
struct bitmask *numactl_parse_nodestring(char *s, int flag) {
  static char *last;
  if (s[0] == 's' && !strcmp(s, "same")) {
    if (!last)
      usage_msg("same needs previous node specification");
    s = last;
  } else {
    last = s;
  }
  if (flag == 1)
    return numa_parse_nodestring_all(s);
  else
    return numa_parse_nodestring(s);
}


x86 assembly (clang, -O0):
<numactl_parse_nodestring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x73,%eax
jne    11a2 <numactl_parse_nodestring+0x62>
mov    -0x10(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11a2 <numactl_parse_nodestring+0x62>
cmpq   $0x0,0x2ec8(%rip)
jne    1192 <numactl_parse_nodestring+0x52>
lea    0xe78(%rip),%rdi
call   1060 <usage_msg@plt>
mov    0x2eaf(%rip),%rax
mov    %rax,-0x10(%rbp)
jmp    11ad <numactl_parse_nodestring+0x6d>
mov    -0x10(%rbp),%rax
mov    %rax,0x2e9b(%rip)
cmpl   $0x1,-0x14(%rbp)
jne    11c9 <numactl_parse_nodestring+0x89>
mov    -0x10(%rbp),%rdi
call   1040 <numa_parse_nodestring_all@plt>
mov    %rax,-0x8(%rbp)
jmp    11d6 <numactl_parse_nodestring+0x96>
mov    -0x10(%rbp),%rdi
call   1050 <numa_parse_nodestring@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numactl_parse_nodestring>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
cmpb   $0x73,(%rdi)
jne    1160 <numactl_parse_nodestring+0x20>
lea    0xeac(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1181 <numactl_parse_nodestring+0x41>
mov    %rbx,0x2ee1(%rip)
mov    %rbx,%rdi
add    $0x8,%rsp
cmp    $0x1,%ebp
jne    117a <numactl_parse_nodestring+0x3a>
pop    %rbx
pop    %rbp
jmp    1040 <numa_parse_nodestring_all@plt>
pop    %rbx
pop    %rbp
jmp    1050 <numa_parse_nodestring@plt>
mov    0x2ec0(%rip),%rbx
test   %rbx,%rbx
jne    1167 <numactl_parse_nodestring+0x27>
lea    0xe71(%rip),%rdi
call   1060 <usage_msg@plt>
mov    0x2ea8(%rip),%rbx
jmp    1167 <numactl_parse_nodestring+0x27>

LLVM IR (-O0):
%struct.bitmask = type { i32 }
@numactl_parse_nodestring.last = internal global i8* null
@.str = [5 x i8] c"same\00"
@.str.1 = [39 x i8] c"same needs previous node specification\00"
define %struct.bitmask* @numactl_parse_nodestring(i8* %0, i32 %1) {
%3 = alloca %struct.bitmask*
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 115
br i1 %10, label %11, label %22
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %22, label %15
15: ; preds = %11
%16 = load i8*, i8** @numactl_parse_nodestring.last
%17 = icmp ne i8* %16, null
br i1 %17, label %20, label %18
18: ; preds = %15
%19 = call i32 @usage_msg(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
br label %20
20: ; preds = %18, %15
%21 = load i8*, i8** @numactl_parse_nodestring.last
store i8* %21, i8** %4
br label %24
22: ; preds = %11, %2
%23 = load i8*, i8** %4
store i8* %23, i8** @numactl_parse_nodestring.last
br label %24
24: ; preds = %22, %20
%25 = load i32, i32* %5
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i8*, i8** %4
%29 = call %struct.bitmask* @numa_parse_nodestring_all(i8* %28)
store %struct.bitmask* %29, %struct.bitmask** %3
br label %33
30: ; preds = %24
%31 = load i8*, i8** %4
%32 = call %struct.bitmask* @numa_parse_nodestring(i8* %31)
store %struct.bitmask* %32, %struct.bitmask** %3
br label %33
33: ; preds = %30, %27
%34 = load %struct.bitmask*, %struct.bitmask** %3
ret %struct.bitmask* %34
}

LLVM IR (-O2):
%struct.bitmask = type { i32 }
@numactl_parse_nodestring.last = internal unnamed_addr global i8* null
@.str = [5 x i8] c"same\00"
@.str.1 = [39 x i8] c"same needs previous node specification\00"
define %struct.bitmask* @numactl_parse_nodestring(i8* %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 115
br i1 %4, label %5, label %14
5: ; preds = %2
%6 = tail call i32 @strcmp(i8* %0, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %5
%9 = load i8*, i8** @numactl_parse_nodestring.last
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = tail call i32 @usage_msg(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
%13 = load i8*, i8** @numactl_parse_nodestring.last
br label %15
14: ; preds = %5, %2
store i8* %0, i8** @numactl_parse_nodestring.last
br label %15
15: ; preds = %8, %11, %14
%16 = phi i8* [ %0, %14 ], [ %13, %11 ], [ %9, %8 ]
%17 = icmp eq i32 %1, 1
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call %struct.bitmask* @numa_parse_nodestring_all(i8* %16)
br label %22
20: ; preds = %15
%21 = tail call %struct.bitmask* @numa_parse_nodestring(i8* %16)
br label %22
22: ; preds = %20, %18
%23 = phi %struct.bitmask* [ %19, %18 ], [ %21, %20 ]
ret %struct.bitmask* %23
}