#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);
int /*<<< orphan*/ *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;
  char *prev;
  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 (NULL == fp) {
    perror(argv[argc - 1]);
    exit(1);
  }
  while (NULL != 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));
    while (102 != gettoken(&tmp, token)) {
      prev = tmp;
    }
    *prev = '\0';
    for (i = 1; i < argc - 1; ++i) {
      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    $0x1440,%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     13de <main+0x23e>
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    $0x66,%eax
cmp    %ecx,%eax
je     1334 <main+0x194>
mov    -0x1428(%rbp),%rax
mov    %rax,-0x1430(%rbp)
jmp    12ff <main+0x15f>
mov    -0x1430(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x1,-0x1434(%rbp)
mov    -0x1434(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    13b1 <main+0x211>
lea    -0x1020(%rbp),%rdi
lea    0xcf7(%rip),%rsi
call   10b0 <strcat@plt>
lea    -0x1020(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x1434(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   10b0 <strcat@plt>
lea    -0x1020(%rbp),%rdi
lea    0xccb(%rip),%rsi
call   10b0 <strcat@plt>
mov    -0x1434(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1434(%rbp)
jmp    1348 <main+0x1a8>
lea    -0x1020(%rbp),%rdi
lea    0xca6(%rip),%rsi
call   10b0 <strcat@plt>
lea    -0x1020(%rbp),%rdi
mov    0x2c0e(%rip),%rax
mov    (%rax),%esi
call   1050 <fputs@plt>
jmp    1236 <main+0x96>
xor    %eax,%eax
add    $0x1440,%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    1364 <main+0x1c4>
mov    %edi,%r13d
add    $0xffffffff,%r13d
mov    %rsi,0x8(%rsp)
mov    (%rsi,%r13,8),%rdi
lea    0xe78(%rip),%rsi
call   1090 <fopen@plt>
test   %rax,%rax
je     1381 <main+0x1e1>
mov    %rax,%r14
lea    0x420(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    %rax,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1350 <main+0x1b0>
mov    %rsp,%r15
lea    0x20(%rsp),%r12
jmp    123a <main+0x9a>
nopl   (%rax)
mov    0x2dc9(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <fputs@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    %r14,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     1350 <main+0x1b0>
mov    %rbx,(%rsp)
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <gettoken@plt>
lea    0xdfb(%rip),%rdi
mov    %r12,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1210 <main+0x70>
lea    0xdf2(%rip),%rdi
mov    %r12,%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    1210 <main+0x70>
mov    %r13,0x18(%rsp)
mov    0x8(%rsp),%r13
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <gettoken@plt>
xor    %edi,%edi
cmp    $0x64,%eax
sete   %dil
call   1080 <assert@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <gettoken@plt>
cmp    $0x66,%eax
mov    0x10(%rsp),%rbp
je     12c4 <main+0x124>
nopl   0x0(%rax)
mov    (%rsp),%rbp
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <gettoken@plt>
cmp    $0x66,%eax
jne    12b0 <main+0x110>
mov    %rbp,0x10(%rsp)
movb   $0x0,0x0(%rbp)
mov    $0x1,%r15d
mov    %r13,%rbp
mov    0x18(%rsp),%r13
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
lea    0xd77(%rip),%rsi
call   10b0 <strcat@plt>
mov    0x0(%rbp,%r15,8),%rsi
mov    %rbx,%rdi
call   10b0 <strcat@plt>
mov    %rbx,%rdi
lea    0xd5d(%rip),%rsi
call   10b0 <strcat@plt>
add    $0x1,%r15
cmp    %r15,%r13
jne    12e0 <main+0x140>
mov    %rbx,%rdi
lea    0xd47(%rip),%rsi
call   10b0 <strcat@plt>
mov    0x2cb6(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1050 <fputs@plt>
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    %r14,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
mov    %rsp,%r15
jne    123a <main+0x9a>
xor    %eax,%eax
add    $0x1428,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc95(%rip),%rdi
lea    0xc92(%rip),%rsi
call   1040 <printf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x8(%rsp),%rax
mov    (%rax,%r13,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 = [4 x i8] c", \22\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 i8*
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = load i32, i32* %4
%13 = icmp sgt i32 3, %12
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = 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))
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i8**, i8*** %5
%19 = load i32, i32* %4
%20 = sub nsw i32 %19, 1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %18, i64 %21
%23 = load i8*, i8** %22
%24 = call i32* @fopen(i8* %23, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %24, i32** %6
%25 = load i32*, i32** %6
%26 = icmp eq i32* null, %25
br i1 %26, label %27, label %36
27: ; preds = %17
%28 = load i8**, i8*** %5
%29 = load i32, i32* %4
%30 = sub nsw i32 %29, 1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %28, i64 %31
%33 = load i8*, i8** %32
%34 = call i32 @perror(i8* %33)
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %17
br label %37
37: ; preds = %91, %53, %36
%38 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%39 = load i32*, i32** %6
%40 = call i32* @fgets(i8* %38, i32 4096, i32* %39)
%41 = icmp ne i32* null, %40
br i1 %41, label %42, label %97
42: ; preds = %37
%43 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
store i8* %43, i8** %9
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%45 = call i32 @gettoken(i8** %9, i8* %44)
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%47 = call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %46)
%48 = icmp ne i64 0, %47
br i1 %48, label %53, label %49
49: ; preds = %42
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%51 = call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %50)
%52 = icmp ne i64 0, %51
br i1 %52, label %53, label %57
53: ; preds = %49, %42
%54 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%55 = load i32, i32* @stdout
%56 = call i32 @fputs(i8* %54, i32 %55)
br label %37
57: ; preds = %49
%58 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%59 = call i32 @gettoken(i8** %9, i8* %58)
%60 = icmp eq i32 100, %59
%61 = zext i1 %60 to i32
%62 = call i32 @assert(i32 %61)
br label %63
63: ; preds = %67, %57
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%65 = call i32 @gettoken(i8** %9, i8* %64)
%66 = icmp ne i32 102, %65
br i1 %66, label %67, label %69
67: ; preds = %63
%68 = load i8*, i8** %9
store i8* %68, i8** %10
br label %63
69: ; preds = %63
%70 = load i8*, i8** %10
store i8 0, i8* %70
store i32 1, i32* %11
br label %71
71: ; preds = %88, %69
%72 = load i32, i32* %11
%73 = load i32, i32* %4
%74 = sub nsw i32 %73, 1
%75 = icmp slt i32 %72, %74
br i1 %75, label %76, label %91
76: ; preds = %71
%77 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%78 = call i32 @strcat(i8* %77, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%79 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%80 = load i8**, i8*** %5
%81 = load i32, i32* %11
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds i8*, i8** %80, i64 %82
%84 = load i8*, i8** %83
%85 = call i32 @strcat(i8* %79, i8* %84)
%86 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%87 = call i32 @strcat(i8* %86, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %88
88: ; preds = %76
%89 = load i32, i32* %11
%90 = add nsw i32 %89, 1
store i32 %90, i32* %11
br label %71
91: ; preds = %71
%92 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%93 = call i32 @strcat(i8* %92, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%94 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%95 = load i32, i32* @stdout
%96 = call i32 @fputs(i8* %94, i32 %95)
br label %37
97: ; preds = %37
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 = [4 x i8] c", \22\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 %23, label %20
20: ; preds = %13
%21 = call i32* @fgets(i8* %6, i32 4096, i32* %18)
%22 = icmp eq i32* %21, null
br i1 %22, label %69, label %67
23: ; preds = %13
%24 = load i8*, i8** %16
%25 = tail call i32 @perror(i8* %24)
%26 = tail call i32 @exit(i32 1)
unreachable
27: ; preds = %67, %34
store i8* %6, i8** %5
%28 = call i32 @gettoken(i8** %5, i8* %7)
%29 = call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = call i64 @strcmp(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%33 = icmp eq i64 %32, 0
br i1 %33, label %39, label %34
34: ; preds = %31, %27
%35 = load i32, i32* @stdout
%36 = call i32 @fputs(i8* %6, i32 %35)
%37 = call i32* @fgets(i8* %6, i32 4096, i32* %18)
%38 = icmp eq i32* %37, null
br i1 %38, label %69, label %27
39: ; preds = %31
%40 = call i32 @gettoken(i8** %5, i8* %7)
%41 = icmp eq i32 %40, 100
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
%44 = call i32 @gettoken(i8** %5, i8* %7)
%45 = icmp eq i32 %44, 102
br i1 %45, label %50, label %46
46: ; preds = %39, %46
%47 = load i8*, i8** %5
%48 = call i32 @gettoken(i8** %5, i8* %7)
%49 = icmp eq i32 %48, 102
br i1 %49, label %50, label %46
50: ; preds = %46, %39
%51 = phi i8* [ %68, %39 ], [ %47, %46 ]
store i8 0, i8* %51
br label %52
52: ; preds = %50, %52
%53 = phi i64 [ 1, %50 ], [ %59, %52 ]
%54 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%55 = getelementptr inbounds i8*, i8** %1, i64 %53
%56 = load i8*, i8** %55
%57 = call i32 @strcat(i8* %6, i8* %56)
%58 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%59 = add nuw nsw i64 %53, 1
%60 = icmp eq i64 %59, %15
br i1 %60, label %61, label %52
61: ; preds = %52
%62 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%63 = load i32, i32* @stdout
%64 = call i32 @fputs(i8* %6, i32 %63)
%65 = call i32* @fgets(i8* %6, i32 4096, i32* %18)
%66 = icmp eq i32* %65, null
br i1 %66, label %69, label %67
67: ; preds = %20, %61
%68 = phi i8* [ %51, %61 ], [ undef, %20 ]
br label %27
69: ; preds = %61, %34, %20
ret i32 0
}