#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 *, int, int, int);
int ssds_send(int, char *, char *);
int ssds_item_value(int fd, int class_num, int field_num, int item_num,
                    char *sp) {
  int ret;
  char **argv;
  char *myargv[16];
  int argc;
  char rbuf[132];
  char sbuf[132];
  argv = myargv;
  sprintf(sbuf,
          "msg 5678:class_num:%d:action:get_item_value:field_num:%d"
          ":item_num:%d:",
          class_num, field_num, item_num);
  ret = ssds_send(fd, sbuf, rbuf);
  argc = get_argc(rbuf, argv, 16);
  ret = get_arg_char(argc, argv, "value", sp, 32);
  return ret;
}


x86 assembly (clang, -O0):
<ssds_item_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
lea    -0xb0(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x1d0(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xe82(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x1d0(%rbp),%rsi
lea    -0x140(%rbp),%rdx
call   1030 <ssds_send@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x140(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x10,%edx
call   1040 <get_argc@plt>
mov    %eax,-0xb4(%rbp)
mov    -0xb4(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rcx
lea    0xe7a(%rip),%rdx
mov    $0x20,%r8d
call   1050 <get_arg_char@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssds_item_value>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x198,%rsp
mov    %r8,%r14
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%ebp
lea    0xea0(%rip),%rsi
lea    0x80(%rsp),%r15
mov    %r15,%rdi
call   1060 <sprintf@plt>
lea    0x110(%rsp),%rbx
mov    %ebp,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1030 <ssds_send@plt>
mov    %rsp,%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x10,%edx
call   1040 <get_argc@plt>
lea    0xea7(%rip),%rdx
mov    %eax,%edi
mov    %rbp,%rsi
mov    %r14,%rcx
mov    $0x20,%r8d
call   1050 <get_arg_char@plt>
add    $0x198,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [70 x i8] c"msg 5678:class_num:%d:action:get_item_value:field_num:%d:item_num:%d:\00"
@.str.1 = [6 x i8] c"value\00"
define i32 @ssds_item_value(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32
%12 = alloca i8**
%13 = alloca [16 x i8*]
%14 = alloca i32
%15 = alloca [132 x i8]
%16 = alloca [132 x i8]
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%17 = getelementptr inbounds [16 x i8*], [16 x i8*]* %13, i64 0, i64 0
store i8** %17, i8*** %12
%18 = getelementptr inbounds [132 x i8], [132 x i8]* %16, i64 0, i64 0
%19 = load i32, i32* %7
%20 = load i32, i32* %8
%21 = load i32, i32* %9
%22 = call i32 @sprintf(i8* %18, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %20, i32 %21)
%23 = load i32, i32* %6
%24 = getelementptr inbounds [132 x i8], [132 x i8]* %16, i64 0, i64 0
%25 = getelementptr inbounds [132 x i8], [132 x i8]* %15, i64 0, i64 0
%26 = call i32 @ssds_send(i32 %23, i8* %24, i8* %25)
store i32 %26, i32* %11
%27 = getelementptr inbounds [132 x i8], [132 x i8]* %15, i64 0, i64 0
%28 = load i8**, i8*** %12
%29 = call i32 @get_argc(i8* %27, i8** %28, i32 16)
store i32 %29, i32* %14
%30 = load i32, i32* %14
%31 = load i8**, i8*** %12
%32 = load i8*, i8** %10
%33 = call i32 @get_arg_char(i32 %30, i8** %31, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %32, i32 32)
store i32 %33, i32* %11
%34 = load i32, i32* %11
ret i32 %34
}

LLVM IR (-O2):
@.str = [70 x i8] c"msg 5678:class_num:%d:action:get_item_value:field_num:%d:item_num:%d:\00"
@.str.1 = [6 x i8] c"value\00"
define i32 @ssds_item_value(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca [16 x i8*]
%7 = alloca [132 x i8]
%8 = alloca [132 x i8]
%9 = bitcast [16 x i8*]* %6 to i8*
%10 = getelementptr inbounds [132 x i8], [132 x i8]* %7, i64 0, i64 0
%11 = getelementptr inbounds [132 x i8], [132 x i8]* %8, i64 0, i64 0
%12 = getelementptr inbounds [16 x i8*], [16 x i8*]* %6, i64 0, i64 0
%13 = call i32 @sprintf(i8* %11, i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2, i32 %3)
%14 = call i32 @ssds_send(i32 %0, i8* %11, i8* %10)
%15 = call i32 @get_argc(i8* %10, i8** %12, i32 16)
%16 = call i32 @get_arg_char(i32 %15, i8** %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 32)
ret i32 %16
}