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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
char *getenv(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ strcat(char *, char *);
int main(int argc, char *argv[]) {
  char help[] = "Usage: nodes cluster [[-exclude] ...]\n"
                "-xa, would remove any line matching this litteral (xa,)";
  if (argc == 1)
    puts(help);
  for (int i = 1; i < argc; i++) {
    if (argv[i][0] == '-')
      puts(argv[i]);
  }
  char *config = getenv("XDG_CONFIG_HOME");
  strcat(config, "/clustershell/groups.d/cluster.yaml");
  FILE *clusters = fopen(config, "r");
  char buff[255];
  while (fgets(buff, sizeof(buff), clusters)) {
    printf("%s", buff);
  }
  fclose(clusters);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xe5c(%rip),%rsi
mov    $0x5e,%edx
call   1080 <memcpy@plt>
cmpl   $0x1,-0x8(%rbp)
jne    11c1 <main+0x41>
lea    -0x70(%rbp),%rdi
call   1040 <puts@plt>
movl   $0x1,-0x74(%rbp)
mov    -0x74(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1210 <main+0x90>
mov    -0x10(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11fd <main+0x7d>
mov    -0x10(%rbp),%rax
movslq -0x74(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <puts@plt>
jmp    1202 <main+0x82>
mov    -0x74(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x74(%rbp)
jmp    11c8 <main+0x48>
lea    0xe47(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x80(%rbp)
mov    -0x80(%rbp),%rdi
lea    0xe43(%rip),%rsi
call   10a0 <strcat@plt>
mov    -0x80(%rbp),%rdi
lea    0xe57(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x88(%rbp)
lea    -0x190(%rbp),%rdi
mov    -0x88(%rbp),%rdx
mov    $0xff,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     1281 <main+0x101>
lea    -0x190(%rbp),%rsi
lea    0xe1d(%rip),%rdi
call   1060 <printf@plt>
jmp    1247 <main+0xc7>
mov    -0x88(%rbp),%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x160,%rsp
movups 0xecb(%rip),%xmm0
movups %xmm0,0x4e(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xe95(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xe79(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xe5d(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xe41(%rip),%xmm0
movaps %xmm0,(%rsp)
cmp    $0x1,%edi
jne    11d2 <main+0x62>
mov    %rsp,%rdi
call   1040 <puts@plt>
jmp    1209 <main+0x99>
jle    1209 <main+0x99>
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x1,%ebx
jmp    11f9 <main+0x89>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r15
je     1209 <main+0x99>
mov    (%r14,%rbx,8),%rdi
cmpb   $0x2d,(%rdi)
jne    11f0 <main+0x80>
call   1040 <puts@plt>
jmp    11f0 <main+0x80>
lea    0xe4e(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1090 <strcat@plt>
lea    0xe64(%rip),%rsi
mov    %rbx,%rdi
call   1080 <fopen@plt>
mov    %rax,%r15
lea    0x60(%rsp),%rdi
mov    $0xff,%esi
mov    %rax,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     1280 <main+0x110>
lea    0xe3d(%rip),%r14
lea    0x60(%rsp),%rbx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0xff,%esi
mov    %r15,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
jne    1260 <main+0xf0>
mov    %r15,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
add    $0x160,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.help = [94 x i8] c"Usage: nodes cluster [[-exclude] ...]\0A-xa, would remove any line matching this litteral (xa,)\00"
@.str = [16 x i8] c"XDG_CONFIG_HOME\00"
@.str.1 = [36 x i8] c"/clustershell/groups.d/cluster.yaml\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [94 x i8]
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca [255 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [94 x i8]* %6 to i8*
%12 = load i32, i32* %4
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = getelementptr inbounds [94 x i8], [94 x i8]* %6, i64 0, i64 0
%16 = call i32 @puts(i8* %15)
br label %17
17: ; preds = %14, %2
store i32 1, i32* %7
br label %18
18: ; preds = %40, %17
%19 = load i32, i32* %7
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %43
22: ; preds = %18
%23 = load i8**, i8*** %5
%24 = load i32, i32* %7
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = getelementptr inbounds i8, i8* %27, i64 0
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 45
br i1 %31, label %32, label %39
32: ; preds = %22
%33 = load i8**, i8*** %5
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8*, i8** %33, i64 %35
%37 = load i8*, i8** %36
%38 = call i32 @puts(i8* %37)
br label %39
39: ; preds = %32, %22
br label %40
40: ; preds = %39
%41 = load i32, i32* %7
%42 = add nsw i32 %41, 1
store i32 %42, i32* %7
br label %18
43: ; preds = %18
%44 = call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i8* %44, i8** %8
%45 = load i8*, i8** %8
%46 = call i32 @strcat(i8* %45, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%47 = load i8*, i8** %8
%48 = call i32* @fopen(i8* %47, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %48, i32** %9
br label %49
49: ; preds = %54, %43
%50 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%51 = load i32*, i32** %9
%52 = call i64 @fgets(i8* %50, i32 255, i32* %51)
%53 = icmp ne i64 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %49
%55 = getelementptr inbounds [255 x i8], [255 x i8]* %10, i64 0, i64 0
%56 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %55)
br label %49
57: ; preds = %49
%58 = load i32*, i32** %9
%59 = call i32 @fclose(i32* %58)
ret i32 0
}

LLVM IR (-O2):
@__const.main.help = [94 x i8] c"Usage: nodes cluster [[-exclude] ...]\0A-xa, would remove any line matching this litteral (xa,)\00"
@.str = [16 x i8] c"XDG_CONFIG_HOME\00"
@.str.1 = [36 x i8] c"/clustershell/groups.d/cluster.yaml\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [94 x i8]
%4 = alloca [255 x i8]
%5 = getelementptr inbounds [94 x i8], [94 x i8]* %3, i64 0, i64 0
%6 = icmp eq i32 %0, 1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @puts(i8* %5)
br label %13
9: ; preds = %2
%10 = icmp sgt i32 %0, 1
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = zext i32 %0 to i64
br label %20
13: ; preds = %28, %7, %9
%14 = tail call i8* @getenv(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%15 = tail call i32 @strcat(i8* %14, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%18 = call i64 @fgets(i8* %17, i32 255, i32* %16)
%19 = icmp eq i64 %18, 0
br i1 %19, label %35, label %31
20: ; preds = %11, %28
%21 = phi i64 [ 1, %11 ], [ %29, %28 ]
%22 = getelementptr inbounds i8*, i8** %1, i64 %21
%23 = load i8*, i8** %22
%24 = load i8, i8* %23
%25 = icmp eq i8 %24, 45
br i1 %25, label %26, label %28
26: ; preds = %20
%27 = tail call i32 @puts(i8* %23)
br label %28
28: ; preds = %20, %26
%29 = add nuw nsw i64 %21, 1
%30 = icmp eq i64 %29, %12
br i1 %30, label %13, label %20
31: ; preds = %13, %31
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %17)
%33 = call i64 @fgets(i8* %17, i32 255, i32* %16)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %31
35: ; preds = %31, %13
%36 = call i32 @fclose(i32* %16)
ret i32 0
}