#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 group {
  char *gr_name;
};
typedef int gid_t;

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ fatal(int, char *);
char *get_secondary_gids(int, int *, int);
char *getenv(char *);
int getgid();
struct group *getgrgid(int);
int getgroups(int, int *);
int getuid();
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *, int, int,
                           char *, char *);
int /*<<< orphan*/ strcat(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncat(char *, char *, int);
char *strtok(char *, char *);
int /*<<< orphan*/ write(int, char *, int);
void creds(int sock) {
  char buf[BUFSIZ];
  char *ip, *port, *homedir, *user, *xtragids;
  char *ptr;
  gid_t gid;
  gid_t list[255];
  int n;
  if ((ptr = getenv("SSH_CONNECTION")) == NULL)
    fatal(5, "No SSH_CONNECTION environment variable found");
  if ((ip = strtok(ptr, " ")) == NULL)
    fatal(6, "Badly formatted SSH_CONNECTION environment variable");
  if ((port = strtok(NULL, " ")) == NULL)
    port = "0";
  homedir = getenv("HOME");
  user = getenv("USER");
  if (homedir == NULL)
    homedir = "/tmp";
  if (user == NULL)
    user = "";
  gid = getgid();
  n = getgroups(255, list);
  xtragids = get_secondary_gids(gid, list, n);
  sprintf(buf, "[%s;%s/%s;ssh;%d;%d;%s;%s;", user, ip, port, getuid(), gid,
          xtragids, homedir);
  if (n > 0) {
    struct group *g;
    int i, len;
    int size = BUFSIZ - strlen(buf) - 3;
    for (i = 0; i < n && size > 0; i++) {
      g = getgrgid(list[i]);
      if (g != NULL) {
        len = strlen(g->gr_name);
        strncat(buf, g->gr_name, size);
        size -= len;
        if (i != n - 1) {
          strncat(buf, ",", size);
          size--;
        }
      }
    }
  }
  strcat(buf, ";]\n");
  write(sock, buf, strlen(buf));
}


x86 assembly (clang, -O0):
<creds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4a0,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2dfb(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x478(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
lea    0xdec(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
jne    1238 <creds+0x68>
mov    $0x5,%edi
lea    0xddc(%rip),%rsi
call   10f0 <fatal@plt>
mov    -0x48(%rbp),%rdi
lea    0xdf9(%rip),%rsi
call   10c0 <strtok@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1267 <creds+0x97>
mov    $0x6,%edi
lea    0xddc(%rip),%rsi
call   10f0 <fatal@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xdca(%rip),%rsi
call   10c0 <strtok@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1290 <creds+0xc0>
lea    0xde6(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xddd(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x30(%rbp)
lea    0xdd2(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12c6 <creds+0xf6>
lea    0xdbc(%rip),%rax
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    12dc <creds+0x10c>
lea    0xdcb(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1090 <getgid@plt>
mov    %eax,-0x4c(%rbp)
lea    -0x450(%rbp),%rsi
mov    $0xff,%edi
call   10a0 <getgroups@plt>
mov    %eax,-0x454(%rbp)
mov    -0x4c(%rbp),%edi
lea    -0x450(%rbp),%rsi
mov    -0x454(%rbp),%edx
call   10b0 <get_secondary_gids@plt>
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x490(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x488(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x480(%rbp)
mov    $0x0,%al
call   1060 <getuid@plt>
mov    -0x478(%rbp),%rdi
mov    -0x490(%rbp),%rdx
mov    -0x488(%rbp),%rcx
mov    -0x480(%rbp),%r8
mov    %eax,%r9d
mov    -0x4c(%rbp),%r11d
mov    -0x40(%rbp),%r10
mov    -0x30(%rbp),%rax
lea    0xd13(%rip),%rsi
sub    $0x20,%rsp
mov    %r11d,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   10e0 <sprintf@plt>
add    $0x20,%rsp
cmpl   $0x0,-0x454(%rbp)
jle    14dc <creds+0x30c>
mov    -0x478(%rbp),%rdi
mov    0x2c3a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x494(%rbp)
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x494(%rbp),%eax
sub    %ecx,%eax
sub    $0x3,%eax
mov    %eax,-0x46c(%rbp)
movl   $0x0,-0x464(%rbp)
mov    -0x464(%rbp),%ecx
xor    %eax,%eax
cmp    -0x454(%rbp),%ecx
mov    %al,-0x495(%rbp)
jge    13fa <creds+0x22a>
cmpl   $0x0,-0x46c(%rbp)
setg   %al
mov    %al,-0x495(%rbp)
mov    -0x495(%rbp),%al
test   $0x1,%al
jne    140d <creds+0x23d>
jmp    14d7 <creds+0x307>
movslq -0x464(%rbp),%rax
mov    -0x450(%rbp,%rax,4),%edi
call   1070 <getgrgid@plt>
mov    %rax,-0x460(%rbp)
cmpq   $0x0,-0x460(%rbp)
je     14be <creds+0x2ee>
mov    -0x460(%rbp),%rax
mov    (%rax),%rdi
call   1050 <strlen@plt>
mov    -0x478(%rbp),%rdi
mov    %eax,-0x468(%rbp)
mov    -0x460(%rbp),%rax
mov    (%rax),%rsi
mov    -0x46c(%rbp),%edx
call   1080 <strncat@plt>
mov    -0x468(%rbp),%ecx
mov    -0x46c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x46c(%rbp)
mov    -0x464(%rbp),%eax
mov    -0x454(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
je     14b9 <creds+0x2e9>
mov    -0x478(%rbp),%rdi
mov    -0x46c(%rbp),%edx
lea    0xbf9(%rip),%rsi
call   1080 <strncat@plt>
mov    -0x46c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x46c(%rbp)
jmp    14be <creds+0x2ee>
jmp    14c3 <creds+0x2f3>
mov    -0x464(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x464(%rbp)
jmp    13d0 <creds+0x200>
jmp    14dc <creds+0x30c>
mov    -0x478(%rbp),%rdi
lea    0xbb6(%rip),%rsi
call   10d0 <strcat@plt>
mov    -0x478(%rbp),%rdi
mov    -0x4(%rbp),%eax
mov    %eax,-0x49c(%rbp)
call   1050 <strlen@plt>
mov    -0x49c(%rbp),%edi
mov    -0x478(%rbp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<creds>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %edi,-0x44(%rbp)
mov    0x2df2(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xdf8(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%r14
test   %rax,%rax
jne    1226 <creds+0x56>
lea    0xdf3(%rip),%rsi
mov    $0x5,%edi
call   10f0 <fatal@plt>
mov    %rbx,-0x30(%rbp)
lea    0xe0b(%rip),%rsi
mov    %r14,%rdi
call   10c0 <strtok@plt>
mov    %rax,-0x40(%rbp)
test   %rax,%rax
jne    1253 <creds+0x83>
lea    0xdf5(%rip),%rsi
mov    $0x6,%edi
call   10f0 <fatal@plt>
lea    0xde2(%rip),%rsi
xor    %edi,%edi
call   10c0 <strtok@plt>
test   %rax,%rax
lea    0xe07(%rip),%rcx
cmovne %rax,%rcx
mov    %rcx,-0x38(%rbp)
lea    0xdfa(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rbx
lea    0xdf0(%rip),%rdi
call   1030 <getenv@plt>
test   %rbx,%rbx
lea    0xde6(%rip),%r15
cmovne %rbx,%r15
test   %rax,%rax
lea    0xdfd(%rip),%r14
cmovne %rax,%r14
xor    %eax,%eax
call   1090 <getgid@plt>
mov    %eax,%r12d
lea    -0x440(%rbp),%rbx
mov    $0xff,%edi
mov    %rbx,%rsi
call   10a0 <getgroups@plt>
mov    %eax,%r13d
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   10b0 <get_secondary_gids@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <getuid@plt>
sub    $0x8,%rsp
lea    0xd96(%rip),%rsi
mov    -0x30(%rbp),%rdi
mov    %r14,%rdx
mov    -0x40(%rbp),%rcx
mov    -0x38(%rbp),%r8
mov    %eax,%r9d
push   %r15
push   %rbx
push   %r12
call   10e0 <sprintf@plt>
add    $0x20,%rsp
test   %r13d,%r13d
jle    13c8 <creds+0x1f8>
mov    0x2cc3(%rip),%rax
mov    (%rax),%r14d
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
sub    %eax,%r14d
add    $0xfffffffd,%r14d
test   %r14d,%r14d
jle    13c8 <creds+0x1f8>
lea    -0x1(%r13),%eax
mov    %r13d,%ecx
mov    %rcx,-0x40(%rbp)
neg    %rax
mov    %rax,-0x38(%rbp)
mov    $0x1,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    -0x444(%rbp,%r12,4),%edi
ff
call   1070 <getgrgid@plt>
test   %rax,%rax
je     13b9 <creds+0x1e9>
mov    %rax,%rbx
mov    -0x38(%rbp),%rax
lea    (%rax,%r12,1),%r15
mov    (%rbx),%rdi
call   1050 <strlen@plt>
mov    %eax,%r13d
mov    (%rbx),%rsi
mov    -0x30(%rbp),%rbx
mov    %rbx,%rdi
mov    %r14d,%edx
call   1080 <strncat@plt>
sub    %r13d,%r14d
cmp    $0x1,%r15
je     13b9 <creds+0x1e9>
mov    %rbx,%rdi
lea    0xcf1(%rip),%rsi
mov    %r14d,%edx
call   1080 <strncat@plt>
add    $0xffffffff,%r14d
cmp    -0x40(%rbp),%r12
jae    13c8 <creds+0x1f8>
add    $0x1,%r12
test   %r14d,%r14d
jg     1360 <creds+0x190>
lea    0xcd1(%rip),%rsi
mov    -0x30(%rbp),%rbx
mov    %rbx,%rdi
call   10d0 <strcat@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    -0x44(%rbp),%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1040 <write@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.group = type { i8* }
@BUFSIZ = global i32 0
@.str = [15 x i8] c"SSH_CONNECTION\00"
@.str.1 = [45 x i8] c"No SSH_CONNECTION environment variable found\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [52 x i8] c"Badly formatted SSH_CONNECTION environment variable\00"
@.str.4 = [2 x i8] c"0\00"
@.str.5 = [5 x i8] c"HOME\00"
@.str.6 = [5 x i8] c"USER\00"
@.str.7 = [5 x i8] c"/tmp\00"
@.str.8 = [1 x i8] zeroinitializer
@.str.9 = [27 x i8] c"[%s;%s/%s;ssh;%d;%d;%s;%s;\00"
@.str.10 = [2 x i8] c",\00"
@.str.11 = [4 x i8] c";]\0A\00"
define void @creds(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca [255 x i32]
%13 = alloca i32
%14 = alloca %struct.group*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i32 %0, i32* %2
%18 = load i32, i32* @BUFSIZ
%19 = zext i32 %18 to i64
%20 = call i8* @llvm.stacksave()
store i8* %20, i8** %3
%21 = alloca i8, i64 %19
store i64 %19, i64* %4
%22 = call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i8* %22, i8** %10
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %26
24: ; preds = %1
%25 = call i32 @fatal(i32 5, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %24, %1
%27 = load i8*, i8** %10
%28 = call i8* @strtok(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %28, i8** %5
%29 = icmp eq i8* %28, null
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 @fatal(i32 6, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
br label %32
32: ; preds = %30, %26
%33 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i8* %33, i8** %6
%34 = icmp eq i8* %33, null
br i1 %34, label %35, label %36
35: ; preds = %32
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8** %6
br label %36
36: ; preds = %35, %32
%37 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
store i8* %37, i8** %7
%38 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
store i8* %38, i8** %8
%39 = load i8*, i8** %7
%40 = icmp eq i8* %39, null
br i1 %40, label %41, label %42
41: ; preds = %36
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8** %7
br label %42
42: ; preds = %41, %36
%43 = load i8*, i8** %8
%44 = icmp eq i8* %43, null
br i1 %44, label %45, label %46
45: ; preds = %42
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0), i8** %8
br label %46
46: ; preds = %45, %42
%47 = call i32 (...) @getgid()
store i32 %47, i32* %11
%48 = getelementptr inbounds [255 x i32], [255 x i32]* %12, i64 0, i64 0
%49 = call i32 @getgroups(i32 255, i32* %48)
store i32 %49, i32* %13
%50 = load i32, i32* %11
%51 = getelementptr inbounds [255 x i32], [255 x i32]* %12, i64 0, i64 0
%52 = load i32, i32* %13
%53 = call i8* @get_secondary_gids(i32 %50, i32* %51, i32 %52)
store i8* %53, i8** %9
%54 = load i8*, i8** %8
%55 = load i8*, i8** %5
%56 = load i8*, i8** %6
%57 = call i32 (...) @getuid()
%58 = load i32, i32* %11
%59 = load i8*, i8** %9
%60 = load i8*, i8** %7
%61 = call i32 @sprintf(i8* %21, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i8* %54, i8* %55, i8* %56, i32 %57, i32 %58, i8* %59, i8* %60)
%62 = load i32, i32* %13
%63 = icmp sgt i32 %62, 0
br i1 %63, label %64, label %114
64: ; preds = %46
%65 = load i32, i32* @BUFSIZ
%66 = call i32 @strlen(i8* %21)
%67 = sub nsw i32 %65, %66
%68 = sub nsw i32 %67, 3
store i32 %68, i32* %17
store i32 0, i32* %15
br label %69
69: ; preds = %110, %64
%70 = load i32, i32* %15
%71 = load i32, i32* %13
%72 = icmp slt i32 %70, %71
br i1 %72, label %73, label %76
73: ; preds = %69
%74 = load i32, i32* %17
%75 = icmp sgt i32 %74, 0
br label %76
76: ; preds = %73, %69
%77 = phi i1 [ false, %69 ], [ %75, %73 ]
br i1 %77, label %78, label %113
78: ; preds = %76
%79 = load i32, i32* %15
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds [255 x i32], [255 x i32]* %12, i64 0, i64 %80
%82 = load i32, i32* %81
%83 = call %struct.group* @getgrgid(i32 %82)
store %struct.group* %83, %struct.group** %14
%84 = load %struct.group*, %struct.group** %14
%85 = icmp ne %struct.group* %84, null
br i1 %85, label %86, label %109
86: ; preds = %78
%87 = load %struct.group*, %struct.group** %14
%88 = getelementptr inbounds %struct.group, %struct.group* %87, i32 0, i32 0
%89 = load i8*, i8** %88
%90 = call i32 @strlen(i8* %89)
store i32 %90, i32* %16
%91 = load %struct.group*, %struct.group** %14
%92 = getelementptr inbounds %struct.group, %struct.group* %91, i32 0, i32 0
%93 = load i8*, i8** %92
%94 = load i32, i32* %17
%95 = call i32 @strncat(i8* %21, i8* %93, i32 %94)
%96 = load i32, i32* %16
%97 = load i32, i32* %17
%98 = sub nsw i32 %97, %96
store i32 %98, i32* %17
%99 = load i32, i32* %15
%100 = load i32, i32* %13
%101 = sub nsw i32 %100, 1
%102 = icmp ne i32 %99, %101
br i1 %102, label %103, label %108
103: ; preds = %86
%104 = load i32, i32* %17
%105 = call i32 @strncat(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 %104)
%106 = load i32, i32* %17
%107 = add nsw i32 %106, -1
store i32 %107, i32* %17
br label %108
108: ; preds = %103, %86
br label %109
109: ; preds = %108, %78
br label %110
110: ; preds = %109
%111 = load i32, i32* %15
%112 = add nsw i32 %111, 1
store i32 %112, i32* %15
br label %69
113: ; preds = %76
br label %114
114: ; preds = %113, %46
%115 = call i32 @strcat(i8* %21, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%116 = load i32, i32* %2
%117 = call i32 @strlen(i8* %21)
%118 = call i32 @write(i32 %116, i8* %21, i32 %117)
%119 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
%struct.group = type { i8* }
@BUFSIZ = global i32 0
@.str = [15 x i8] c"SSH_CONNECTION\00"
@.str.1 = [45 x i8] c"No SSH_CONNECTION environment variable found\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [52 x i8] c"Badly formatted SSH_CONNECTION environment variable\00"
@.str.4 = [2 x i8] c"0\00"
@.str.5 = [5 x i8] c"HOME\00"
@.str.6 = [5 x i8] c"USER\00"
@.str.7 = [5 x i8] c"/tmp\00"
@.str.8 = [1 x i8] zeroinitializer
@.str.9 = [27 x i8] c"[%s;%s/%s;ssh;%d;%d;%s;%s;\00"
@.str.10 = [2 x i8] c",\00"
@.str.11 = [4 x i8] c";]\0A\00"
define void @creds(i32 %0) {
%2 = alloca [255 x i32]
%3 = load i32, i32* @BUFSIZ
%4 = zext i32 %3 to i64
%5 = alloca i8, i64 %4
%6 = bitcast [255 x i32]* %2 to i8*
%7 = tail call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = tail call i32 @fatal(i32 5, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = tail call i8* @strtok(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%13 = icmp eq i8* %12, null
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = tail call i32 @fatal(i32 6, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
br label %16
16: ; preds = %14, %11
%17 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = icmp eq i8* %17, null
%19 = select i1 %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0), i8* %17
%20 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%21 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%22 = icmp eq i8* %20, null
%23 = select i1 %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i8* %20
%24 = icmp eq i8* %21, null
%25 = select i1 %24, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.8, i64 0, i64 0), i8* %21
%26 = tail call i32 (...) @getgid()
%27 = getelementptr inbounds [255 x i32], [255 x i32]* %2, i64 0, i64 0
%28 = call i32 @getgroups(i32 255, i32* %27)
%29 = call i8* @get_secondary_gids(i32 %26, i32* %27, i32 %28)
%30 = call i32 (...) @getuid()
%31 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i8* %25, i8* %12, i8* %19, i32 %30, i32 %26, i8* %29, i8* %23)
%32 = icmp sgt i32 %28, 0
br i1 %32, label %33, label %67
33: ; preds = %16
%34 = load i32, i32* @BUFSIZ
%35 = call i32 @strlen(i8* %5)
%36 = add i32 %34, -3
%37 = sub i32 %36, %35
%38 = icmp sgt i32 %37, 0
br i1 %38, label %39, label %67
39: ; preds = %33
%40 = add nsw i32 %28, -1
%41 = zext i32 %40 to i64
%42 = zext i32 %28 to i64
br label %43
43: ; preds = %39, %61
%44 = phi i64 [ 0, %39 ], [ %63, %61 ]
%45 = phi i32 [ %37, %39 ], [ %62, %61 ]
%46 = getelementptr inbounds [255 x i32], [255 x i32]* %2, i64 0, i64 %44
%47 = load i32, i32* %46
%48 = call %struct.group* @getgrgid(i32 %47)
%49 = icmp eq %struct.group* %48, null
br i1 %49, label %61, label %50
50: ; preds = %43
%51 = getelementptr inbounds %struct.group, %struct.group* %48, i64 0, i32 0
%52 = load i8*, i8** %51
%53 = call i32 @strlen(i8* %52)
%54 = load i8*, i8** %51
%55 = call i32 @strncat(i8* %5, i8* %54, i32 %45)
%56 = sub nsw i32 %45, %53
%57 = icmp eq i64 %44, %41
br i1 %57, label %61, label %58
58: ; preds = %50
%59 = call i32 @strncat(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0), i32 %56)
%60 = add nsw i32 %56, -1
br label %61
61: ; preds = %43, %58, %50
%62 = phi i32 [ %60, %58 ], [ %56, %50 ], [ %45, %43 ]
%63 = add nuw nsw i64 %44, 1
%64 = icmp ult i64 %63, %42
%65 = icmp sgt i32 %62, 0
%66 = select i1 %64, i1 %65, i1 false
br i1 %66, label %43, label %67
67: ; preds = %61, %33, %16
%68 = call i32 @strcat(i8* %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0))
%69 = call i32 @strlen(i8* %5)
%70 = call i32 @write(i32 %0, i8* %5, i32 %69)
ret void
}