#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*/ get_line(char *, int);
void *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char *, size_t);
int /*<<< orphan*/ printf(char *, int);
int strlen(char *);
char **prompt_for_message(void) {
  static char buf[32];
  char **lines;
  size_t line_size;
  int i;
  lines = malloc(2 * sizeof *lines);
  for (i = 0; i < 2; ++i) {
    printf("Enter line %d: ", i + 1);
    get_line(buf, sizeof buf);
    line_size = strlen(buf) + 1;
    lines[i] = malloc(line_size);
    memcpy(lines[i], buf, line_size);
  }
  return lines;
}


x86 assembly (clang, -O0):
<prompt_for_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x10,%edi
call   1070 <malloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x2,-0x14(%rbp)
jge    11f1 <prompt_for_message+0xa1>
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xe7c(%rip),%rdi
call   1050 <printf@plt>
lea    0x2ed0(%rip),%rdi
mov    $0x20,%esi
call   1030 <get_line@plt>
lea    0x2ebf(%rip),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <malloc@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x10(%rbp),%rdx
lea    0x2e82(%rip),%rsi
call   1060 <memcpy@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    116d <prompt_for_message+0x1d>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prompt_for_message>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x10,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
lea    0xe94(%rip),%r15
mov    %r15,%rdi
mov    $0x1,%esi
call   1050 <printf@plt>
lea    0x2ee0(%rip),%r12
mov    %r12,%rdi
mov    $0x20,%esi
call   1030 <get_line@plt>
mov    %r12,%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
movslq %eax,%rbx
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    %rax,(%r14)
mov    %rax,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1060 <memcpy@plt>
mov    %r15,%rdi
mov    $0x2,%esi
call   1050 <printf@plt>
mov    %r12,%rdi
mov    $0x20,%esi
call   1030 <get_line@plt>
mov    %r12,%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
movslq %eax,%rbx
mov    %rbx,%rdi
call   1070 <malloc@plt>
mov    %rax,0x8(%r14)
mov    %rax,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1060 <memcpy@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@prompt_for_message.buf = internal global [32 x i8] zeroinitializer
@.str = [16 x i8] c"Enter line %d: \00"
define i8** @prompt_for_message() {
%1 = alloca i8**
%2 = alloca i64
%3 = alloca i32
%4 = call i8* @malloc(i64 16)
%5 = bitcast i8* %4 to i8**
store i8** %5, i8*** %1
store i32 0, i32* %3
br label %6
6: ; preds = %30, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %33
9: ; preds = %6
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
%12 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @get_line(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @prompt_for_message.buf, i64 0, i64 0), i32 32)
%14 = call i32 @strlen(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @prompt_for_message.buf, i64 0, i64 0))
%15 = add nsw i32 %14, 1
%16 = sext i32 %15 to i64
store i64 %16, i64* %2
%17 = load i64, i64* %2
%18 = call i8* @malloc(i64 %17)
%19 = load i8**, i8*** %1
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8*, i8** %19, i64 %21
store i8* %18, i8** %22
%23 = load i8**, i8*** %1
%24 = load i32, i32* %3
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8*, i8** %23, i64 %25
%27 = load i8*, i8** %26
%28 = load i64, i64* %2
%29 = call i32 @memcpy(i8* %27, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @prompt_for_message.buf, i64 0, i64 0), i64 %28)
br label %30
30: ; preds = %9
%31 = load i32, i32* %3
%32 = add nsw i32 %31, 1
store i32 %32, i32* %3
br label %6
33: ; preds = %6
%34 = load i8**, i8*** %1
ret i8** %34
}

LLVM IR (-O2):
@prompt_for_message.buf = internal global [32 x i8] zeroinitializer
@.str = [16 x i8] c"Enter line %d: \00"
define noalias i8** @prompt_for_message() {
%1 = tail call dereferenceable_or_null(16) i8* @malloc(i64 16)
%2 = bitcast i8* %1 to i8**
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = tail call i32 @get_line(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @prompt_for_message.buf, i64 0, i64 0), i32 32)
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @prompt_for_message.buf, i64 0, i64 0))
%6 = add nsw i32 %5, 1
%7 = sext i32 %6 to i64
%8 = tail call i8* @malloc(i64 %7)
store i8* %8, i8** %2
%9 = tail call i32 @memcpy(i8* %8, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @prompt_for_message.buf, i64 0, i64 0), i64 %7)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 2)
%11 = tail call i32 @get_line(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @prompt_for_message.buf, i64 0, i64 0), i32 32)
%12 = tail call i32 @strlen(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @prompt_for_message.buf, i64 0, i64 0))
%13 = add nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = tail call i8* @malloc(i64 %14)
%16 = getelementptr inbounds i8*, i8** %2, i64 1
store i8* %15, i8** %16
%17 = tail call i32 @memcpy(i8* %15, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @prompt_for_message.buf, i64 0, i64 0), i64 %14)
ret i8** %2
}