#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 */
scalar_t__ malloc(int);
int strlen(char *);
char *removeAreaNaoUsada(char *s) {
  char *nova, *origem, *destino;
  nova = (char *)malloc(sizeof(char) * (strlen(s) + 1));
  origem = s;
  destino = nova;
  while (*origem != '\0') {
    *destino = *origem;
    destino++;
    origem++;
  }
  *destino = *origem;
  return nova;
}


x86 assembly (clang, -O0):
<removeAreaNaoUsada>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1192 <removeAreaNaoUsada+0x72>
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1159 <removeAreaNaoUsada+0x39>
mov    -0x18(%rbp),%rax
mov    (%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removeAreaNaoUsada>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
lea    0x1(%rax),%edi
call   1040 <malloc@plt>
mov    (%rbx),%cl
test   %cl,%cl
je     1153 <removeAreaNaoUsada+0x33>
add    $0x1,%rbx
mov    %rax,%rdx
xchg   %ax,%ax
mov    %cl,(%rdx)
add    $0x1,%rdx
movzbl (%rbx),%ecx
add    $0x1,%rbx
test   %cl,%cl
jne    1140 <removeAreaNaoUsada+0x20>
jmp    1156 <removeAreaNaoUsada+0x36>
mov    %rax,%rdx
movb   $0x0,(%rdx)
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @removeAreaNaoUsada(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 0
br i1 %7, label %16, label %8
8: ; preds = %1, %8
%9 = phi i8 [ %14, %8 ], [ %6, %1 ]
%10 = phi i8* [ %12, %8 ], [ %5, %1 ]
%11 = phi i8* [ %13, %8 ], [ %0, %1 ]
store i8 %9, i8* %10
%12 = getelementptr inbounds i8, i8* %10, i64 1
%13 = getelementptr inbounds i8, i8* %11, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %8
16: ; preds = %8, %1
%17 = phi i8* [ %5, %1 ], [ %12, %8 ]
store i8 0, i8* %17
ret i8* %5
}