#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*/ CSP(char *, int, int, double);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ sendAndRecv(int, int /*<<< orphan*/, char *);
scalar_t__ strcmp(char *, char *);
int sendCSP(int socketDescriptor, char *response, char *MeasurementType,
            int NumberOfProbes, int MessageSize, double ServerDelay) {
  sendAndRecv(socketDescriptor,
              CSP(MeasurementType, NumberOfProbes, MessageSize, ServerDelay),
              response);
  if (strcmp(response, "200 OK: Ready\n") != 0) {
    printf("Failed CSP: %s\n", response);
    exit(0);
  }
  return 1;
}


x86 assembly (clang, -O0):
<sendCSP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x20(%rbp),%edx
movsd  -0x28(%rbp),%xmm0
call   1050 <CSP@plt>
mov    -0x2c(%rbp),%edi
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
call   1070 <sendAndRecv@plt>
mov    -0x10(%rbp),%rdi
lea    0xe5e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11c8 <sendCSP+0x78>
mov    -0x10(%rbp),%rsi
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    $0x1,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendCSP>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rdx,%rdi
mov    %ecx,%esi
mov    %r8d,%edx
call   1050 <CSP@plt>
mov    %ebp,%edi
mov    %eax,%esi
mov    %rbx,%rdx
call   1070 <sendAndRecv@plt>
lea    0xe88(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1191 <sendCSP+0x41>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe77(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"200 OK: Ready\0A\00"
@.str.1 = [16 x i8] c"Failed CSP: %s\0A\00"
define i32 @sendCSP(i32 %0, i8* %1, i8* %2, i32 %3, i32 %4, double %5) {
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
store i32 %0, i32* %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store double %5, double* %12
%13 = load i32, i32* %7
%14 = load i8*, i8** %9
%15 = load i32, i32* %10
%16 = load i32, i32* %11
%17 = load double, double* %12
%18 = call i32 @CSP(i8* %14, i32 %15, i32 %16, double %17)
%19 = load i8*, i8** %8
%20 = call i32 @sendAndRecv(i32 %13, i32 %18, i8* %19)
%21 = load i8*, i8** %8
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %6
%25 = load i8*, i8** %8
%26 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %25)
%27 = call i32 @exit(i32 0)
unreachable
28: ; preds = %6
ret i32 1
}

LLVM IR (-O2):
@.str = [15 x i8] c"200 OK: Ready\0A\00"
@.str.1 = [16 x i8] c"Failed CSP: %s\0A\00"
define i32 @sendCSP(i32 %0, i8* %1, i8* %2, i32 %3, i32 %4, double %5) {
%7 = tail call i32 @CSP(i8* %2, i32 %3, i32 %4, double %5)
%8 = tail call i32 @sendAndRecv(i32 %0, i32 %7, i8* %1)
%9 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %6
%12 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %1)
%13 = tail call i32 @exit(i32 0)
unreachable
14: ; preds = %6
ret i32 1
}