#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*/ printf(char *, ...);
int tl_malloc(int, void *);
void mem_test(void) {
  unsigned char *ptr1;
  unsigned char *ptr2;
  unsigned char *ptr3;
  unsigned char *ptr4;
  unsigned char *ptr5;
  unsigned char *ptr6;
  printf("------------------------mem_test:-------------------------\n");
  printf("ret=%d\n", tl_malloc(11, (void *)&ptr1));
  printf("ret=%d\n", tl_malloc(11, (void *)&ptr2));
  printf("ret=%d\n", tl_malloc(13, (void *)&ptr3));
  printf("ret=%d\n", tl_malloc(113, (void *)&ptr4));
  printf("ret=%d\n", tl_malloc(53, (void *)&ptr5));
  printf("ret=%d\n", tl_malloc(121, (void *)&ptr6));
}


x86 assembly (clang, -O0):
<mem_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x8(%rbp),%rsi
mov    $0xb,%edi
call   1040 <tl_malloc@plt>
mov    %eax,%esi
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x10(%rbp),%rsi
mov    $0xb,%edi
call   1040 <tl_malloc@plt>
mov    %eax,%esi
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x18(%rbp),%rsi
mov    $0xd,%edi
call   1040 <tl_malloc@plt>
mov    %eax,%esi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0x71,%edi
call   1040 <tl_malloc@plt>
mov    %eax,%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x28(%rbp),%rsi
mov    $0x35,%edi
call   1040 <tl_malloc@plt>
mov    %eax,%esi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
mov    $0x79,%edi
call   1040 <tl_malloc@plt>
mov    %eax,%esi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_test>:
push   %rbx
sub    $0x30,%rsp
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
lea    0x28(%rsp),%rsi
mov    $0xb,%edi
call   1050 <tl_malloc@plt>
lea    0xea9(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x20(%rsp),%rsi
mov    $0xb,%edi
call   1050 <tl_malloc@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x18(%rsp),%rsi
mov    $0xd,%edi
call   1050 <tl_malloc@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rsi
mov    $0x71,%edi
call   1050 <tl_malloc@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    $0x35,%edi
call   1050 <tl_malloc@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    $0x79,%edi
call   1050 <tl_malloc@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [60 x i8] c"------------------------mem_test:-------------------------\0A\00"
@.str.1 = [8 x i8] c"ret=%d\0A\00"
define void @mem_test() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0))
%8 = bitcast i8** %1 to i8*
%9 = call i32 @tl_malloc(i32 11, i8* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = bitcast i8** %2 to i8*
%12 = call i32 @tl_malloc(i32 11, i8* %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = bitcast i8** %3 to i8*
%15 = call i32 @tl_malloc(i32 13, i8* %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = bitcast i8** %4 to i8*
%18 = call i32 @tl_malloc(i32 113, i8* %17)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = bitcast i8** %5 to i8*
%21 = call i32 @tl_malloc(i32 53, i8* %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = bitcast i8** %6 to i8*
%24 = call i32 @tl_malloc(i32 121, i8* %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %24)
ret void
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"ret=%d\0A\00"
@str = [59 x i8] c"------------------------mem_test:-------------------------\00"
define void @mem_test() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = bitcast i8** %1 to i8*
%8 = bitcast i8** %2 to i8*
%9 = bitcast i8** %3 to i8*
%10 = bitcast i8** %4 to i8*
%11 = bitcast i8** %5 to i8*
%12 = bitcast i8** %6 to i8*
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @str, i64 0, i64 0))
%14 = call i32 @tl_malloc(i32 11, i8* %7)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = call i32 @tl_malloc(i32 11, i8* %8)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = call i32 @tl_malloc(i32 13, i8* %9)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = call i32 @tl_malloc(i32 113, i8* %10)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = call i32 @tl_malloc(i32 53, i8* %11)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %22)
%24 = call i32 @tl_malloc(i32 121, i8* %12)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %24)
ret void
}