#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 *);
int /*<<< orphan*/ getchar();
char *malloc(int);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  char *p1 = malloc(7);
  strcpy(p1, "1111111");
  char *p2 = malloc(9);
  strcpy(p2, "222222222");
  char *p3 = malloc(17);
  strcpy(p3, "33333333333333333");
  free(p3);
  free(p2);
  getchar();
  free(p1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x7,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe98(%rip),%rsi
call   1040 <strcpy@plt>
mov    $0x9,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1040 <strcpy@plt>
mov    $0x11,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe6e(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x7,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
lea    0xea7(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    $0x9,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
lea    0xe93(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    $0x11,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xe81(%rip),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"1111111\00"
@.str.1 = [10 x i8] c"222222222\00"
@.str.2 = [18 x i8] c"33333333333333333\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i32 0, i32* %1
%5 = call i8* @malloc(i32 7)
store i8* %5, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%8 = call i8* @malloc(i32 9)
store i8* %8, i8** %3
%9 = load i8*, i8** %3
%10 = call i32 @strcpy(i8* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%11 = call i8* @malloc(i32 17)
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = call i32 @strcpy(i8* %12, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%14 = load i8*, i8** %4
%15 = call i32 @free(i8* %14)
%16 = load i8*, i8** %3
%17 = call i32 @free(i8* %16)
%18 = call i32 (...) @getchar()
%19 = load i8*, i8** %2
%20 = call i32 @free(i8* %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"1111111\00"
@.str.1 = [10 x i8] c"222222222\00"
@.str.2 = [18 x i8] c"33333333333333333\00"
define i32 @main() {
%1 = tail call dereferenceable_or_null(7) i8* @malloc(i32 7)
%2 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = tail call dereferenceable_or_null(9) i8* @malloc(i32 9)
%4 = tail call i32 @strcpy(i8* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call dereferenceable_or_null(17) i8* @malloc(i32 17)
%6 = tail call i32 @strcpy(i8* %5, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @free(i8* %5)
%8 = tail call i32 @free(i8* %3)
%9 = tail call i32 (...) @getchar()
%10 = tail call i32 @free(i8* %1)
ret i32 0
}