#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*/ safenewpath;
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ simple_command(struct chirp_client *, int /*<<< orphan*/,
                                  char *, char *, char const *, char *);
int /*<<< orphan*/ url_encode(char const *, char *, int);
int64_t chirp_client_thirdput(struct chirp_client *c, const char *path,
                              const char *hostname, const char *newpath,
                              time_t stoptime) {
  char safepath[1024];
  char safenewpath[1024];
  url_encode(path, safepath, sizeof(safepath));
  url_encode(newpath, safenewpath, sizeof(safenewpath));
  return simple_command(c, stoptime, "thirdput %s %s %s\n", safepath, hostname,
                        safenewpath);
}


x86 assembly (clang, -O0):
<chirp_client_thirdput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x830,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x430(%rbp),%rsi
mov    $0x400,%edx
call   1040 <url_encode@plt>
mov    -0x20(%rbp),%rdi
lea    -0x830(%rbp),%rsi
mov    $0x400,%edx
call   1040 <url_encode@plt>
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
lea    -0x430(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    -0x830(%rbp),%r9
lea    0xe77(%rip),%rdx
call   1030 <simple_command@plt>
add    $0x830,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chirp_client_thirdput>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x808,%rsp
mov    %r8d,%r15d
mov    %rcx,%rbx
mov    %rdx,%r14
mov    %rdi,%rbp
lea    0x400(%rsp),%r12
mov    %rsi,%rdi
mov    %r12,%rsi
mov    $0x400,%edx
call   1040 <url_encode@plt>
mov    %rsp,%r13
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0x400,%edx
call   1040 <url_encode@plt>
lea    0xe91(%rip),%rdx
mov    %rbp,%rdi
mov    %r15d,%esi
mov    %r12,%rcx
mov    %r14,%r8
mov    %r13,%r9
call   1030 <simple_command@plt>
add    $0x808,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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