#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 /*<<< orphan*/ free(char *);
scalar_t__ getline(char **, size_t *, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
void read(char **n, int *ln, int *lm) {
  size_t x = 0;
  *ln = (int)getline(n, &x, stdin) - 1;
  x = 0;
  char *tmp;
  *lm = (int)getline(&tmp, &x, stdin) - 1;
  free(tmp);
}


x86 assembly (clang, -O0):
<read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ea1(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rsi
call   1040 <getline@plt>
mov    %eax,%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x20(%rbp)
mov    0x2e7c(%rip),%rax
mov    (%rax),%edx
lea    -0x28(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1040 <getline@plt>
mov    %eax,%ecx
sub    $0x1,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
movq   $0x0,0x8(%rsp)
mov    0x2ea7(%rip),%r12
mov    (%r12),%edx
lea    0x8(%rsp),%r15
mov    %r15,%rsi
call   1040 <getline@plt>
add    $0xffffffff,%eax
mov    %eax,(%rbx)
movq   $0x0,0x8(%rsp)
mov    (%r12),%edx
lea    0x10(%rsp),%rdi
mov    %r15,%rsi
call   1040 <getline@plt>
add    $0xffffffff,%eax
mov    %eax,(%r14)
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@stdin = global i32 0
define void @read(i8** %0, i32* %1, i32* %2) {
%4 = alloca i8**
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i64
%8 = alloca i8*
store i8** %0, i8*** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store i64 0, i64* %7
%9 = load i8**, i8*** %4
%10 = load i32, i32* @stdin
%11 = call i64 @getline(i8** %9, i64* %7, i32 %10)
%12 = trunc i64 %11 to i32
%13 = sub nsw i32 %12, 1
%14 = load i32*, i32** %5
store i32 %13, i32* %14
store i64 0, i64* %7
%15 = load i32, i32* @stdin
%16 = call i64 @getline(i8** %8, i64* %7, i32 %15)
%17 = trunc i64 %16 to i32
%18 = sub nsw i32 %17, 1
%19 = load i32*, i32** %6
store i32 %18, i32* %19
%20 = load i8*, i8** %8
%21 = call i32 @free(i8* %20)
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
define void @read(i8** %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%7 = load i32, i32* @stdin
%8 = call i64 @getline(i8** %0, i64* %4, i32 %7)
%9 = trunc i64 %8 to i32
%10 = add nsw i32 %9, -1
store i32 %10, i32* %1
store i64 0, i64* %4
%11 = bitcast i8** %5 to i8*
%12 = load i32, i32* @stdin
%13 = call i64 @getline(i8** %5, i64* %4, i32 %12)
%14 = trunc i64 %13 to i32
%15 = add nsw i32 %14, -1
store i32 %15, i32* %2
%16 = load i8*, i8** %5
%17 = call i32 @free(i8* %16)
ret void
}