#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 /*<<< orphan*/ get_arg_char(int, char **, char *, char *, int);
int get_arg_int(int, char **, char *, int *);
int get_argc(char *, char **, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int ssds_send(int, char *, char *);
int test_ssds(int fd) {
  int ret;
  int res;
  int num;
  int i;
  int id;
  char **argv;
  char *myargv[16];
  int argc;
  int fields;
  int items;
  char myclass[32];
  char rbuf[132];
  char sbuf[132];
  argv = myargv;
  ret = 0;
  num = -1;
  sprintf(sbuf, "msg 5678:action:get_classes:");
  res = ssds_send(fd, sbuf, rbuf);
  if (res < 0)
    printf(" Client res error %d \n", res);
  argc = get_argc(rbuf, argv, 16);
  ret = get_arg_int(argc, argv, "reply", &num);
  for (i = 0; i < num; i++) {
    sprintf(sbuf, "msg 5678:action:get_class_num:num:%d:", i);
    res = ssds_send(fd, sbuf, rbuf);
    if (res < 0)
      printf(" Client res error %d \n", res);
    argc = get_argc(rbuf, argv, 16);
    get_arg_char(argc, argv, "class", myclass, 32);
    ret = get_arg_int(argc, argv, "id", &id);
    if (ret == 0) {
      printf(" Client class name (%s) id %d \n", myclass, id);
      sprintf(sbuf, "msg 5678:action:get_fields:id:%d:", id);
      res = ssds_send(fd, sbuf, rbuf);
      if (res < 0)
        printf(" Client res error %d \n", res);
      argc = get_argc(rbuf, argv, 16);
      get_arg_char(argc, argv, "class", myclass, 32);
      ret = get_arg_int(argc, argv, "reply", &fields);
      sprintf(sbuf, "msg 5678:action:get_items:id:%d:", id);
      res = ssds_send(fd, sbuf, rbuf);
      if (res < 0)
        printf(" Client res error %d \n", res);
      argc = get_argc(rbuf, argv, 16);
      get_arg_char(argc, argv, "class", myclass, 32);
      ret = get_arg_int(argc, argv, "reply", &items);
      printf(" Client class (%s) id %d num fields %d num items %d\n", myclass,
             id, fields, items);
    } else {
      printf(" Client class name NOT_FOUND \n");
    }
  }
  return ret;
}


x86 assembly (clang, -O0):
<test_ssds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f0,%rsp
mov    %edi,-0x4(%rbp)
lea    -0xa0(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0xffffffff,-0x10(%rbp)
lea    -0x1f0(%rbp),%rdi
lea    0xe6b(%rip),%rsi
mov    $0x0,%al
call   1080 <sprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x1f0(%rbp),%rsi
lea    -0x160(%rbp),%rdx
call   1040 <ssds_send@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    11d0 <test_ssds+0x70>
mov    -0xc(%rbp),%esi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x10,%edx
call   1050 <get_argc@plt>
mov    %eax,-0xa4(%rbp)
mov    -0xa4(%rbp),%edi
mov    -0x20(%rbp),%rsi
lea    0xe38(%rip),%rdx
lea    -0x10(%rbp),%rcx
call   1070 <get_arg_int@plt>
mov    %eax,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1483 <test_ssds+0x323>
lea    -0x1f0(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xe0e(%rip),%rsi
mov    $0x0,%al
call   1080 <sprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x1f0(%rbp),%rsi
lea    -0x160(%rbp),%rdx
call   1040 <ssds_send@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1267 <test_ssds+0x107>
mov    -0xc(%rbp),%esi
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x10,%edx
call   1050 <get_argc@plt>
mov    %eax,-0xa4(%rbp)
mov    -0xa4(%rbp),%edi
mov    -0x20(%rbp),%rsi
lea    -0xd0(%rbp),%rcx
lea    0xdc6(%rip),%rdx
mov    $0x20,%r8d
call   1060 <get_arg_char@plt>
mov    -0xa4(%rbp),%edi
mov    -0x20(%rbp),%rsi
lea    0xdb0(%rip),%rdx
lea    -0x18(%rbp),%rcx
call   1070 <get_arg_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1462 <test_ssds+0x302>
lea    -0xd0(%rbp),%rsi
mov    -0x18(%rbp),%edx
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x1f0(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xd94(%rip),%rsi
mov    $0x0,%al
call   1080 <sprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x1f0(%rbp),%rsi
lea    -0x160(%rbp),%rdx
call   1040 <ssds_send@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1330 <test_ssds+0x1d0>
mov    -0xc(%rbp),%esi
lea    0xcf4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x10,%edx
call   1050 <get_argc@plt>
mov    %eax,-0xa4(%rbp)
mov    -0xa4(%rbp),%edi
mov    -0x20(%rbp),%rsi
lea    -0xd0(%rbp),%rcx
lea    0xcfd(%rip),%rdx
mov    $0x20,%r8d
call   1060 <get_arg_char@plt>
mov    -0xa4(%rbp),%edi
mov    -0x20(%rbp),%rsi
lea    0xcb5(%rip),%rdx
lea    -0xa8(%rbp),%rcx
call   1070 <get_arg_int@plt>
mov    %eax,-0x8(%rbp)
lea    -0x1f0(%rbp),%rdi
mov    -0x18(%rbp),%edx
lea    0xd0c(%rip),%rsi
mov    $0x0,%al
call   1080 <sprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x1f0(%rbp),%rsi
lea    -0x160(%rbp),%rdx
call   1040 <ssds_send@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    13da <test_ssds+0x27a>
mov    -0xc(%rbp),%esi
lea    0xc4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x160(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    $0x10,%edx
call   1050 <get_argc@plt>
mov    %eax,-0xa4(%rbp)
mov    -0xa4(%rbp),%edi
mov    -0x20(%rbp),%rsi
lea    -0xd0(%rbp),%rcx
lea    0xc53(%rip),%rdx
mov    $0x20,%r8d
call   1060 <get_arg_char@plt>
mov    -0xa4(%rbp),%edi
mov    -0x20(%rbp),%rsi
lea    0xc0b(%rip),%rdx
lea    -0xac(%rbp),%rcx
call   1070 <get_arg_int@plt>
mov    %eax,-0x8(%rbp)
lea    -0xd0(%rbp),%rsi
mov    -0x18(%rbp),%edx
mov    -0xa8(%rbp),%ecx
mov    -0xac(%rbp),%r8d
lea    0xc76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1470 <test_ssds+0x310>
lea    0xc98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1475 <test_ssds+0x315>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    120f <test_ssds+0xaf>
mov    -0x8(%rbp),%eax
add    $0x1f0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_ssds>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1e8,%rsp
movl   $0xffffffff,0x14(%rsp)
ff
movups 0xe70(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movups 0xe71(%rip),%xmm0
movups %xmm0,0x2d(%rsp)
lea    0x20(%rsp),%rsi
lea    0xb0(%rsp),%rdx
mov    %edi,0x10(%rsp)
call   1050 <ssds_send@plt>
test   %eax,%eax
jns    11cb <test_ssds+0x5b>
lea    0xe5b(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xb0(%rsp),%rdi
lea    0x160(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x10,%edx
call   1060 <get_argc@plt>
lea    0xe45(%rip),%rdx
lea    0x14(%rsp),%rcx
mov    %eax,%edi
mov    %rbx,%rsi
call   1080 <get_arg_int@plt>
cmpl   $0x0,0x14(%rsp)
jle    141e <test_ssds+0x2ae>
lea    0xe50(%rip),%r15
lea    0x140(%rsp),%r13
xor    %r12d,%r12d
jmp    123e <test_ssds+0xce>
nopl   (%rax)
mov    %eax,%r14d
lea    0xed7(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%r12d
cmp    0x14(%rsp),%r12d
jge    1421 <test_ssds+0x2b1>
mov    %r13,%r14
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
lea    0xdea(%rip),%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   1090 <sprintf@plt>
mov    0x10(%rsp),%edi
mov    %rbp,%rsi
lea    0xb0(%rsp),%rbx
mov    %rbx,%rdx
call   1050 <ssds_send@plt>
test   %eax,%eax
jns    1285 <test_ssds+0x115>
lea    0xda1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
lea    0x160(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x10,%edx
call   1060 <get_argc@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r14,%r13
mov    %r14,%rcx
mov    $0x20,%r8d
call   1070 <get_arg_char@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
lea    0xda2(%rip),%rdx
lea    0xc(%rsp),%rcx
call   1080 <get_arg_int@plt>
test   %eax,%eax
jne    1220 <test_ssds+0xb0>
mov    0xc(%rsp),%edx
lea    0xd88(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%edx
lea    0x20(%rsp),%r14
mov    %r14,%rdi
lea    0xd8b(%rip),%rsi
xor    %eax,%eax
call   1090 <sprintf@plt>
mov    0x10(%rsp),%edi
mov    %r14,%rsi
lea    0xb0(%rsp),%rbp
mov    %rbp,%rdx
call   1050 <ssds_send@plt>
test   %eax,%eax
jns    1330 <test_ssds+0x1c0>
lea    0xcf6(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
lea    0x160(%rsp),%r14
mov    %r14,%rsi
mov    $0x10,%edx
call   1060 <get_argc@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r13,%rcx
mov    $0x20,%r8d
call   1070 <get_arg_char@plt>
mov    %ebp,%edi
mov    %r14,%rsi
lea    0xcc8(%rip),%rbx
mov    %rbx,%rdx
lea    0x1c(%rsp),%rcx
call   1080 <get_arg_int@plt>
mov    0xc(%rsp),%edx
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
lea    0xd1f(%rip),%rsi
xor    %eax,%eax
call   1090 <sprintf@plt>
mov    0x10(%rsp),%edi
mov    %rbp,%rsi
lea    0xb0(%rsp),%rbp
mov    %rbp,%rdx
call   1050 <ssds_send@plt>
test   %eax,%eax
jns    13be <test_ssds+0x24e>
lea    0xc68(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
call   1060 <get_argc@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r13,%rcx
mov    $0x20,%r8d
call   1070 <get_arg_char@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
lea    0x18(%rsp),%rcx
call   1080 <get_arg_int@plt>
mov    %eax,%r14d
mov    0xc(%rsp),%edx
mov    0x1c(%rsp),%ecx
mov    0x18(%rsp),%r8d
lea    0xcbd(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    122f <test_ssds+0xbf>
mov    %eax,%r14d
mov    %r14d,%eax
add    $0x1e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"msg 5678:action:get_classes:\00"
@.str.1 = [23 x i8] c" Client res error %d \0A\00"
@.str.2 = [6 x i8] c"reply\00"
@.str.3 = [38 x i8] c"msg 5678:action:get_class_num:num:%d:\00"
@.str.4 = [6 x i8] c"class\00"
@.str.5 = [3 x i8] c"id\00"
@.str.6 = [32 x i8] c" Client class name (%s) id %d \0A\00"
@.str.7 = [34 x i8] c"msg 5678:action:get_fields:id:%d:\00"
@.str.8 = [33 x i8] c"msg 5678:action:get_items:id:%d:\00"
@.str.9 = [53 x i8] c" Client class (%s) id %d num fields %d num items %d\0A\00"
@.str.10 = [31 x i8] c" Client class name NOT_FOUND \0A\00"
define i32 @test_ssds(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
%9 = alloca [16 x i8*]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca [32 x i8]
%14 = alloca [132 x i8]
%15 = alloca [132 x i8]
store i32 %0, i32* %2
%16 = getelementptr inbounds [16 x i8*], [16 x i8*]* %9, i64 0, i64 0
store i8** %16, i8*** %8
store i32 0, i32* %3
store i32 -1, i32* %5
%17 = getelementptr inbounds [132 x i8], [132 x i8]* %15, i64 0, i64 0
%18 = call i32 (i8*, i8*, ...) @sprintf(i8* %17, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%19 = load i32, i32* %2
%20 = getelementptr inbounds [132 x i8], [132 x i8]* %15, i64 0, i64 0
%21 = getelementptr inbounds [132 x i8], [132 x i8]* %14, i64 0, i64 0
%22 = call i32 @ssds_send(i32 %19, i8* %20, i8* %21)
store i32 %22, i32* %4
%23 = load i32, i32* %4
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %1
%26 = load i32, i32* %4
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %26)
br label %28
28: ; preds = %25, %1
%29 = getelementptr inbounds [132 x i8], [132 x i8]* %14, i64 0, i64 0
%30 = load i8**, i8*** %8
%31 = call i32 @get_argc(i8* %29, i8** %30, i32 16)
store i32 %31, i32* %10
%32 = load i32, i32* %10
%33 = load i8**, i8*** %8
%34 = call i32 @get_arg_int(i32 %32, i8** %33, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %5)
store i32 %34, i32* %3
store i32 0, i32* %6
br label %35
35: ; preds = %123, %28
%36 = load i32, i32* %6
%37 = load i32, i32* %5
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %126
39: ; preds = %35
%40 = getelementptr inbounds [132 x i8], [132 x i8]* %15, i64 0, i64 0
%41 = load i32, i32* %6
%42 = call i32 (i8*, i8*, ...) @sprintf(i8* %40, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %41)
%43 = load i32, i32* %2
%44 = getelementptr inbounds [132 x i8], [132 x i8]* %15, i64 0, i64 0
%45 = getelementptr inbounds [132 x i8], [132 x i8]* %14, i64 0, i64 0
%46 = call i32 @ssds_send(i32 %43, i8* %44, i8* %45)
store i32 %46, i32* %4
%47 = load i32, i32* %4
%48 = icmp slt i32 %47, 0
br i1 %48, label %49, label %52
49: ; preds = %39
%50 = load i32, i32* %4
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %49, %39
%53 = getelementptr inbounds [132 x i8], [132 x i8]* %14, i64 0, i64 0
%54 = load i8**, i8*** %8
%55 = call i32 @get_argc(i8* %53, i8** %54, i32 16)
store i32 %55, i32* %10
%56 = load i32, i32* %10
%57 = load i8**, i8*** %8
%58 = getelementptr inbounds [32 x i8], [32 x i8]* %13, i64 0, i64 0
%59 = call i32 @get_arg_char(i32 %56, i8** %57, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %58, i32 32)
%60 = load i32, i32* %10
%61 = load i8**, i8*** %8
%62 = call i32 @get_arg_int(i32 %60, i8** %61, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %7)
store i32 %62, i32* %3
%63 = load i32, i32* %3
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %120
65: ; preds = %52
%66 = getelementptr inbounds [32 x i8], [32 x i8]* %13, i64 0, i64 0
%67 = load i32, i32* %7
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %66, i32 %67)
%69 = getelementptr inbounds [132 x i8], [132 x i8]* %15, i64 0, i64 0
%70 = load i32, i32* %7
%71 = call i32 (i8*, i8*, ...) @sprintf(i8* %69, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i32 %70)
%72 = load i32, i32* %2
%73 = getelementptr inbounds [132 x i8], [132 x i8]* %15, i64 0, i64 0
%74 = getelementptr inbounds [132 x i8], [132 x i8]* %14, i64 0, i64 0
%75 = call i32 @ssds_send(i32 %72, i8* %73, i8* %74)
store i32 %75, i32* %4
%76 = load i32, i32* %4
%77 = icmp slt i32 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %65
%79 = load i32, i32* %4
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %79)
br label %81
81: ; preds = %78, %65
%82 = getelementptr inbounds [132 x i8], [132 x i8]* %14, i64 0, i64 0
%83 = load i8**, i8*** %8
%84 = call i32 @get_argc(i8* %82, i8** %83, i32 16)
store i32 %84, i32* %10
%85 = load i32, i32* %10
%86 = load i8**, i8*** %8
%87 = getelementptr inbounds [32 x i8], [32 x i8]* %13, i64 0, i64 0
%88 = call i32 @get_arg_char(i32 %85, i8** %86, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %87, i32 32)
%89 = load i32, i32* %10
%90 = load i8**, i8*** %8
%91 = call i32 @get_arg_int(i32 %89, i8** %90, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %11)
store i32 %91, i32* %3
%92 = getelementptr inbounds [132 x i8], [132 x i8]* %15, i64 0, i64 0
%93 = load i32, i32* %7
%94 = call i32 (i8*, i8*, ...) @sprintf(i8* %92, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0), i32 %93)
%95 = load i32, i32* %2
%96 = getelementptr inbounds [132 x i8], [132 x i8]* %15, i64 0, i64 0
%97 = getelementptr inbounds [132 x i8], [132 x i8]* %14, i64 0, i64 0
%98 = call i32 @ssds_send(i32 %95, i8* %96, i8* %97)
store i32 %98, i32* %4
%99 = load i32, i32* %4
%100 = icmp slt i32 %99, 0
br i1 %100, label %101, label %104
101: ; preds = %81
%102 = load i32, i32* %4
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %102)
br label %104
104: ; preds = %101, %81
%105 = getelementptr inbounds [132 x i8], [132 x i8]* %14, i64 0, i64 0
%106 = load i8**, i8*** %8
%107 = call i32 @get_argc(i8* %105, i8** %106, i32 16)
store i32 %107, i32* %10
%108 = load i32, i32* %10
%109 = load i8**, i8*** %8
%110 = getelementptr inbounds [32 x i8], [32 x i8]* %13, i64 0, i64 0
%111 = call i32 @get_arg_char(i32 %108, i8** %109, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %110, i32 32)
%112 = load i32, i32* %10
%113 = load i8**, i8*** %8
%114 = call i32 @get_arg_int(i32 %112, i8** %113, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %12)
store i32 %114, i32* %3
%115 = getelementptr inbounds [32 x i8], [32 x i8]* %13, i64 0, i64 0
%116 = load i32, i32* %7
%117 = load i32, i32* %11
%118 = load i32, i32* %12
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.9, i64 0, i64 0), i8* %115, i32 %116, i32 %117, i32 %118)
br label %122
120: ; preds = %52
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0))
br label %122
122: ; preds = %120, %104
br label %123
123: ; preds = %122
%124 = load i32, i32* %6
%125 = add nsw i32 %124, 1
store i32 %125, i32* %6
br label %35
126: ; preds = %35
%127 = load i32, i32* %3
ret i32 %127
}

LLVM IR (-O2):
@.str = [29 x i8] c"msg 5678:action:get_classes:\00"
@.str.1 = [23 x i8] c" Client res error %d \0A\00"
@.str.2 = [6 x i8] c"reply\00"
@.str.3 = [38 x i8] c"msg 5678:action:get_class_num:num:%d:\00"
@.str.4 = [6 x i8] c"class\00"
@.str.5 = [3 x i8] c"id\00"
@.str.6 = [32 x i8] c" Client class name (%s) id %d \0A\00"
@.str.7 = [34 x i8] c"msg 5678:action:get_fields:id:%d:\00"
@.str.8 = [33 x i8] c"msg 5678:action:get_items:id:%d:\00"
@.str.9 = [53 x i8] c" Client class (%s) id %d num fields %d num items %d\0A\00"
@str = [30 x i8] c" Client class name NOT_FOUND \00"
define i32 @test_ssds(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca [16 x i8*]
%5 = alloca i32
%6 = alloca i32
%7 = alloca [32 x i8]
%8 = alloca [132 x i8]
%9 = alloca [132 x i8]
%10 = bitcast i32* %2 to i8*
%11 = bitcast i32* %3 to i8*
%12 = bitcast [16 x i8*]* %4 to i8*
%13 = bitcast i32* %5 to i8*
%14 = bitcast i32* %6 to i8*
%15 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%16 = getelementptr inbounds [132 x i8], [132 x i8]* %8, i64 0, i64 0
%17 = getelementptr inbounds [132 x i8], [132 x i8]* %9, i64 0, i64 0
%18 = getelementptr inbounds [16 x i8*], [16 x i8*]* %4, i64 0, i64 0
store i32 -1, i32* %2
%19 = call i32 @ssds_send(i32 %0, i8* %17, i8* %16)
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %1
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %19)
br label %23
23: ; preds = %21, %1
%24 = call i32 @get_argc(i8* %16, i8** %18, i32 16)
%25 = call i32 @get_arg_int(i32 %24, i8** %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%26 = load i32, i32* %2
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %74
28: ; preds = %23, %69
%29 = phi i32 [ %71, %69 ], [ 0, %23 ]
%30 = call i32 (i8*, i8*, ...) @sprintf(i8* %17, i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i32 %29)
%31 = call i32 @ssds_send(i32 %0, i8* %17, i8* %16)
%32 = icmp slt i32 %31, 0
br i1 %32, label %33, label %35
33: ; preds = %28
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %31)
br label %35
35: ; preds = %33, %28
%36 = call i32 @get_argc(i8* %16, i8** %18, i32 16)
%37 = call i32 @get_arg_char(i32 %36, i8** %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %15, i32 32)
%38 = call i32 @get_arg_int(i32 %36, i8** %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32* %3)
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %67
40: ; preds = %35
%41 = load i32, i32* %3
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %15, i32 %41)
%43 = load i32, i32* %3
%44 = call i32 (i8*, i8*, ...) @sprintf(i8* %17, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0), i32 %43)
%45 = call i32 @ssds_send(i32 %0, i8* %17, i8* %16)
%46 = icmp slt i32 %45, 0
br i1 %46, label %47, label %49
47: ; preds = %40
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %45)
br label %49
49: ; preds = %47, %40
%50 = call i32 @get_argc(i8* %16, i8** %18, i32 16)
%51 = call i32 @get_arg_char(i32 %50, i8** %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %15, i32 32)
%52 = call i32 @get_arg_int(i32 %50, i8** %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%53 = load i32, i32* %3
%54 = call i32 (i8*, i8*, ...) @sprintf(i8* %17, i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0), i32 %53)
%55 = call i32 @ssds_send(i32 %0, i8* %17, i8* %16)
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %49
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %55)
br label %59
59: ; preds = %57, %49
%60 = call i32 @get_argc(i8* %16, i8** %18, i32 16)
%61 = call i32 @get_arg_char(i32 %60, i8** %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %15, i32 32)
%62 = call i32 @get_arg_int(i32 %60, i8** %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%63 = load i32, i32* %3
%64 = load i32, i32* %5
%65 = load i32, i32* %6
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.9, i64 0, i64 0), i8* %15, i32 %63, i32 %64, i32 %65)
br label %69
67: ; preds = %35
%68 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
br label %69
69: ; preds = %59, %67
%70 = phi i32 [ %62, %59 ], [ %38, %67 ]
%71 = add nuw nsw i32 %29, 1
%72 = load i32, i32* %2
%73 = icmp slt i32 %71, %72
br i1 %73, label %28, label %74
74: ; preds = %69, %23
%75 = phi i32 [ %25, %23 ], [ %70, %69 ]
ret i32 %75
}