#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 */

/* Variables and functions */
int EOF;
int fgetc_unlocked(int /*<<< orphan*/);
scalar_t__ pool_alloc(unsigned int const);
scalar_t__ pool_rls();
size_t pool_rsv();
int /*<<< orphan*/ pool_write(char *);
int /*<<< orphan*/ stdin;
char **read_set(const unsigned card) {
  char c;
  int ci;
  unsigned i = 0;
  size_t buffsize;
  char **set = (char **)pool_alloc(card * sizeof(char *));
  while ((ci = fgetc_unlocked(stdin)) != '\n' && ci != EOF && i < card) {
    if (ci < '0' || ci > '9')
      continue;
    buffsize = pool_rsv();
    for (; ci >= '0' && ci <= '9' && buffsize > 1;
         ci = fgetc_unlocked(stdin), buffsize--) {
      c = ci;
      pool_write(&c);
    }
    c = '\0';
    pool_write(&c);
    set[i++] = (char *)pool_rls();
  }
  return set;
}


x86 assembly (clang, -O0):
<read_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <pool_alloc@plt>
mov    %rax,-0x20(%rbp)
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc_unlocked@plt>
mov    %eax,%ecx
mov    %ecx,-0xc(%rbp)
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x21(%rbp)
je     11b8 <read_set+0x68>
mov    -0xc(%rbp),%ecx
xor    %eax,%eax
mov    0x2e3f(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x21(%rbp)
je     11b8 <read_set+0x68>
mov    -0x10(%rbp),%eax
cmp    -0x4(%rbp),%eax
setb   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11c8 <read_set+0x78>
jmp    1287 <read_set+0x137>
cmpl   $0x30,-0xc(%rbp)
jl     11dc <read_set+0x8c>
cmpl   $0x39,-0xc(%rbp)
jle    11e1 <read_set+0x91>
jmp    1174 <read_set+0x24>
mov    $0x0,%al
call   1050 <pool_rsv@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpl   $0x30,-0xc(%rbp)
mov    %al,-0x22(%rbp)
jl     1215 <read_set+0xc5>
xor    %eax,%eax
cmpl   $0x39,-0xc(%rbp)
mov    %al,-0x22(%rbp)
jg     1215 <read_set+0xc5>
cmpq   $0x1,-0x18(%rbp)
seta   %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
test   $0x1,%al
jne    1225 <read_set+0xd5>
jmp    1256 <read_set+0x106>
mov    -0xc(%rbp),%eax
mov    %al,-0x5(%rbp)
lea    -0x5(%rbp),%rdi
call   1060 <pool_write@plt>
mov    0x2dad(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc_unlocked@plt>
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
jmp    11ec <read_set+0x9c>
movb   $0x0,-0x5(%rbp)
lea    -0x5(%rbp),%rdi
call   1060 <pool_write@plt>
mov    $0x0,%al
call   1070 <pool_rls@plt>
mov    %rax,%rdx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x10(%rbp)
mov    %ecx,%ecx
mov    %rdx,(%rax,%rcx,8)
jmp    1174 <read_set+0x24>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_set>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %edi,%ebx
lea    0x0(,%rbx,8),%edi
call   1040 <pool_alloc@plt>
mov    %rax,%r12
mov    %ebx,%r13d
mov    0x2e6f(%rip),%rbp
mov    0x2e60(%rip),%r14
xor    %r15d,%r15d
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x0(%rbp),%edi
call   1030 <fgetc_unlocked@plt>
cmp    $0xa,%eax
je     1226 <read_set+0xd6>
mov    %eax,%ebx
cmp    (%r14),%eax
je     1226 <read_set+0xd6>
cmp    %r13,%r15
jae    1226 <read_set+0xd6>
lea    -0x3a(%rbx),%eax
cmp    $0xfffffff6,%eax
jb     1190 <read_set+0x40>
mov    %r12,0x10(%rsp)
xor    %eax,%eax
call   1050 <pool_rsv@plt>
cmp    $0x2,%rax
jb     11fe <read_set+0xae>
mov    %rax,%r12
add    $0xffffffffffffffff,%r12
xchg   %ax,%ax
mov    %bl,0xf(%rsp)
lea    0xf(%rsp),%rdi
call   1060 <pool_write@plt>
mov    0x0(%rbp),%edi
call   1030 <fgetc_unlocked@plt>
mov    %eax,%ebx
lea    -0x30(%rbx),%eax
cmp    $0x9,%eax
ja     11fe <read_set+0xae>
lea    -0x1(%r12),%rax
cmp    $0x1,%r12
mov    %rax,%r12
ja     11d0 <read_set+0x80>
movb   $0x0,0xf(%rsp)
lea    0xf(%rsp),%rdi
call   1060 <pool_write@plt>
xor    %eax,%eax
call   1070 <pool_rls@plt>
mov    0x10(%rsp),%r12
mov    %rax,(%r12,%r15,8)
add    $0x1,%r15
jmp    1190 <read_set+0x40>
mov    %r12,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@EOF = global i32 0
define i8** @read_set(i32 %0) {
%2 = alloca i32
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
%6 = alloca i64
%7 = alloca i8**
store i32 %0, i32* %2
store i32 0, i32* %5
%8 = load i32, i32* %2
%9 = zext i32 %8 to i64
%10 = mul i64 %9, 8
%11 = trunc i64 %10 to i32
%12 = call i64 @pool_alloc(i32 %11)
%13 = inttoptr i64 %12 to i8**
store i8** %13, i8*** %7
br label %14
14: ; preds = %57, %34, %1
%15 = load i32, i32* @stdin
%16 = call i32 @fgetc_unlocked(i32 %15)
store i32 %16, i32* %4
%17 = icmp ne i32 %16, 10
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i32, i32* %4
%20 = load i32, i32* @EOF
%21 = icmp ne i32 %19, %20
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load i32, i32* %5
%24 = load i32, i32* %2
%25 = icmp ult i32 %23, %24
br label %26
26: ; preds = %22, %18, %14
%27 = phi i1 [ false, %18 ], [ false, %14 ], [ %25, %22 ]
br i1 %27, label %28, label %66
28: ; preds = %26
%29 = load i32, i32* %4
%30 = icmp slt i32 %29, 48
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = load i32, i32* %4
%33 = icmp sgt i32 %32, 57
br i1 %33, label %34, label %35
34: ; preds = %31, %28
br label %14
35: ; preds = %31
%36 = call i64 (...) @pool_rsv()
store i64 %36, i64* %6
br label %37
37: ; preds = %52, %35
%38 = load i32, i32* %4
%39 = icmp sge i32 %38, 48
br i1 %39, label %40, label %46
40: ; preds = %37
%41 = load i32, i32* %4
%42 = icmp sle i32 %41, 57
br i1 %42, label %43, label %46
43: ; preds = %40
%44 = load i64, i64* %6
%45 = icmp ugt i64 %44, 1
br label %46
46: ; preds = %43, %40, %37
%47 = phi i1 [ false, %40 ], [ false, %37 ], [ %45, %43 ]
br i1 %47, label %48, label %57
48: ; preds = %46
%49 = load i32, i32* %4
%50 = trunc i32 %49 to i8
store i8 %50, i8* %3
%51 = call i32 @pool_write(i8* %3)
br label %52
52: ; preds = %48
%53 = load i32, i32* @stdin
%54 = call i32 @fgetc_unlocked(i32 %53)
store i32 %54, i32* %4
%55 = load i64, i64* %6
%56 = add i64 %55, -1
store i64 %56, i64* %6
br label %37
57: ; preds = %46
store i8 0, i8* %3
%58 = call i32 @pool_write(i8* %3)
%59 = call i64 (...) @pool_rls()
%60 = inttoptr i64 %59 to i8*
%61 = load i8**, i8*** %7
%62 = load i32, i32* %5
%63 = add i32 %62, 1
store i32 %63, i32* %5
%64 = zext i32 %62 to i64
%65 = getelementptr inbounds i8*, i8** %61, i64 %64
store i8* %60, i8** %65
br label %14
66: ; preds = %26
%67 = load i8**, i8*** %7
ret i8** %67
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i32 0
define i8** @read_set(i32 %0) {
%2 = alloca i8
%3 = shl i32 %0, 3
%4 = tail call i64 @pool_alloc(i32 %3)
%5 = inttoptr i64 %4 to i8**
%6 = zext i32 %0 to i64
br label %7
7: ; preds = %36, %1
%8 = phi i64 [ %40, %36 ], [ 0, %1 ]
%9 = icmp ult i64 %8, %6
br label %10
10: ; preds = %7, %18
%11 = load i32, i32* @stdin
%12 = call i32 @fgetc_unlocked(i32 %11)
%13 = icmp ne i32 %12, 10
%14 = load i32, i32* @EOF
%15 = icmp ne i32 %12, %14
%16 = select i1 %13, i1 %15, i1 false
%17 = select i1 %16, i1 %9, i1 false
br i1 %17, label %18, label %42
18: ; preds = %10
%19 = add i32 %12, -58
%20 = icmp ult i32 %19, -10
br i1 %20, label %10, label %21
21: ; preds = %18
%22 = call i64 (...) @pool_rsv()
%23 = icmp ugt i64 %22, 1
br i1 %23, label %24, label %36
24: ; preds = %21, %24
%25 = phi i32 [ %30, %24 ], [ %12, %21 ]
%26 = phi i64 [ %31, %24 ], [ %22, %21 ]
%27 = trunc i32 %25 to i8
store i8 %27, i8* %2
%28 = call i32 @pool_write(i8* %2)
%29 = load i32, i32* @stdin
%30 = call i32 @fgetc_unlocked(i32 %29)
%31 = add i64 %26, -1
%32 = add i32 %30, -48
%33 = icmp ult i32 %32, 10
%34 = icmp ugt i64 %31, 1
%35 = select i1 %33, i1 %34, i1 false
br i1 %35, label %24, label %36
36: ; preds = %24, %21
store i8 0, i8* %2
%37 = call i32 @pool_write(i8* %2)
%38 = call i64 (...) @pool_rls()
%39 = inttoptr i64 %38 to i8*
%40 = add nuw nsw i64 %8, 1
%41 = getelementptr inbounds i8*, i8** %5, i64 %8
store i8* %39, i8** %41
br label %7
42: ; preds = %10
ret i8** %5
}