#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 getline(char **, size_t *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, char **, unsigned int,
                          int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strlen(char *);
int main(int argc, char *argv[], char *envp[]) {
  char *buf;
  size_t n = 0;
  int r = 0;
  r = getline(&buf, &n, stdin);
  printf("(%d)(%p)(%u)(%lu)%s", r, &buf, (unsigned int)n, strlen(buf), buf);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    0x2e88(%rip),%rax
mov    (%rax),%edx
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1050 <getline@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rax
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%ecx
mov    %eax,%r8d
mov    -0x20(%rbp),%r9
lea    0xe64(%rip),%rdi
lea    -0x20(%rbp),%rdx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
movq   $0x0,(%rsp)
mov    0x2ea1(%rip),%rax
mov    (%rax),%edx
lea    0x8(%rsp),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
call   1050 <getline@plt>
mov    %eax,%ebp
mov    (%rsp),%ebx
mov    0x8(%rsp),%rdi
call   1030 <strlen@plt>
mov    0x8(%rsp),%r9
lea    0xe8c(%rip),%rdi
mov    %ebp,%esi
mov    %r14,%rdx
mov    %ebx,%ecx
mov    %eax,%r8d
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [20 x i8] c"(%d)(%p)(%u)(%lu)%s\00"
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
store i64 0, i64* %9
store i32 0, i32* %10
%11 = load i32, i32* @stdin
%12 = call i32 @getline(i8** %8, i64* %9, i32 %11)
store i32 %12, i32* %10
%13 = load i32, i32* %10
%14 = load i64, i64* %9
%15 = trunc i64 %14 to i32
%16 = load i8*, i8** %8
%17 = call i32 @strlen(i8* %16)
%18 = load i8*, i8** %8
%19 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %13, i8** %8, i32 %15, i32 %17, i8* %18)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [20 x i8] c"(%d)(%p)(%u)(%lu)%s\00"
define i32 @main(i32 %0, i8** nocapture readnone %1, i8** nocapture readnone %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = bitcast i8** %4 to i8*
%7 = bitcast i64* %5 to i8*
store i64 0, i64* %5
%8 = load i32, i32* @stdin
%9 = call i32 @getline(i8** %4, i64* %5, i32 %8)
%10 = load i64, i64* %5
%11 = trunc i64 %10 to i32
%12 = load i8*, i8** %4
%13 = call i32 @strlen(i8* %12)
%14 = load i8*, i8** %4
%15 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i32 %9, i8** %4, i32 %11, i32 %13, i8* %14)
ret i32 0
}