#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 gp {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ add_to_groups(struct gp *, char *, int);
int get_para(int, char **);
int /*<<< orphan*/ print_groups(struct gp *);
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ readvar(char *, int);
int main(int argc, char *argv[]) {
  char var[256];
  int maxlen = 256;
  int first_n = 0;
  struct gp *groups = NULL;
  if ((first_n = get_para(argc, argv)) < 0) {
    printf("%s: input group flag n.\n", argv[0]);
    return -1;
  }
  while (readvar(var, maxlen) > 0) {
    add_to_groups(groups, var, first_n);
  }
  print_groups(groups);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x100,-0x114(%rbp)
movl   $0x0,-0x118(%rbp)
movq   $0x0,-0x120(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <get_para@plt>
mov    %eax,-0x118(%rbp)
cmp    $0x0,%eax
jge    11c2 <main+0x72>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe4f(%rip),%rdi
call   1050 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1214 <main+0xc4>
jmp    11c7 <main+0x77>
lea    -0x110(%rbp),%rdi
mov    -0x114(%rbp),%esi
call   1060 <readvar@plt>
cmp    $0x0,%rax
jle    1201 <main+0xb1>
mov    -0x120(%rbp),%rdi
lea    -0x110(%rbp),%rsi
mov    -0x118(%rbp),%edx
call   1040 <add_to_groups@plt>
jmp    11c7 <main+0x77>
mov    -0x120(%rbp),%rdi
call   1030 <print_groups@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x108,%rsp
mov    %rsi,%rbx
call   1070 <get_para@plt>
test   %eax,%eax
js     11a9 <main+0x59>
mov    %eax,%ebp
mov    %rsp,%rdi
mov    $0x100,%esi
call   1060 <readvar@plt>
test   %rax,%rax
jle    119e <main+0x4e>
mov    %rsp,%rbx
nopl   0x0(%rax)
xor    %edi,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1040 <add_to_groups@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
call   1060 <readvar@plt>
test   %rax,%rax
jg     1180 <main+0x30>
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <print_groups@plt>
jmp    11bd <main+0x6d>
mov    (%rbx),%rsi
lea    0xe4d(%rip),%rdi
call   1050 <printf@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x108,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.gp = type { i32 }
@.str = [25 x i8] c"%s: input group flag n.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.gp*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 256, i32* %7
store i32 0, i32* %8
store %struct.gp* null, %struct.gp** %9
%10 = load i32, i32* %4
%11 = load i8**, i8*** %5
%12 = call i32 @get_para(i32 %10, i8** %11)
store i32 %12, i32* %8
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 0
%17 = load i8*, i8** %16
%18 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %17)
store i32 -1, i32* %3
br label %33
19: ; preds = %2
br label %20
20: ; preds = %25, %19
%21 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%22 = load i32, i32* %7
%23 = call i64 @readvar(i8* %21, i32 %22)
%24 = icmp sgt i64 %23, 0
br i1 %24, label %25, label %30
25: ; preds = %20
%26 = load %struct.gp*, %struct.gp** %9
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%28 = load i32, i32* %8
%29 = call i32 @add_to_groups(%struct.gp* %26, i8* %27, i32 %28)
br label %20
30: ; preds = %20
%31 = load %struct.gp*, %struct.gp** %9
%32 = call i32 @print_groups(%struct.gp* %31)
store i32 0, i32* %3
br label %33
33: ; preds = %30, %14
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
%struct.gp = type { i32 }
@.str = [25 x i8] c"%s: input group flag n.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @get_para(i32 %0, i8** %1)
%6 = icmp slt i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = call i64 @readvar(i8* %4, i32 256)
%9 = icmp sgt i64 %8, 0
br i1 %9, label %13, label %17
10: ; preds = %2
%11 = load i8*, i8** %1
%12 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %19
13: ; preds = %7, %13
%14 = call i32 @add_to_groups(%struct.gp* null, i8* %4, i32 %5)
%15 = call i64 @readvar(i8* %4, i32 256)
%16 = icmp sgt i64 %15, 0
br i1 %16, label %13, label %17
17: ; preds = %13, %7
%18 = call i32 @print_groups(%struct.gp* null)
br label %19
19: ; preds = %17, %10
%20 = phi i32 [ -1, %10 ], [ 0, %17 ]
ret i32 %20
}