#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 colog_http_method(char *);
int colog_sent_request(int, int, int, char *, int, char *, char *);
int colog_sent_response(int, int, int, char *, int, char *);
char *scanpast(char *, char);
int colog_sent_message(int when, int pid, int tid, char *who, int dir,
                       char *wptr) {
  char *method;
  int what;
  while (*wptr == ' ')
    wptr++;
  wptr = scanpast(method = wptr, ' ');
  switch ((what = colog_http_method(method))) {
  case 1:
  case 2:
  case 3:
  case 4:
  case 5:
    return (colog_sent_request(when, pid, tid, who, dir, method, wptr));
  case 6:
    return (colog_sent_response(when, pid, tid, who, dir, wptr));
  default:
    return (30);
  }
}


x86 assembly (clang, -O0):
<colog_sent_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    117e <colog_sent_message+0x3e>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    115d <colog_sent_message+0x1d>
mov    -0x28(%rbp),%rdi
mov    %rdi,-0x30(%rbp)
mov    $0x20,%esi
call   1050 <scanpast@plt>
mov    %rax,-0x28(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <colog_http_method@plt>
mov    %eax,%ecx
mov    %ecx,-0x34(%rbp)
mov    %ecx,%eax
add    $0xffffffff,%eax
mov    %ecx,-0x38(%rbp)
sub    $0x5,%eax
jb     11c9 <colog_sent_message+0x89>
jmp    11b8 <colog_sent_message+0x78>
mov    -0x38(%rbp),%eax
sub    $0x6,%eax
je     11f3 <colog_sent_message+0xb3>
jmp    1215 <colog_sent_message+0xd5>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    -0x30(%rbp),%r9
mov    -0x28(%rbp),%rax
mov    %rax,(%rsp)
call   1060 <colog_sent_request@plt>
mov    %eax,-0x4(%rbp)
jmp    121c <colog_sent_message+0xdc>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
mov    -0x28(%rbp),%r9
call   1040 <colog_sent_response@plt>
mov    %eax,-0x4(%rbp)
jmp    121c <colog_sent_message+0xdc>
movl   $0x1e,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<colog_sent_message>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%rbp
mov    %r8d,0x14(%rsp)
mov    %rcx,%r15
mov    %edx,%r12d
mov    %esi,%r13d
mov    %edi,%ebx
add    $0xffffffffffffffff,%rbp
cs nopw 0x0(%rax,%rax,1)
nop
cmpb   $0x20,0x1(%rbp)
lea    0x1(%rbp),%rbp
je     1170 <colog_sent_message+0x30>
mov    %rbp,%rdi
mov    $0x20,%esi
call   1050 <scanpast@plt>
mov    %rax,%r14
mov    %rbp,%rdi
call   1030 <colog_http_method@plt>
lea    -0x1(%rax),%ecx
cmp    $0x5,%ecx
jae    11c5 <colog_sent_message+0x85>
mov    %r14,(%rsp)
mov    %ebx,%edi
mov    %r13d,%esi
mov    %r12d,%edx
mov    %r15,%rcx
mov    0x14(%rsp),%r8d
mov    %rbp,%r9
call   1060 <colog_sent_request@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x6,%eax
jne    11f0 <colog_sent_message+0xb0>
mov    %ebx,%edi
mov    %r13d,%esi
mov    %r12d,%edx
mov    %r15,%rcx
mov    0x14(%rsp),%r8d
mov    %r14,%r9
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <colog_sent_response@plt>
mov    $0x1e,%eax
jmp    11b6 <colog_sent_message+0x76>

LLVM IR (-O0):
define i32 @colog_sent_message(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4, i8* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i8* %3, i8** %11
store i32 %4, i32* %12
store i8* %5, i8** %13
br label %16
16: ; preds = %21, %6
%17 = load i8*, i8** %13
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 32
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = load i8*, i8** %13
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %13
br label %16
24: ; preds = %16
%25 = load i8*, i8** %13
store i8* %25, i8** %14
%26 = call i8* @scanpast(i8* %25, i8 signext 32)
store i8* %26, i8** %13
%27 = load i8*, i8** %14
%28 = call i32 @colog_http_method(i8* %27)
store i32 %28, i32* %15
switch i32 %28, label %46 [
i32 1, label %29
i32 2, label %29
i32 3, label %29
i32 4, label %29
i32 5, label %29
i32 6, label %38
]
29: ; preds = %24, %24, %24, %24, %24
%30 = load i32, i32* %8
%31 = load i32, i32* %9
%32 = load i32, i32* %10
%33 = load i8*, i8** %11
%34 = load i32, i32* %12
%35 = load i8*, i8** %14
%36 = load i8*, i8** %13
%37 = call i32 @colog_sent_request(i32 %30, i32 %31, i32 %32, i8* %33, i32 %34, i8* %35, i8* %36)
store i32 %37, i32* %7
br label %47
38: ; preds = %24
%39 = load i32, i32* %8
%40 = load i32, i32* %9
%41 = load i32, i32* %10
%42 = load i8*, i8** %11
%43 = load i32, i32* %12
%44 = load i8*, i8** %13
%45 = call i32 @colog_sent_response(i32 %39, i32 %40, i32 %41, i8* %42, i32 %43, i8* %44)
store i32 %45, i32* %7
br label %47
46: ; preds = %24
store i32 30, i32* %7
br label %47
47: ; preds = %46, %38, %29
%48 = load i32, i32* %7
ret i32 %48
}

LLVM IR (-O2):
define i32 @colog_sent_message(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4, i8* %5) {
br label %7
7: ; preds = %7, %6
%8 = phi i8* [ %5, %6 ], [ %11, %7 ]
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 32
%11 = getelementptr inbounds i8, i8* %8, i64 1
br i1 %10, label %7, label %12
12: ; preds = %7
%13 = tail call i8* @scanpast(i8* %8, i8 signext 32)
%14 = tail call i32 @colog_http_method(i8* %8)
switch i32 %14, label %19 [
i32 1, label %15
i32 2, label %15
i32 3, label %15
i32 4, label %15
i32 5, label %15
i32 6, label %17
]
15: ; preds = %12, %12, %12, %12, %12
%16 = tail call i32 @colog_sent_request(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4, i8* %8, i8* %13)
br label %19
17: ; preds = %12
%18 = tail call i32 @colog_sent_response(i32 %0, i32 %1, i32 %2, i8* %3, i32 %4, i8* %13)
br label %19
19: ; preds = %12, %17, %15
%20 = phi i32 [ %18, %17 ], [ %16, %15 ], [ 30, %12 ]
ret i32 %20
}