#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);
int /*<<< orphan*/ url_encode(char const *, char *, int);
int64_t chirp_client_setrep(struct chirp_client *c, char const *path, int nreps,
                            time_t stoptime) {
  char safepath[1024];
  url_encode(path, safepath, sizeof(safepath));
  return simple_command(c, stoptime, "setrep %s %d\n", safepath, nreps);
}


x86 assembly (clang, -O0):
<chirp_client_setrep>:
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    -0x10(%rbp),%rdi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
call   1040 <url_encode@plt>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%esi
lea    -0x420(%rbp),%rcx
mov    -0x14(%rbp),%r8d
lea    0xe99(%rip),%rdx
call   1030 <simple_command@plt>
add    $0x420,%rsp
pop    %rbp
ret

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

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

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