#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 */
typedef char Big;

/* Variables and functions */
int /*<<< orphan*/ ASRT_strz(char *, char *);
int /*<<< orphan*/ ASRT_true(char *);
int /*<<< orphan*/ Big_free(char *);
char *Big_from_strz(char *);
char *Big_to_strz(char *);
int /*<<< orphan*/ free(char *);
void test_to_from_strz() {
  char *strz = "1234567890";
  struct Big *big = Big_from_strz(strz);
  ASRT_true(big);
  char *strz2 = Big_to_strz(big);
  ASRT_true(strz2);
  ASRT_strz(strz, strz2);
  Big_free(big);
  free(strz2);
}


x86 assembly (clang, -O0):
<test_to_from_strz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xe91(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <Big_from_strz@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <ASRT_true@plt>
mov    -0x10(%rbp),%rdi
call   1050 <Big_to_strz@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <ASRT_true@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <ASRT_strz@plt>
mov    -0x10(%rbp),%rdi
call   1040 <Big_free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_to_from_strz>:
push   %r15
push   %r14
push   %rbx
lea    0xe94(%rip),%r14
mov    %r14,%rdi
call   1060 <Big_from_strz@plt>
mov    %rax,%r15
mov    %rax,%rdi
call   1070 <ASRT_true@plt>
mov    %r15,%rdi
call   1050 <Big_to_strz@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <ASRT_true@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1080 <ASRT_strz@plt>
mov    %r15,%rdi
call   1040 <Big_free@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.Big = type opaque
@.str = [11 x i8] c"1234567890\00"
define void @test_to_from_strz() {
%1 = alloca i8*
%2 = alloca %struct.Big*
%3 = alloca i8*
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %1
%4 = load i8*, i8** %1
%5 = call i8* @Big_from_strz(i8* %4)
%6 = bitcast i8* %5 to %struct.Big*
store %struct.Big* %6, %struct.Big** %2
%7 = load %struct.Big*, %struct.Big** %2
%8 = bitcast %struct.Big* %7 to i8*
%9 = call i32 @ASRT_true(i8* %8)
%10 = load %struct.Big*, %struct.Big** %2
%11 = bitcast %struct.Big* %10 to i8*
%12 = call i8* @Big_to_strz(i8* %11)
store i8* %12, i8** %3
%13 = load i8*, i8** %3
%14 = call i32 @ASRT_true(i8* %13)
%15 = load i8*, i8** %1
%16 = load i8*, i8** %3
%17 = call i32 @ASRT_strz(i8* %15, i8* %16)
%18 = load %struct.Big*, %struct.Big** %2
%19 = bitcast %struct.Big* %18 to i8*
%20 = call i32 @Big_free(i8* %19)
%21 = load i8*, i8** %3
%22 = call i32 @free(i8* %21)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"1234567890\00"
define void @test_to_from_strz() {
%1 = tail call i8* @Big_from_strz(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @ASRT_true(i8* %1)
%3 = tail call i8* @Big_to_strz(i8* %1)
%4 = tail call i32 @ASRT_true(i8* %3)
%5 = tail call i32 @ASRT_strz(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = tail call i32 @Big_free(i8* %1)
%7 = tail call i32 @free(i8* %3)
ret void
}