#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*/ snprintf(char *, int, char *, char const *, char,
                            unsigned long long);
char *strchr(char const *, char);
scalar_t__ time(int /*<<< orphan*/ *);
void __appendTimestamp(const char *url, char *buff, int buff_len) {
  char delim = '?';
  char *p = strchr(url, '?');
  if (p)
    delim = '&';
  snprintf(buff, buff_len, "%s%cx=%llu", url, delim,
           (unsigned long long)time(NULL));
}


x86 assembly (clang, -O0):
<__appendTimestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movb   $0x3f,-0x15(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3f,%esi
call   1030 <strchr@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1168 <__appendTimestamp+0x38>
movb   $0x26,-0x15(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x15(%rbp),%al
mov    %al,-0x21(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    -0x40(%rbp),%rdi
mov    -0x34(%rbp),%esi
mov    -0x30(%rbp),%rcx
mov    %rax,%r9
mov    -0x21(%rbp),%al
lea    0xe5b(%rip),%rdx
movsbl %al,%r8d
call   1040 <snprintf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__appendTimestamp>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %rsi,%r15
mov    %rdi,%rbp
mov    $0x3f,%r12d
mov    $0x3f,%esi
call   1030 <strchr@plt>
mov    %rax,%rbx
xor    %edi,%edi
call   1050 <time@plt>
test   %rbx,%rbx
mov    $0x26,%r8d
cmove  %r12d,%r8d
lea    0xe91(%rip),%rdx
mov    %r15,%rdi
mov    %r14d,%esi
mov    %rbp,%rcx
mov    %rax,%r9
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <snprintf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"%s%cx=%llu\00"
define void @__appendTimestamp(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8
%8 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i8 63, i8* %7
%9 = load i8*, i8** %4
%10 = call i8* @strchr(i8* %9, i8 signext 63)
store i8* %10, i8** %8
%11 = load i8*, i8** %8
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %3
store i8 38, i8* %7
br label %14
14: ; preds = %13, %3
%15 = load i8*, i8** %5
%16 = load i32, i32* %6
%17 = load i8*, i8** %4
%18 = load i8, i8* %7
%19 = call i64 @time(i32* null)
%20 = call i32 @snprintf(i8* %15, i32 %16, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %17, i8 signext %18, i64 %19)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s%cx=%llu\00"
define void @__appendTimestamp(i8* %0, i8* %1, i32 %2) {
%4 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 63)
%5 = icmp eq i8* %4, null
%6 = select i1 %5, i8 63, i8 38
%7 = tail call i64 @time(i32* null)
%8 = tail call i32 @snprintf(i8* %1, i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0, i8 signext %6, i64 %7)
ret void
}