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


x86 assembly (clang, -O0):
<ssds_class_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
lea    -0xa0(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x1c0(%rbp),%rdi
mov    -0x8(%rbp),%edx
lea    0xe8f(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x1c0(%rbp),%rsi
lea    -0x130(%rbp),%rdx
call   1030 <ssds_send@plt>
mov    %eax,-0x14(%rbp)
lea    -0x130(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x10,%edx
call   1040 <get_argc@plt>
mov    %eax,-0xa4(%rbp)
mov    -0xa4(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%rcx
lea    0xe6a(%rip),%rdx
mov    $0x20,%r8d
call   1050 <get_arg_char@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssds_class_id>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x198,%rsp
mov    %rdx,%r14
mov    %esi,%edx
mov    %edi,%ebp
lea    0xea5(%rip),%rsi
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <sprintf@plt>
lea    0x110(%rsp),%r15
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <ssds_send@plt>
mov    %rsp,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x10,%edx
call   1040 <get_argc@plt>
lea    0xe8f(%rip),%rdx
mov    %eax,%edi
mov    %rbx,%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 = [41 x i8] c"msg 5678:action:get_fields:class_num:%d:\00"
@.str.1 = [3 x i8] c"id\00"
define i32 @ssds_class_id(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8**
%9 = alloca [16 x i8*]
%10 = alloca i32
%11 = alloca [132 x i8]
%12 = alloca [132 x i8]
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%13 = getelementptr inbounds [16 x i8*], [16 x i8*]* %9, i64 0, i64 0
store i8** %13, i8*** %8
%14 = getelementptr inbounds [132 x i8], [132 x i8]* %12, i64 0, i64 0
%15 = load i32, i32* %5
%16 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = load i32, i32* %4
%18 = getelementptr inbounds [132 x i8], [132 x i8]* %12, i64 0, i64 0
%19 = getelementptr inbounds [132 x i8], [132 x i8]* %11, i64 0, i64 0
%20 = call i32 @ssds_send(i32 %17, i8* %18, i8* %19)
store i32 %20, i32* %7
%21 = getelementptr inbounds [132 x i8], [132 x i8]* %11, i64 0, i64 0
%22 = load i8**, i8*** %8
%23 = call i32 @get_argc(i8* %21, i8** %22, i32 16)
store i32 %23, i32* %10
%24 = load i32, i32* %10
%25 = load i8**, i8*** %8
%26 = load i8*, i8** %6
%27 = call i32 @get_arg_char(i32 %24, i8** %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %26, i32 32)
store i32 %27, i32* %7
%28 = load i32, i32* %7
ret i32 %28
}

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