#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_int(int, char **, char *, int *);
int get_argc(char *, char **, int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ sprintf(char *, char *);
int ssds_send(int, char *, char *);
int ssds_num_classes(int fd) {
  int res;
  int num;
  char **argv;
  char *myargv[16];
  int argc;
  char rbuf[132];
  char sbuf[132];
  argv = myargv;
  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);
  res = get_arg_int(argc, argv, "reply", &num);
  if (res < 0)
    printf(" Client res error %d \n", res);
  return num;
}


x86 assembly (clang, -O0):
<ssds_num_classes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
mov    %edi,-0x4(%rbp)
lea    -0xa0(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x1c0(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1070 <sprintf@plt>
mov    -0x4(%rbp),%edi
lea    -0x1c0(%rbp),%rsi
lea    -0x130(%rbp),%rdx
call   1040 <ssds_send@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    11ae <ssds_num_classes+0x5e>
mov    -0x8(%rbp),%esi
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
lea    -0x130(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x10,%edx
call   1050 <get_argc@plt>
mov    %eax,-0xa4(%rbp)
mov    -0xa4(%rbp),%edi
mov    -0x18(%rbp),%rsi
lea    0xe5a(%rip),%rdx
lea    -0xc(%rbp),%rcx
call   1060 <get_arg_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    11ff <ssds_num_classes+0xaf>
mov    -0x8(%rbp),%esi
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssds_num_classes>:
push   %rbx
sub    $0x1b0,%rsp
movups 0xebe(%rip),%xmm0
movups %xmm0,0x1d(%rsp)
movups 0xea5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rsi
lea    0xa0(%rsp),%rdx
call   1040 <ssds_send@plt>
test   %eax,%eax
jns    1184 <ssds_num_classes+0x44>
lea    0xea0(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0xa0(%rsp),%rdi
lea    0x130(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x10,%edx
call   1050 <get_argc@plt>
lea    0xe8c(%rip),%rdx
lea    0xc(%rsp),%rcx
mov    %eax,%edi
mov    %rbx,%rsi
call   1060 <get_arg_int@plt>
test   %eax,%eax
jns    11c9 <ssds_num_classes+0x89>
lea    0xe5b(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
add    $0x1b0,%rsp
pop    %rbx
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"
define i32 @ssds_num_classes(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [16 x i8*]
%7 = alloca i32
%8 = alloca [132 x i8]
%9 = alloca [132 x i8]
store i32 %0, i32* %2
%10 = getelementptr inbounds [16 x i8*], [16 x i8*]* %6, i64 0, i64 0
store i8** %10, i8*** %5
%11 = getelementptr inbounds [132 x i8], [132 x i8]* %9, i64 0, i64 0
%12 = call i32 @sprintf(i8* %11, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %2
%14 = getelementptr inbounds [132 x i8], [132 x i8]* %9, i64 0, i64 0
%15 = getelementptr inbounds [132 x i8], [132 x i8]* %8, i64 0, i64 0
%16 = call i32 @ssds_send(i32 %13, i8* %14, i8* %15)
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %1
%20 = load i32, i32* %3
%21 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %20)
br label %22
22: ; preds = %19, %1
%23 = getelementptr inbounds [132 x i8], [132 x i8]* %8, i64 0, i64 0
%24 = load i8**, i8*** %5
%25 = call i32 @get_argc(i8* %23, i8** %24, i32 16)
store i32 %25, i32* %7
%26 = load i32, i32* %7
%27 = load i8**, i8*** %5
%28 = call i32 @get_arg_int(i32 %26, i8** %27, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %4)
store i32 %28, i32* %3
%29 = load i32, i32* %3
%30 = icmp slt i32 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %22
%32 = load i32, i32* %3
%33 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %34
34: ; preds = %31, %22
%35 = load i32, i32* %4
ret i32 %35
}

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"
define i32 @ssds_num_classes(i32 %0) {
%2 = alloca i32
%3 = alloca [16 x i8*]
%4 = alloca [132 x i8]
%5 = alloca [132 x i8]
%6 = bitcast i32* %2 to i8*
%7 = bitcast [16 x i8*]* %3 to i8*
%8 = getelementptr inbounds [132 x i8], [132 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [132 x i8], [132 x i8]* %5, i64 0, i64 0
%10 = getelementptr inbounds [16 x i8*], [16 x i8*]* %3, i64 0, i64 0
%11 = call i32 @ssds_send(i32 %0, i8* %9, i8* %8)
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %1
%14 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %11)
br label %15
15: ; preds = %13, %1
%16 = call i32 @get_argc(i8* %8, i8** %10, i32 16)
%17 = call i32 @get_arg_int(i32 %16, i8** %10, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %17)
br label %21
21: ; preds = %19, %15
%22 = load i32, i32* %2
ret i32 %22
}