#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 get_arg_char(int, char **, char *, char *, int);
int get_argc(char *, char **, int);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int ssds_send(int, char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int ssds_item_keyx(int fd, char *tok, char *sp, char *key) {
  int ret;
  char **argv;
  char *myargv[16];
  int argc;
  int len;
  char rbuf[256];
  char sbuf[256];
  argv = myargv;
  strcpy(rbuf, tok);
  len = strlen(rbuf);
  rbuf[len - 2] = 0;
  sprintf(sbuf, "msg 5678:action:%s:", rbuf);
  ret = ssds_send(fd, sbuf, rbuf);
  argc = get_argc(rbuf, argv, 16);
  ret = 0;
  ret = get_arg_char(argc, argv, key, sp, 32);
  return ret;
}


x86 assembly (clang, -O0):
<ssds_item_keyx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2c0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0xb0(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x1c0(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x1c0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xb8(%rbp)
mov    -0xb8(%rbp),%eax
sub    $0x2,%eax
cltq
movb   $0x0,-0x1c0(%rbp,%rax,1)
lea    -0x2c0(%rbp),%rdi
lea    -0x1c0(%rbp),%rdx
lea    0xe31(%rip),%rsi
call   1080 <sprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x2c0(%rbp),%rsi
lea    -0x1c0(%rbp),%rdx
call   1050 <ssds_send@plt>
mov    %eax,-0x24(%rbp)
lea    -0x1c0(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    $0x10,%edx
call   1060 <get_argc@plt>
mov    %eax,-0xb4(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0xb4(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x20,%r8d
call   1070 <get_arg_char@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x2c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssds_item_keyx>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x280,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %edi,%r12d
lea    0x180(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
movb   $0x0,-0x2(%rax,%rbx,1)
lea    0xe62(%rip),%rsi
lea    0x80(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
call   1080 <sprintf@plt>
mov    %r12d,%edi
mov    %rbp,%rsi
mov    %rbx,%rdx
call   1050 <ssds_send@plt>
mov    %rsp,%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x10,%edx
call   1060 <get_argc@plt>
mov    %eax,%edi
mov    %rbp,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    $0x20,%r8d
call   1070 <get_arg_char@plt>
add    $0x280,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"msg 5678:action:%s:\00"
define i32 @ssds_item_keyx(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8**
%11 = alloca [16 x i8*]
%12 = alloca i32
%13 = alloca i32
%14 = alloca [256 x i8]
%15 = alloca [256 x i8]
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%16 = getelementptr inbounds [16 x i8*], [16 x i8*]* %11, i64 0, i64 0
store i8** %16, i8*** %10
%17 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%18 = load i8*, i8** %6
%19 = call i32 @strcpy(i8* %17, i8* %18)
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
store i32 %21, i32* %13
%22 = load i32, i32* %13
%23 = sub nsw i32 %22, 2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 %24
store i8 0, i8* %25
%26 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%27 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%28 = call i32 @sprintf(i8* %26, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %27)
%29 = load i32, i32* %5
%30 = getelementptr inbounds [256 x i8], [256 x i8]* %15, i64 0, i64 0
%31 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%32 = call i32 @ssds_send(i32 %29, i8* %30, i8* %31)
store i32 %32, i32* %9
%33 = getelementptr inbounds [256 x i8], [256 x i8]* %14, i64 0, i64 0
%34 = load i8**, i8*** %10
%35 = call i32 @get_argc(i8* %33, i8** %34, i32 16)
store i32 %35, i32* %12
store i32 0, i32* %9
%36 = load i32, i32* %12
%37 = load i8**, i8*** %10
%38 = load i8*, i8** %8
%39 = load i8*, i8** %7
%40 = call i32 @get_arg_char(i32 %36, i8** %37, i8* %38, i8* %39, i32 32)
store i32 %40, i32* %9
%41 = load i32, i32* %9
ret i32 %41
}

LLVM IR (-O2):
@.str = [20 x i8] c"msg 5678:action:%s:\00"
define i32 @ssds_item_keyx(i32 %0, i8* %1, i8* %2, i8* %3) {
%5 = alloca [16 x i8*]
%6 = alloca [256 x i8]
%7 = alloca [256 x i8]
%8 = bitcast [16 x i8*]* %5 to i8*
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%11 = getelementptr inbounds [16 x i8*], [16 x i8*]* %5, i64 0, i64 0
%12 = call i32 @strcpy(i8* %9, i8* %1)
%13 = call i32 @strlen(i8* %9)
%14 = add nsw i32 %13, -2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 %15
store i8 0, i8* %16
%17 = call i32 @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %9)
%18 = call i32 @ssds_send(i32 %0, i8* %10, i8* %9)
%19 = call i32 @get_argc(i8* %9, i8** %11, i32 16)
%20 = call i32 @get_arg_char(i32 %19, i8** %11, i8* %3, i8* %2, i32 32)
ret i32 %20
}