#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 */
char fgetc_unlocked(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
char **read_set(unsigned int);
unsigned int read_uint();
int /*<<< orphan*/ stdin;
void read_args(unsigned *k, unsigned *n, char ***set) {
  printf("k = ");
  *k = read_uint();
  while (fgetc_unlocked(stdin) != '\n')
    ;
  ;
  printf("n = ");
  *n = read_uint();
  while (fgetc_unlocked(stdin) != '\n')
    ;
  ;
  printf("A = ");
  *set = read_set(*n);
}


x86 assembly (clang, -O0):
<read_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xea5(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <read_uint@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e72(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc_unlocked@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     118e <read_args+0x4e>
jmp    116f <read_args+0x2f>
lea    0xe70(%rip),%rdi
call   1050 <printf@plt>
mov    $0x0,%al
call   1060 <read_uint@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
call   1040 <fgetc_unlocked@plt>
movsbl %al,%eax
cmp    $0xa,%eax
je     11c8 <read_args+0x88>
jmp    11a9 <read_args+0x69>
lea    0xe3b(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <read_set@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_args>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xeab(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <read_uint@plt>
mov    %eax,(%rbx)
mov    0x2e7e(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%edi
call   1040 <fgetc_unlocked@plt>
cmp    $0xa,%al
jne    1170 <read_args+0x30>
lea    0xe83(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
call   1060 <read_uint@plt>
mov    %eax,(%r15)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%edi
call   1040 <fgetc_unlocked@plt>
cmp    $0xa,%al
jne    11a0 <read_args+0x60>
lea    0xe58(%rip),%rdi
call   1050 <printf@plt>
mov    (%r15),%edi
call   1030 <read_set@plt>
mov    %rax,(%r14)
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"k = \00"
@stdin = global i32 0
@.str.1 = [5 x i8] c"n = \00"
@.str.2 = [5 x i8] c"A = \00"
define void @read_args(i32* %0, i32* %1, i8*** %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8***
store i32* %0, i32** %4
store i32* %1, i32** %5
store i8*** %2, i8**** %6
%7 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @read_uint()
%9 = load i32*, i32** %4
store i32 %8, i32* %9
br label %10
10: ; preds = %15, %3
%11 = load i32, i32* @stdin
%12 = call signext i8 @fgetc_unlocked(i32 %11)
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 10
br i1 %14, label %15, label %16
15: ; preds = %10
br label %10
16: ; preds = %10
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 (...) @read_uint()
%19 = load i32*, i32** %5
store i32 %18, i32* %19
br label %20
20: ; preds = %25, %16
%21 = load i32, i32* @stdin
%22 = call signext i8 @fgetc_unlocked(i32 %21)
%23 = sext i8 %22 to i32
%24 = icmp ne i32 %23, 10
br i1 %24, label %25, label %26
25: ; preds = %20
br label %20
26: ; preds = %20
%27 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%28 = load i32*, i32** %5
%29 = load i32, i32* %28
%30 = call i8** @read_set(i32 %29)
%31 = load i8***, i8**** %6
store i8** %30, i8*** %31
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"k = \00"
@stdin = global i32 0
@.str.1 = [5 x i8] c"n = \00"
@.str.2 = [5 x i8] c"A = \00"
define void @read_args(i32* nocapture writeonly %0, i32* nocapture %1, i8*** nocapture writeonly %2) {
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (...) @read_uint()
store i32 %5, i32* %0
br label %6
6: ; preds = %6, %3
%7 = load i32, i32* @stdin
%8 = tail call signext i8 @fgetc_unlocked(i32 %7)
%9 = icmp eq i8 %8, 10
br i1 %9, label %10, label %6
10: ; preds = %6
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%12 = tail call i32 (...) @read_uint()
store i32 %12, i32* %1
br label %13
13: ; preds = %13, %10
%14 = load i32, i32* @stdin
%15 = tail call signext i8 @fgetc_unlocked(i32 %14)
%16 = icmp eq i8 %15, 10
br i1 %16, label %17, label %13
17: ; preds = %13
%18 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%19 = load i32, i32* %1
%20 = tail call i8** @read_set(i32 %19)
store i8** %20, i8*** %2
ret void
}