#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 */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ exit(int);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int gettoken(char **, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  FILE *fp;
  char buff[4096];
  char token[1024];
  char *tmp;
  int i;
  if (3 > argc) {
    printf("%s\n", "Usage: AppendeNs <additional-namespace-name> [ ... ] "
                   "<mof-file-name>");
    exit(1);
  }
  fp = fopen(argv[argc - 1], "r");
  if (0 == fp) {
    perror(argv[argc - 1]);
    exit(1);
  }
  while (0 != fgets(buff, 4096, fp)) {
    tmp = buff;
    gettoken(&tmp, token);
    if (0 != strcmp("Namespaces", token) || 0 != strcmp("namespaces", token)) {
      fputs(buff, stdout);
      continue;
    }
    assert(100 == gettoken(&tmp, token));
    assert(101 == gettoken(&tmp, token));
    *tmp = '\0';
    for (i = 1; i < argc - 1; ++i) {
      if (1 != i) {
        strcat(buff, ", ");
      }
      strcat(buff, "\"");
      strcat(buff, argv[i]);
      strcat(buff, "\"");
    }
    strcat(buff, " };\n");
    fputs(buff, stdout);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1430,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x3,%eax
cmp    -0x8(%rbp),%eax
jle    11e4 <main+0x44>
lea    0xe32(%rip),%rdi
lea    0xe2f(%rip),%rsi
call   1040 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe4d(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x18(%rbp),%rax
jne    1231 <main+0x91>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
jmp    1236 <main+0x96>
lea    -0x1020(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x1000,%esi
call   1060 <fgets@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     13f6 <main+0x256>
lea    -0x1020(%rbp),%rax
mov    %rax,-0x1428(%rbp)
lea    -0x1420(%rbp),%rsi
lea    -0x1428(%rbp),%rdi
call   1030 <gettoken@plt>
lea    -0x1420(%rbp),%rsi
lea    0xdc3(%rip),%rdi
call   1070 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    12bc <main+0x11c>
lea    -0x1420(%rbp),%rsi
lea    0xdad(%rip),%rdi
call   1070 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     12d6 <main+0x136>
lea    -0x1020(%rbp),%rdi
mov    0x2d16(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
jmp    1236 <main+0x96>
lea    -0x1420(%rbp),%rsi
lea    -0x1428(%rbp),%rdi
call   1030 <gettoken@plt>
mov    %eax,%ecx
mov    $0x64,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
lea    -0x1420(%rbp),%rsi
lea    -0x1428(%rbp),%rdi
call   1030 <gettoken@plt>
mov    %eax,%ecx
mov    $0x65,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1080 <assert@plt>
mov    -0x1428(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x1,-0x142c(%rbp)
mov    -0x142c(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    13c9 <main+0x229>
mov    $0x1,%eax
cmp    -0x142c(%rbp),%eax
je     1374 <main+0x1d4>
lea    -0x1020(%rbp),%rdi
lea    0xcf2(%rip),%rsi
call   10b0 <strcat@plt>
lea    -0x1020(%rbp),%rdi
lea    0xce2(%rip),%rsi
call   10b0 <strcat@plt>
lea    -0x1020(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x142c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   10b0 <strcat@plt>
lea    -0x1020(%rbp),%rdi
lea    0xcb4(%rip),%rsi
call   10b0 <strcat@plt>
mov    -0x142c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x142c(%rbp)
jmp    133c <main+0x19c>
lea    -0x1020(%rbp),%rdi
lea    0xc8f(%rip),%rsi
call   10b0 <strcat@plt>
lea    -0x1020(%rbp),%rdi
mov    0x2bf6(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
jmp    1236 <main+0x96>
xor    %eax,%eax
add    $0x1430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1428,%rsp
cmp    $0x2,%edi
jle    137f <main+0x1df>
add    $0xffffffff,%edi
mov    %rsi,0x10(%rsp)
mov    %rdi,0x8(%rsp)
mov    (%rsi,%rdi,8),%rdi
lea    0xe77(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     139c <main+0x1fc>
mov    %rax,%r13
lea    0x420(%rsp),%r12
mov    %r12,%rdi
mov    $0x1000,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     136b <main+0x1cb>
mov    %rsp,%r15
lea    0xe3d(%rip),%rbx
lea    0xe4f(%rip),%rbp
mov    %r13,0x18(%rsp)
jmp    126a <main+0xca>
mov    %r12,%rdi
lea    0xe40(%rip),%rsi
call   10b0 <strcat@plt>
mov    0x18(%rsp),%r13
mov    %rsp,%r15
lea    0xe11(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    0x2d99(%rip),%rax
mov    (%rax),%esi
mov    %r12,%rdi
call   1050 <fputs@plt>
mov    %r12,%rdi
mov    $0x1000,%esi
mov    %r13,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     136b <main+0x1cb>
mov    %r12,(%rsp)
mov    %r15,%rdi
lea    0x20(%rsp),%r14
mov    %r14,%rsi
call   1030 <gettoken@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1240 <main+0xa0>
lea    0xdc1(%rip),%rdi
lea    0x20(%rsp),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1240 <main+0xa0>
mov    %r15,%rdi
lea    0x20(%rsp),%r14
mov    %r14,%rsi
call   1030 <gettoken@plt>
xor    %edi,%edi
cmp    $0x64,%eax
sete   %dil
call   1080 <assert@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <gettoken@plt>
xor    %edi,%edi
cmp    $0x65,%eax
sete   %dil
call   1080 <assert@plt>
mov    (%rsp),%rax
movb   $0x0,(%rax)
mov    %r12,%rdi
mov    %rbp,%rsi
call   10b0 <strcat@plt>
mov    0x10(%rsp),%r14
mov    0x8(%r14),%rsi
mov    %r12,%rdi
call   10b0 <strcat@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   10b0 <strcat@plt>
mov    0x8(%rsp),%rbx
cmp    $0x2,%ebx
lea    0xd49(%rip),%r13
je     121c <main+0x7c>
mov    $0x2,%r15d
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
mov    %r13,%rsi
call   10b0 <strcat@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   10b0 <strcat@plt>
mov    (%r14,%r15,8),%rsi
mov    %r12,%rdi
call   10b0 <strcat@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   10b0 <strcat@plt>
add    $0x1,%r15
cmp    %r15,%rbx
jne    1330 <main+0x190>
jmp    121c <main+0x7c>
xor    %eax,%eax
add    $0x1428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc7a(%rip),%rdi
lea    0xc77(%rip),%rsi
call   1040 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x10(%rsp),%rax
mov    0x8(%rsp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [69 x i8] c"Usage: AppendeNs <additional-namespace-name> [ ... ] <mof-file-name>\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [11 x i8] c"Namespaces\00"
@.str.4 = [11 x i8] c"namespaces\00"
@stdout = global i32 0
@.str.5 = [3 x i8] c", \00"
@.str.6 = [2 x i8] c"\22\00"
@.str.7 = [5 x i8] c" };\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca [4096 x i8]
%8 = alloca [1024 x i8]
%9 = alloca i8*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp sgt i32 3, %11
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = load i32, i32* %4
%19 = sub nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %17, i64 %20
%22 = load i8*, i8** %21
%23 = call i32* @fopen(i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %23, i32** %6
%24 = load i32*, i32** %6
%25 = icmp eq i32* null, %24
br i1 %25, label %26, label %35
26: ; preds = %16
%27 = load i8**, i8*** %5
%28 = load i32, i32* %4
%29 = sub nsw i32 %28, 1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8*, i8** %27, i64 %30
%32 = load i8*, i8** %31
%33 = call i32 @perror(i8* %32)
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %16
br label %36
36: ; preds = %94, %52, %35
%37 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%38 = load i32*, i32** %6
%39 = call i64 @fgets(i8* %37, i32 4096, i32* %38)
%40 = icmp ne i64 0, %39
br i1 %40, label %41, label %100
41: ; preds = %36
%42 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
store i8* %42, i8** %9
%43 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%44 = call i32 @gettoken(i8** %9, i8* %43)
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%46 = call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %45)
%47 = icmp ne i64 0, %46
br i1 %47, label %52, label %48
48: ; preds = %41
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%50 = call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %49)
%51 = icmp ne i64 0, %50
br i1 %51, label %52, label %56
52: ; preds = %48, %41
%53 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%54 = load i32, i32* @stdout
%55 = call i32 @fputs(i8* %53, i32 %54)
br label %36
56: ; preds = %48
%57 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%58 = call i32 @gettoken(i8** %9, i8* %57)
%59 = icmp eq i32 100, %58
%60 = zext i1 %59 to i32
%61 = call i32 @assert(i32 %60)
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%63 = call i32 @gettoken(i8** %9, i8* %62)
%64 = icmp eq i32 101, %63
%65 = zext i1 %64 to i32
%66 = call i32 @assert(i32 %65)
%67 = load i8*, i8** %9
store i8 0, i8* %67
store i32 1, i32* %10
br label %68
68: ; preds = %91, %56
%69 = load i32, i32* %10
%70 = load i32, i32* %4
%71 = sub nsw i32 %70, 1
%72 = icmp slt i32 %69, %71
br i1 %72, label %73, label %94
73: ; preds = %68
%74 = load i32, i32* %10
%75 = icmp ne i32 1, %74
br i1 %75, label %76, label %79
76: ; preds = %73
%77 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%78 = call i32 @strcat(i8* %77, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %79
79: ; preds = %76, %73
%80 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%81 = call i32 @strcat(i8* %80, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%82 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%83 = load i8**, i8*** %5
%84 = load i32, i32* %10
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8*, i8** %83, i64 %85
%87 = load i8*, i8** %86
%88 = call i32 @strcat(i8* %82, i8* %87)
%89 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%90 = call i32 @strcat(i8* %89, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %91
91: ; preds = %79
%92 = load i32, i32* %10
%93 = add nsw i32 %92, 1
store i32 %93, i32* %10
br label %68
94: ; preds = %68
%95 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%96 = call i32 @strcat(i8* %95, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%97 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%98 = load i32, i32* @stdout
%99 = call i32 @fputs(i8* %97, i32 %98)
br label %36
100: ; preds = %36
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [69 x i8] c"Usage: AppendeNs <additional-namespace-name> [ ... ] <mof-file-name>\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [11 x i8] c"Namespaces\00"
@.str.4 = [11 x i8] c"namespaces\00"
@stdout = global i32 0
@.str.5 = [3 x i8] c", \00"
@.str.6 = [2 x i8] c"\22\00"
@.str.7 = [5 x i8] c" };\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = alloca [1024 x i8]
%5 = alloca i8*
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%8 = bitcast i8** %5 to i8*
%9 = icmp slt i32 %0, 3
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = add nsw i32 %0, -1
%15 = zext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %1, i64 %15
%17 = load i8*, i8** %16
%18 = tail call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %26, label %20
20: ; preds = %13
%21 = call i64 @fgets(i8* %6, i32 4096, i32* %18)
%22 = icmp eq i64 %21, 0
br i1 %22, label %68, label %23
23: ; preds = %20
%24 = getelementptr inbounds i8*, i8** %1, i64 1
%25 = icmp eq i32 %14, 2
br label %30
26: ; preds = %13
%27 = load i8*, i8** %16
%28 = tail call i32 @perror(i8* %27)
%29 = tail call i32 @exit(i32 1)
unreachable
30: ; preds = %23, %37
store i8* %6, i8** %5
%31 = call i32 @gettoken(i8** %5, i8* %7)
%32 = call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %37
34: ; preds = %30
%35 = call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%36 = icmp eq i64 %35, 0
br i1 %36, label %42, label %37
37: ; preds = %30, %34, %66
%38 = load i32, i32* @stdout
%39 = call i32 @fputs(i8* %6, i32 %38)
%40 = call i64 @fgets(i8* %6, i32 4096, i32* %18)
%41 = icmp eq i64 %40, 0
br i1 %41, label %68, label %30
42: ; preds = %34
%43 = call i32 @gettoken(i8** %5, i8* %7)
%44 = icmp eq i32 %43, 100
%45 = zext i1 %44 to i32
%46 = call i32 @assert(i32 %45)
%47 = call i32 @gettoken(i8** %5, i8* %7)
%48 = icmp eq i32 %47, 101
%49 = zext i1 %48 to i32
%50 = call i32 @assert(i32 %49)
%51 = load i8*, i8** %5
store i8 0, i8* %51
%52 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%53 = load i8*, i8** %24
%54 = call i32 @strcat(i8* %6, i8* %53)
%55 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br i1 %25, label %66, label %56
56: ; preds = %42, %56
%57 = phi i64 [ %64, %56 ], [ 2, %42 ]
%58 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%59 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%60 = getelementptr inbounds i8*, i8** %1, i64 %57
%61 = load i8*, i8** %60
%62 = call i32 @strcat(i8* %6, i8* %61)
%63 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%64 = add nuw nsw i64 %57, 1
%65 = icmp eq i64 %64, %15
br i1 %65, label %66, label %56
66: ; preds = %56, %42
%67 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %37
68: ; preds = %37, %20
ret i32 0
}