#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 **init_rm(char **rm) {
  if ((rm[0] = malloc(sizeof(char) * 10)) == NULL)
    return (NULL);
  rm[0] = "rm";
  if ((rm[1] = malloc(sizeof(char) * 10)) == NULL)
    return (NULL);
  rm[1] = "tmp";
  return (rm);
}


x86 assembly (clang, -O0):
<init_rm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    $0xa,%edi
call   1030 <malloc@plt>
mov    -0x10(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
jne    1144 <init_rm+0x34>
movq   $0x0,-0x8(%rbp)
jmp    1192 <init_rm+0x82>
mov    -0x10(%rbp),%rax
lea    0xeb1(%rip),%rcx
mov    %rcx,(%rax)
mov    $0xa,%edi
call   1030 <malloc@plt>
mov    -0x10(%rbp),%rcx
mov    %rax,0x8(%rcx)
cmp    $0x0,%rax
jne    117b <init_rm+0x6b>
movq   $0x0,-0x8(%rbp)
jmp    1192 <init_rm+0x82>
mov    -0x10(%rbp),%rax
lea    0xe7d(%rip),%rcx
mov    %rcx,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_rm>:
push   %rbx
mov    %rdi,%rbx
mov    $0xa,%edi
call   1030 <malloc@plt>
mov    %rax,(%rbx)
test   %rax,%rax
je     113d <init_rm+0x2d>
lea    0xed3(%rip),%rax
mov    %rax,(%rbx)
lea    0xecc(%rip),%rax
mov    %rax,0x8(%rbx)
jmp    113f <init_rm+0x2f>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rm\00"
@.str.1 = [4 x i8] c"tmp\00"
define i8** @init_rm(i8** %0) {
%2 = alloca i8**
%3 = alloca i8**
store i8** %0, i8*** %3
%4 = call i8* @malloc(i32 10)
%5 = load i8**, i8*** %3
%6 = getelementptr inbounds i8*, i8** %5, i64 0
store i8* %4, i8** %6
%7 = icmp eq i8* %4, null
br i1 %7, label %8, label %9
8: ; preds = %1
store i8** null, i8*** %2
br label %21
9: ; preds = %1
%10 = load i8**, i8*** %3
%11 = getelementptr inbounds i8*, i8** %10, i64 0
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %11
%12 = call i8* @malloc(i32 10)
%13 = load i8**, i8*** %3
%14 = getelementptr inbounds i8*, i8** %13, i64 1
store i8* %12, i8** %14
%15 = icmp eq i8* %12, null
br i1 %15, label %16, label %17
16: ; preds = %9
store i8** null, i8*** %2
br label %21
17: ; preds = %9
%18 = load i8**, i8*** %3
%19 = getelementptr inbounds i8*, i8** %18, i64 1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %19
%20 = load i8**, i8*** %3
store i8** %20, i8*** %2
br label %21
21: ; preds = %17, %16, %8
%22 = load i8**, i8*** %2
ret i8** %22
}

LLVM IR (-O2):
@.str = [3 x i8] c"rm\00"
@.str.1 = [4 x i8] c"tmp\00"
define i8** @init_rm(i8** writeonly %0) {
%2 = tail call dereferenceable_or_null(10) i8* @malloc(i32 10)
store i8* %2, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %0
%5 = getelementptr inbounds i8*, i8** %0, i64 1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %6
6: ; preds = %4, %1
%7 = phi i8** [ null, %1 ], [ %0, %4 ]
ret i8** %7
}