#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 *create_string(int, char);
int /*<<< orphan*/ delete_string(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char *str1 = create_string(5, 'a');
  char *str2 = create_string(9, 'B');
  printf("str1 = %s\n", str1);
  printf("str2 = %s\n", str2);
  delete_string(str1);
  delete_string(str2);
  printf("str1 = %s\n", str1);
  printf("str2 = %s\n", str2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
mov    $0x61,%esi
call   1050 <create_string@plt>
mov    %rax,-0x10(%rbp)
mov    $0x9,%edi
mov    $0x42,%esi
call   1050 <create_string@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe8b(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <delete_string@plt>
mov    -0x18(%rbp),%rdi
call   1030 <delete_string@plt>
mov    -0x10(%rbp),%rsi
lea    0xe5e(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe59(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x5,%edi
mov    $0x61,%esi
call   1050 <create_string@plt>
mov    %rax,%r14
mov    $0x9,%edi
mov    $0x42,%esi
call   1050 <create_string@plt>
mov    %rax,%rbx
lea    0xe9d(%rip),%r15
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
lea    0xe96(%rip),%r12
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <delete_string@plt>
mov    %rbx,%rdi
call   1030 <delete_string@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [11 x i8] c"str1 = %s\0A\00"
@.str.1 = [11 x i8] c"str2 = %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i8* @create_string(i32 5, i8 signext 97)
store i8* %4, i8** %2
%5 = call i8* @create_string(i32 9, i8 signext 66)
store i8* %5, i8** %3
%6 = load i8*, i8** %2
%7 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i8*, i8** %3
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%10 = load i8*, i8** %2
%11 = call i32 @delete_string(i8* %10)
%12 = load i8*, i8** %3
%13 = call i32 @delete_string(i8* %12)
%14 = load i8*, i8** %2
%15 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i8*, i8** %3
%17 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"str1 = %s\0A\00"
@.str.1 = [11 x i8] c"str2 = %s\0A\00"
define i32 @main() {
%1 = tail call i8* @create_string(i32 5, i8 signext 97)
%2 = tail call i8* @create_string(i32 9, i8 signext 66)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = tail call i32 @delete_string(i8* %1)
%6 = tail call i32 @delete_string(i8* %2)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %1)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %2)
ret i32 0
}