#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 **malloc(int);
char **env_create_new(size_t size) {
  char **new_env;
  if (!(new_env = NULL) && !(new_env = malloc(sizeof(char *) * size + 1)))
    return (NULL);
  while (size != 0) {
    new_env[size] = NULL;
    --size;
  }
  return (new_env);
}


x86 assembly (clang, -O0):
<env_create_new>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
xor    %eax,%eax
test   $0x1,%al
jne    115c <env_create_new+0x4c>
mov    -0x10(%rbp),%rax
shl    $0x3,%rax
add    $0x1,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    115c <env_create_new+0x4c>
movq   $0x0,-0x8(%rbp)
jmp    1195 <env_create_new+0x85>
jmp    1161 <env_create_new+0x51>
cmpq   $0x0,-0x10(%rbp)
je     118d <env_create_new+0x7d>
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1161 <env_create_new+0x51>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<env_create_new>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0x1(,%rdi,8),%edi
call   1040 <malloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     1155 <env_create_new+0x35>
test   %rbx,%rbx
je     1155 <env_create_new+0x35>
mov    %r14,%rdi
add    $0x8,%rdi
shl    $0x3,%rbx
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8** @env_create_new(i64 %0) {
%2 = alloca i8**
%3 = alloca i64
%4 = alloca i8**
store i64 %0, i64* %3
store i8** null, i8*** %4
br i1 false, label %13, label %5
5: ; preds = %1
%6 = load i64, i64* %3
%7 = mul i64 8, %6
%8 = add i64 %7, 1
%9 = trunc i64 %8 to i32
%10 = call i8** @malloc(i32 %9)
store i8** %10, i8*** %4
%11 = icmp ne i8** %10, null
br i1 %11, label %13, label %12
12: ; preds = %5
store i8** null, i8*** %2
br label %25
13: ; preds = %5, %1
br label %14
14: ; preds = %17, %13
%15 = load i64, i64* %3
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %23
17: ; preds = %14
%18 = load i8**, i8*** %4
%19 = load i64, i64* %3
%20 = getelementptr inbounds i8*, i8** %18, i64 %19
store i8* null, i8** %20
%21 = load i64, i64* %3
%22 = add i64 %21, -1
store i64 %22, i64* %3
br label %14
23: ; preds = %14
%24 = load i8**, i8*** %4
store i8** %24, i8*** %2
br label %25
25: ; preds = %23, %12
%26 = load i8**, i8*** %2
ret i8** %26
}

LLVM IR (-O2):
define noalias i8** @env_create_new(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = shl i32 %2, 3
%4 = or i32 %3, 1
%5 = tail call i8** @malloc(i32 %4)
%6 = icmp eq i8** %5, null
%7 = icmp eq i64 %0, 0
%8 = or i1 %6, %7
br i1 %8, label %13, label %9
9: ; preds = %1
%10 = getelementptr i8*, i8** %5, i64 1
%11 = bitcast i8** %10 to i8*
%12 = shl nuw i64 %0, 3
br label %13
13: ; preds = %9, %1
ret i8** %5
}