#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 */
int /*<<< orphan*/ numa_bitmask_free(struct bitmask *);
struct bitmask *numa_parse_nodestring(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ printmask(char *, struct bitmask *);
int main(int ac, char **av) {
  int err = 0;
  while (*++av) {
    struct bitmask *mask = numa_parse_nodestring(*av);
    if (!mask) {
      printf("Failed to convert `%s'\n", *av);
      err |= 1;
      continue;
    }
    printmask("result", mask);
    numa_bitmask_free(mask);
  }
  return err;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
cmpq   $0x0,0x8(%rax)
je     11d1 <main+0x91>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1040 <numa_parse_nodestring@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    11b3 <main+0x73>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe60(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115d <main+0x1d>
mov    -0x20(%rbp),%rsi
lea    0xe5a(%rip),%rdi
call   1050 <printmask@plt>
mov    -0x20(%rbp),%rdi
call   1060 <numa_bitmask_free@plt>
jmp    115d <main+0x1d>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    0x8(%rsi),%rdi
test   %rdi,%rdi
je     11ae <main+0x6e>
mov    %rsi,%rbx
add    $0x10,%rbx
xor    %r12d,%r12d
lea    0xe9e(%rip),%r14
lea    0xeaf(%rip),%r15
jmp    1192 <main+0x52>
nopl   0x0(%rax,%rax,1)
mov    %rax,%rbp
mov    %r15,%rdi
mov    %rax,%rsi
call   1050 <printmask@plt>
mov    %rbp,%rdi
call   1060 <numa_bitmask_free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
je     11b1 <main+0x71>
call   1040 <numa_parse_nodestring@plt>
test   %rax,%rax
jne    1170 <main+0x30>
mov    -0x8(%rbx),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
or     $0x1,%r12d
jmp    1186 <main+0x46>
xor    %r12d,%r12d
mov    %r12d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.bitmask = type { i32 }
@.str = [24 x i8] c"Failed to convert `%s'\0A\00"
@.str.1 = [7 x i8] c"result\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.bitmask*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
br label %8
8: ; preds = %25, %19, %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i32 1
store i8** %10, i8*** %5
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %30
13: ; preds = %8
%14 = load i8**, i8*** %5
%15 = load i8*, i8** %14
%16 = call %struct.bitmask* @numa_parse_nodestring(i8* %15)
store %struct.bitmask* %16, %struct.bitmask** %7
%17 = load %struct.bitmask*, %struct.bitmask** %7
%18 = icmp ne %struct.bitmask* %17, null
br i1 %18, label %25, label %19
19: ; preds = %13
%20 = load i8**, i8*** %5
%21 = load i8*, i8** %20
%22 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = load i32, i32* %6
%24 = or i32 %23, 1
store i32 %24, i32* %6
br label %8
25: ; preds = %13
%26 = load %struct.bitmask*, %struct.bitmask** %7
%27 = call i32 @printmask(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), %struct.bitmask* %26)
%28 = load %struct.bitmask*, %struct.bitmask** %7
%29 = call i32 @numa_bitmask_free(%struct.bitmask* %28)
br label %8
30: ; preds = %8
%31 = load i32, i32* %6
ret i32 %31
}

LLVM IR (-O2):
%struct.bitmask = type { i32 }
@.str = [24 x i8] c"Failed to convert `%s'\0A\00"
@.str.1 = [7 x i8] c"result\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %24, label %6
6: ; preds = %2, %19
%7 = phi i8* [ %22, %19 ], [ %4, %2 ]
%8 = phi i8** [ %21, %19 ], [ %3, %2 ]
%9 = phi i32 [ %20, %19 ], [ 0, %2 ]
%10 = tail call %struct.bitmask* @numa_parse_nodestring(i8* %7)
%11 = icmp eq %struct.bitmask* %10, null
br i1 %11, label %12, label %16
12: ; preds = %6
%13 = load i8*, i8** %8
%14 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = or i32 %9, 1
br label %19
16: ; preds = %6
%17 = tail call i32 @printmask(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), %struct.bitmask* %10)
%18 = tail call i32 @numa_bitmask_free(%struct.bitmask* %10)
br label %19
19: ; preds = %16, %12
%20 = phi i32 [ %9, %16 ], [ %15, %12 ]
%21 = getelementptr inbounds i8*, i8** %8, i64 1
%22 = load i8*, i8** %21
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %6
24: ; preds = %19, %2
%25 = phi i32 [ 0, %2 ], [ %20, %19 ]
ret i32 %25
}