#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int timeoutRecv(int, char *, int, int /*<<< orphan*/, int /*<<< orphan*/,
                int /*<<< orphan*/);
int get(int sock, time_t to, int *pings, int *pongs) {
  char buf;
  if (timeoutRecv(sock, &buf, 1, 0, to, 0) != 1) {
    return 0;
  }
  if (buf == 'I') {
    (*pings)++;
  } else if (buf == 'O') {
    (*pongs)++;
  } else {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%r8d
lea    -0x21(%rbp),%rsi
mov    $0x1,%edx
xor    %r9d,%r9d
mov    %r9d,%ecx
call   1030 <timeoutRecv@plt>
cmp    $0x1,%eax
je     1156 <get+0x46>
movl   $0x0,-0x4(%rbp)
jmp    11a8 <get+0x98>
movsbl -0x21(%rbp),%eax
cmp    $0x49,%eax
jne    1173 <get+0x63>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    11a1 <get+0x91>
movsbl -0x21(%rbp),%eax
cmp    $0x4f,%eax
jne    1190 <get+0x80>
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    119c <get+0x8c>
movl   $0x0,-0x4(%rbp)
jmp    11a8 <get+0x98>
jmp    11a1 <get+0x91>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%r8d
lea    0xf(%rsp),%rsi
xor    %ebp,%ebp
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %r9d,%r9d
call   1030 <timeoutRecv@plt>
cmp    $0x1,%eax
jne    1153 <get+0x43>
mov    0xf(%rsp),%al
cmp    $0x49,%al
je     114b <get+0x3b>
cmp    $0x4f,%al
jne    1153 <get+0x43>
mov    %r14,%rbx
addl   $0x1,(%rbx)
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @get(i32 %0, i32 %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i8
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32* %2, i32** %8
store i32* %3, i32** %9
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = call i32 @timeoutRecv(i32 %11, i8* %10, i32 1, i32 0, i32 %12, i32 0)
%14 = icmp ne i32 %13, 1
br i1 %14, label %15, label %16
15: ; preds = %4
store i32 0, i32* %5
br label %35
16: ; preds = %4
%17 = load i8, i8* %10
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 73
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32*, i32** %8
%22 = load i32, i32* %21
%23 = add nsw i32 %22, 1
store i32 %23, i32* %21
br label %34
24: ; preds = %16
%25 = load i8, i8* %10
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 79
br i1 %27, label %28, label %32
28: ; preds = %24
%29 = load i32*, i32** %9
%30 = load i32, i32* %29
%31 = add nsw i32 %30, 1
store i32 %31, i32* %29
br label %33
32: ; preds = %24
store i32 0, i32* %5
br label %35
33: ; preds = %28
br label %34
34: ; preds = %33, %20
store i32 1, i32* %5
br label %35
35: ; preds = %34, %32, %15
%36 = load i32, i32* %5
ret i32 %36
}

LLVM IR (-O2):
define i32 @get(i32 %0, i32 %1, i32* nocapture %2, i32* nocapture %3) {
%5 = alloca i8
%6 = call i32 @timeoutRecv(i32 %0, i8* %5, i32 1, i32 0, i32 %1, i32 0)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %15
8: ; preds = %4
%9 = load i8, i8* %5
switch i8 %9, label %15 [
i8 73, label %11
i8 79, label %10
]
10: ; preds = %8
br label %11
11: ; preds = %8, %10
%12 = phi i32* [ %3, %10 ], [ %2, %8 ]
%13 = load i32, i32* %12
%14 = add nsw i32 %13, 1
store i32 %14, i32* %12
br label %15
15: ; preds = %11, %8, %4
%16 = phi i32 [ 0, %4 ], [ 0, %8 ], [ 1, %11 ]
ret i32 %16
}