#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 ssds_send(int, char *, char *);
int ssds_field_id(int fd, int class_num, int field_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_field_num:field_num:%d:", class_num,
          field_num);
  ret = ssds_send(fd, sbuf, rbuf);
  argc = get_argc(rbuf, argv, 16);
  ret = get_arg_char(argc, argv, "id", sp, 32);
  return ret;
}


x86 assembly (clang, -O0):
<ssds_field_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
lea    -0xb0(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x1d0(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe89(%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    0xe74(%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_field_id>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x198,%rsp
mov    %rcx,%r14
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%ebp
lea    0xea3(%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    0xe9d(%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 = [57 x i8] c"msg 5678:class_num:%d:action:get_field_num:field_num:%d:\00"
@.str.1 = [3 x i8] c"id\00"
define i32 @ssds_field_id(i32 %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i8**
%11 = alloca [16 x i8*]
%12 = alloca i32
%13 = alloca [132 x i8]
%14 = alloca [132 x i8]
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8* %3, i8** %8
%15 = getelementptr inbounds [16 x i8*], [16 x i8*]* %11, i64 0, i64 0
store i8** %15, i8*** %10
%16 = getelementptr inbounds [132 x i8], [132 x i8]* %14, i64 0, i64 0
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = call i32 @sprintf(i8* %16, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i32 %17, i32 %18)
%20 = load i32, i32* %5
%21 = getelementptr inbounds [132 x i8], [132 x i8]* %14, i64 0, i64 0
%22 = getelementptr inbounds [132 x i8], [132 x i8]* %13, i64 0, i64 0
%23 = call i32 @ssds_send(i32 %20, i8* %21, i8* %22)
store i32 %23, i32* %9
%24 = getelementptr inbounds [132 x i8], [132 x i8]* %13, i64 0, i64 0
%25 = load i8**, i8*** %10
%26 = call i32 @get_argc(i8* %24, i8** %25, i32 16)
store i32 %26, i32* %12
%27 = load i32, i32* %12
%28 = load i8**, i8*** %10
%29 = load i8*, i8** %8
%30 = call i32 @get_arg_char(i32 %27, i8** %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %29, i32 32)
store i32 %30, i32* %9
%31 = load i32, i32* %9
ret i32 %31
}

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