#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 */
struct param_list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ param_add_string(char *, char *, struct param_list **,
                                    int *);
int /*<<< orphan*/ sprintf(char *, char *, long);
void param_add_hex_sig(char *name, long value, struct param_list **param,
                       int *count) {
  char buffer[1024];
  if (value < 0)
    sprintf(buffer, "-0x%lx", -value);
  else
    sprintf(buffer, "0x%lx", value);
  param_add_string(name, buffer, param, count);
}


x86 assembly (clang, -O0):
<param_add_hex_sig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    1166 <param_add_hex_sig+0x46>
lea    -0x420(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%edx
sub    -0x10(%rbp),%rdx
lea    0xea4(%rip),%rsi
call   1040 <sprintf@plt>
jmp    117d <param_add_hex_sig+0x5d>
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe89(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x420(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1030 <param_add_string@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<param_add_hex_sig>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rdx
mov    %rdi,%rbx
test   %rsi,%rsi
js     1146 <param_add_hex_sig+0x26>
lea    0xebd(%rip),%rsi
jmp    1150 <param_add_hex_sig+0x30>
neg    %rdx
lea    0xeb0(%rip),%rsi
mov    %rsp,%rdi
call   1040 <sprintf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    %r15,%rdx
mov    %r14,%rcx
call   1030 <param_add_string@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.param_list = type { i32 }
@.str = [7 x i8] c"-0x%lx\00"
@.str.1 = [6 x i8] c"0x%lx\00"
define void @param_add_hex_sig(i8* %0, i64 %1, %struct.param_list** %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca %struct.param_list**
%8 = alloca i32*
%9 = alloca [1024 x i8]
store i8* %0, i8** %5
store i64 %1, i64* %6
store %struct.param_list** %2, %struct.param_list*** %7
store i32* %3, i32** %8
%10 = load i64, i64* %6
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %4
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%14 = load i64, i64* %6
%15 = sub nsw i64 0, %14
%16 = call i32 @sprintf(i8* %13, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %15)
br label %21
17: ; preds = %4
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%19 = load i64, i64* %6
%20 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %19)
br label %21
21: ; preds = %17, %12
%22 = load i8*, i8** %5
%23 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%24 = load %struct.param_list**, %struct.param_list*** %7
%25 = load i32*, i32** %8
%26 = call i32 @param_add_string(i8* %22, i8* %23, %struct.param_list** %24, i32* %25)
ret void
}

LLVM IR (-O2):
%struct.param_list = type { i32 }
@.str = [7 x i8] c"-0x%lx\00"
@.str.1 = [6 x i8] c"0x%lx\00"
define void @param_add_hex_sig(i8* %0, i64 %1, %struct.param_list** %2, i32* %3) {
%5 = alloca [1024 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = icmp slt i64 %1, 0
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = sub nsw i64 0, %1
%10 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %9)
br label %13
11: ; preds = %4
%12 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i64 %1)
br label %13
13: ; preds = %11, %8
%14 = call i32 @param_add_string(i8* %0, i8* %6, %struct.param_list** %2, i32* %3)
ret void
}