#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 recv(int, char *, int, int /*<<< orphan*/);
int send(int, char *, int, int /*<<< orphan*/);
int strlen(char *);
int do_proxy_cmd(int sock, char *cmd, char *buf, int buflen) {
  int n;
  n = send(sock, cmd, strlen(cmd), 0);
  if (n < 0) {
  } else if (n == strlen(cmd)) {
  } else {
  }
  n = recv(sock, buf, buflen, 0);
  return n;
}


x86 assembly (clang, -O0):
<do_proxy_cmd>:
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    -0x4(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    117f <do_proxy_cmd+0x4f>
jmp    11aa <do_proxy_cmd+0x7a>
mov    -0x20(%rbp),%eax
mov    %eax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
cmp    %ecx,%eax
jne    11a0 <do_proxy_cmd+0x70>
jmp    11a5 <do_proxy_cmd+0x75>
jmp    11a5 <do_proxy_cmd+0x75>
jmp    11aa <do_proxy_cmd+0x7a>
mov    -0x4(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_proxy_cmd>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1050 <send@plt>
test   %eax,%eax
js     1164 <do_proxy_cmd+0x34>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r14d,%edx
xor    %ecx,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <recv@plt>

LLVM IR (-O0):
define i32 @do_proxy_cmd(i32 %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = load i8*, i8** %6
%12 = load i8*, i8** %6
%13 = call i32 @strlen(i8* %12)
%14 = call i32 @send(i32 %10, i8* %11, i32 %13, i32 0)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %4
br label %26
18: ; preds = %4
%19 = load i32, i32* %9
%20 = load i8*, i8** %6
%21 = call i32 @strlen(i8* %20)
%22 = icmp eq i32 %19, %21
br i1 %22, label %23, label %24
23: ; preds = %18
br label %25
24: ; preds = %18
br label %25
25: ; preds = %24, %23
br label %26
26: ; preds = %25, %17
%27 = load i32, i32* %5
%28 = load i8*, i8** %7
%29 = load i32, i32* %8
%30 = call i32 @recv(i32 %27, i8* %28, i32 %29, i32 0)
store i32 %30, i32* %9
%31 = load i32, i32* %9
ret i32 %31
}

LLVM IR (-O2):
define i32 @do_proxy_cmd(i32 %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i32 @strlen(i8* %1)
%6 = tail call i32 @send(i32 %0, i8* %1, i32 %5, i32 0)
%7 = icmp slt i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %4
%9 = tail call i32 @strlen(i8* %1)
br label %10
10: ; preds = %4, %8
%11 = tail call i32 @recv(i32 %0, i8* %2, i32 %3, i32 0)
ret i32 %11
}