#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_argc(char *, char **, int);
int /*<<< orphan*/ printf(char *, int);
int sprintf(char *, char *, char *, ...);
int ssds_send(int, char *, char *);
scalar_t__ strlen(char *);
int ssds_cgi_new_field(int fd, char *classsp, char *namesp, char *typesp,
                       char *valsp, char *idsp, char *lensp) {
  int ret;
  char **argv;
  char *myargv[16];
  int argc;
  char rbuf[256];
  char sbuf[256];
  argv = myargv;
  ret = sprintf(sbuf,
                "msg 5678:class:%s:action:create_field:field:%s:"
                "type:%s:len:%s:reply:yes:",
                classsp, namesp, typesp, lensp);
  if (strlen(idsp) > 0) {
    ret += sprintf(&sbuf[ret], "id:%s:", idsp);
  }
  ret = ssds_send(fd, sbuf, rbuf);
  argc = get_argc(rbuf, argv, 16);
  if (0 && argc < 0)
    printf(" Argc error %d\n", argc);
  return ret;
}


x86 assembly (clang, -O0):
<ssds_cgi_new_field>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2d0,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    -0xc0(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x2d0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
mov    0x10(%rbp),%r9
lea    0xe71(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    11d2 <ssds_cgi_new_field+0x92>
movslq -0x34(%rbp),%rax
lea    -0x2d0(%rbp),%rdi
add    %rax,%rdi
mov    -0x30(%rbp),%rdx
lea    0xe84(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
add    -0x34(%rbp),%eax
mov    %eax,-0x34(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x2d0(%rbp),%rsi
lea    -0x1d0(%rbp),%rdx
call   1040 <ssds_send@plt>
mov    %eax,-0x34(%rbp)
lea    -0x1d0(%rbp),%rdi
mov    -0x40(%rbp),%rsi
mov    $0x10,%edx
call   1050 <get_argc@plt>
mov    %eax,-0xc4(%rbp)
mov    -0x34(%rbp),%eax
add    $0x2d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssds_cgi_new_field>:
push   %rbp
push   %r14
push   %rbx
sub    $0x280,%rsp
mov    %r9,%rbx
mov    %rcx,%r8
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %edi,%r14d
mov    0x2a0(%rsp),%r9
lea    0xe97(%rip),%rsi
mov    %rsp,%rdi
xor    %eax,%eax
call   1060 <sprintf@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %rax,%rax
jle    119a <ssds_cgi_new_field+0x5a>
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rdi
lea    0xeb9(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1060 <sprintf@plt>
mov    %rsp,%rsi
lea    0x180(%rsp),%rbx
mov    %r14d,%edi
mov    %rbx,%rdx
call   1040 <ssds_send@plt>
mov    %eax,%ebp
lea    0x100(%rsp),%rsi
mov    %rbx,%rdi
mov    $0x10,%edx
call   1050 <get_argc@plt>
mov    %ebp,%eax
add    $0x280,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [73 x i8] c"msg 5678:class:%s:action:create_field:field:%s:type:%s:len:%s:reply:yes:\00"
@.str.1 = [7 x i8] c"id:%s:\00"
define i32 @ssds_cgi_new_field(i32 %0, i8* %1, i8* %2, i8* %3, i8* %4, i8* %5, i8* %6) {
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i8**
%17 = alloca [16 x i8*]
%18 = alloca i32
%19 = alloca [256 x i8]
%20 = alloca [256 x i8]
store i32 %0, i32* %8
store i8* %1, i8** %9
store i8* %2, i8** %10
store i8* %3, i8** %11
store i8* %4, i8** %12
store i8* %5, i8** %13
store i8* %6, i8** %14
%21 = getelementptr inbounds [16 x i8*], [16 x i8*]* %17, i64 0, i64 0
store i8** %21, i8*** %16
%22 = getelementptr inbounds [256 x i8], [256 x i8]* %20, i64 0, i64 0
%23 = load i8*, i8** %9
%24 = load i8*, i8** %10
%25 = load i8*, i8** %11
%26 = load i8*, i8** %14
%27 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %22, i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0), i8* %23, i8* %24, i8* %25, i8* %26)
store i32 %27, i32* %15
%28 = load i8*, i8** %13
%29 = call i64 @strlen(i8* %28)
%30 = icmp sgt i64 %29, 0
br i1 %30, label %31, label %39
31: ; preds = %7
%32 = load i32, i32* %15
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %20, i64 0, i64 %33
%35 = load i8*, i8** %13
%36 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %34, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %35)
%37 = load i32, i32* %15
%38 = add nsw i32 %37, %36
store i32 %38, i32* %15
br label %39
39: ; preds = %31, %7
%40 = load i32, i32* %8
%41 = getelementptr inbounds [256 x i8], [256 x i8]* %20, i64 0, i64 0
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%43 = call i32 @ssds_send(i32 %40, i8* %41, i8* %42)
store i32 %43, i32* %15
%44 = getelementptr inbounds [256 x i8], [256 x i8]* %19, i64 0, i64 0
%45 = load i8**, i8*** %16
%46 = call i32 @get_argc(i8* %44, i8** %45, i32 16)
store i32 %46, i32* %18
%47 = load i32, i32* %15
ret i32 %47
}

LLVM IR (-O2):
@.str = [73 x i8] c"msg 5678:class:%s:action:create_field:field:%s:type:%s:len:%s:reply:yes:\00"
@.str.1 = [7 x i8] c"id:%s:\00"
define i32 @ssds_cgi_new_field(i32 %0, i8* %1, i8* %2, i8* %3, i8* nocapture readnone %4, i8* %5, i8* %6) {
%8 = alloca [16 x i8*]
%9 = alloca [256 x i8]
%10 = alloca [256 x i8]
%11 = bitcast [16 x i8*]* %8 to i8*
%12 = getelementptr inbounds [256 x i8], [256 x i8]* %9, i64 0, i64 0
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%14 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %13, i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2, i8* %3, i8* %6)
%15 = tail call i64 @strlen(i8* dereferenceable(1) %5)
%16 = icmp sgt i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %7
%18 = sext i32 %14 to i64
%19 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 %18
%20 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %19, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %5)
br label %21
21: ; preds = %17, %7
%22 = getelementptr inbounds [16 x i8*], [16 x i8*]* %8, i64 0, i64 0
%23 = call i32 @ssds_send(i32 %0, i8* %13, i8* %12)
%24 = call i32 @get_argc(i8* %12, i8** %22, i32 16)
ret i32 %23
}