#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 */
typedef int /*<<< orphan*/ time_t;
struct chirp_client {
  int dummy;
};
typedef int /*<<< orphan*/ safepath;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ simple_command(struct chirp_client *, int /*<<< orphan*/,
                                  char *, char *, int /*<<< orphan*/,
                                  int /*<<< orphan*/);
int /*<<< orphan*/ url_encode(char const *, char *, int);
int64_t chirp_client_mkalloc(struct chirp_client *c, char const *path,
                             int64_t size, int64_t mode, time_t stoptime) {
  char safepath[1024];
  url_encode(path, safepath, sizeof(safepath));
  return simple_command(c, stoptime, "mkalloc %s %lld %lld\n", safepath, size,
                        mode);
}


x86 assembly (clang, -O0):
<chirp_client_mkalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   1040 <url_encode@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
lea    -0x420(%rbp),%rcx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
lea    0xe91(%rip),%rdx
call   1030 <simple_command@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chirp_client_mkalloc>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x400,%rsp
mov    %r8d,%ebx
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %rdi,%rbp
mov    %rsp,%r12
mov    %rsi,%rdi
mov    %r12,%rsi
mov    $0x400,%edx
call   1040 <url_encode@plt>
lea    0xeab(%rip),%rdx
mov    %rbp,%rdi
mov    %ebx,%esi
mov    %r12,%rcx
mov    %r15d,%r8d
mov    %r14d,%r9d
call   1030 <simple_command@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.chirp_client = type { i32 }
@.str = [22 x i8] c"mkalloc %s %lld %lld\0A\00"
define i32 @chirp_client_mkalloc(%struct.chirp_client* %0, i8* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.chirp_client*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [1024 x i8]
store %struct.chirp_client* %0, %struct.chirp_client** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load i8*, i8** %7
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%14 = call i32 @url_encode(i8* %12, i8* %13, i32 1024)
%15 = load %struct.chirp_client*, %struct.chirp_client** %6
%16 = load i32, i32* %10
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%18 = load i32, i32* %8
%19 = load i32, i32* %9
%20 = call i32 @simple_command(%struct.chirp_client* %15, i32 %16, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %17, i32 %18, i32 %19)
ret i32 %20
}

LLVM IR (-O2):
%struct.chirp_client = type { i32 }
@.str = [22 x i8] c"mkalloc %s %lld %lld\0A\00"
define i32 @chirp_client_mkalloc(%struct.chirp_client* %0, i8* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca [1024 x i8]
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%8 = call i32 @url_encode(i8* %1, i8* %7, i32 1024)
%9 = call i32 @simple_command(%struct.chirp_client* %0, i32 %4, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %2, i32 %3)
ret i32 %9
}