#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*/ get_path(char *, char *);
int /*<<< orphan*/ getenv(char *);
char *malloc(int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
int umount(char *);
int overlay_umount(char *command) {
  char *dirname, *homedir;
  dirname = malloc(1024 * sizeof(char));
  homedir = malloc(1024 * sizeof(char));
  get_path(dirname, command);
  strcpy(homedir, getenv("HOME"));
  strcat(homedir, "/.local/share/secapp/");
  strcat(homedir, dirname);
  strcat(homedir, "/home");
  return umount(homedir);
}


x86 assembly (clang, -O0):
<overlay_umount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x400,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x400,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1070 <get_path@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xe5c(%rip),%rdi
call   1030 <getenv@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xe46(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    0xe3f(%rip),%rsi
call   1080 <strcat@plt>
mov    -0x18(%rbp),%rdi
call   1050 <umount@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<overlay_umount>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0x400,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    $0x400,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
call   1070 <get_path@plt>
lea    0xe6c(%rip),%rdi
call   1030 <getenv@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <strcpy@plt>
lea    0xe5b(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1080 <strcat@plt>
lea    0xe57(%rip),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <umount@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [22 x i8] c"/.local/share/secapp/\00"
@.str.2 = [6 x i8] c"/home\00"
define i32 @overlay_umount(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %2
%5 = call i8* @malloc(i32 1024)
store i8* %5, i8** %3
%6 = call i8* @malloc(i32 1024)
store i8* %6, i8** %4
%7 = load i8*, i8** %3
%8 = load i8*, i8** %2
%9 = call i32 @get_path(i8* %7, i8* %8)
%10 = load i8*, i8** %4
%11 = call i32 @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @strcpy(i8* %10, i32 %11)
%13 = load i8*, i8** %4
%14 = call i32 @strcat(i8* %13, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%15 = load i8*, i8** %4
%16 = load i8*, i8** %3
%17 = call i32 @strcat(i8* %15, i8* %16)
%18 = load i8*, i8** %4
%19 = call i32 @strcat(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%20 = load i8*, i8** %4
%21 = call i32 @umount(i8* %20)
ret i32 %21
}

LLVM IR (-O2):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [22 x i8] c"/.local/share/secapp/\00"
@.str.2 = [6 x i8] c"/home\00"
define i32 @overlay_umount(i8* %0) {
%2 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%3 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%4 = tail call i32 @get_path(i8* %2, i8* %0)
%5 = tail call i32 @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @strcpy(i8* %3, i32 %5)
%7 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @strcat(i8* %3, i8* %2)
%9 = tail call i32 @strcat(i8* %3, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%10 = tail call i32 @umount(i8* %3)
ret i32 %10
}