#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 */
struct colog_module {
  int dummy;
};

/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ colog_received_message(int, int, int, char *, int, char *);
int /*<<< orphan*/ colog_sent_message(int, int, int, char *, int, char *);
char *scanpast(char *, char);
int /*<<< orphan*/ strcmp(char *, char *);
int colog_use_line(char *buffer) {
  char *wptr = buffer;
  char *vptr;
  int when;
  int what;
  int thrd;
  char *who;
  int dir;
  struct colog_module *mptr;
  wptr = scanpast(vptr = wptr, ':');
  when = atoi(vptr);
  wptr = scanpast(vptr = wptr, ':');
  what = atoi(vptr);
  wptr = scanpast(vptr = wptr, ':');
  thrd = atoi(vptr);
  if (!(what))
    return (0);
  while (*wptr == ' ')
    wptr++;
  wptr = scanpast(who = wptr, '/');
  wptr = scanpast(wptr, ' ');
  while (*wptr == ' ')
    wptr++;
  wptr = scanpast(vptr = wptr, ' ');
  while (*wptr == ' ')
    wptr++;
  if (!(strcmp(vptr, "<--")))
    colog_received_message(when, what, thrd, who, 2, wptr);
  else if (!(strcmp(vptr, "-->")))
    colog_sent_message(when, what, thrd, who, 1, wptr);
  return (0);
}


x86 assembly (clang, -O0):
<colog_use_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    %rdi,-0x20(%rbp)
mov    $0x3a,%esi
call   1050 <scanpast@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    %rdi,-0x20(%rbp)
mov    $0x3a,%esi
call   1050 <scanpast@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    %rdi,-0x20(%rbp)
mov    $0x3a,%esi
call   1050 <scanpast@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x28(%rbp)
jne    11e0 <colog_use_line+0x90>
movl   $0x0,-0x4(%rbp)
jmp    1301 <colog_use_line+0x1b1>
jmp    11e5 <colog_use_line+0x95>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1206 <colog_use_line+0xb6>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11e5 <colog_use_line+0x95>
mov    -0x18(%rbp),%rdi
mov    %rdi,-0x38(%rbp)
mov    $0x2f,%esi
call   1050 <scanpast@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x20,%esi
call   1050 <scanpast@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    124f <colog_use_line+0xff>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    122e <colog_use_line+0xde>
mov    -0x18(%rbp),%rdi
mov    %rdi,-0x20(%rbp)
mov    $0x20,%esi
call   1050 <scanpast@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1286 <colog_use_line+0x136>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1265 <colog_use_line+0x115>
mov    -0x20(%rbp),%rdi
lea    0xd6f(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    12c0 <colog_use_line+0x170>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x38(%rbp),%rcx
mov    -0x18(%rbp),%r9
mov    $0x2,%r8d
call   1040 <colog_received_message@plt>
jmp    12fa <colog_use_line+0x1aa>
mov    -0x20(%rbp),%rdi
lea    0xd39(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    12f5 <colog_use_line+0x1a5>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x38(%rbp),%rcx
mov    -0x18(%rbp),%r9
mov    $0x1,%r8d
call   1060 <colog_sent_message@plt>
jmp    12fa <colog_use_line+0x1aa>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<colog_use_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x3a,%esi
call   1050 <scanpast@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1070 <atoi@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
mov    $0x3a,%esi
call   1050 <scanpast@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1070 <atoi@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1050 <scanpast@plt>
mov    %rax,%r13
mov    %rbx,%rdi
call   1070 <atoi@plt>
test   %r12d,%r12d
je     1276 <colog_use_line+0x126>
mov    %eax,%r15d
add    $0xffffffffffffffff,%r13
nopl   0x0(%rax)
cmpb   $0x20,0x1(%r13)
lea    0x1(%r13),%r13
je     11c0 <colog_use_line+0x70>
mov    %r13,%rdi
mov    $0x2f,%esi
call   1050 <scanpast@plt>
mov    %rax,%rdi
mov    $0x20,%esi
call   1050 <scanpast@plt>
mov    %rax,%rbx
add    $0xffffffffffffffff,%rbx
nopl   0x0(%rax)
cmpb   $0x20,0x1(%rbx)
lea    0x1(%rbx),%rbx
je     11f0 <colog_use_line+0xa0>
mov    %rbx,%rdi
mov    $0x20,%esi
call   1050 <scanpast@plt>
mov    %rax,%rbp
add    $0xffffffffffffffff,%rbp
xchg   %ax,%ax
cmpb   $0x20,0x1(%rbp)
lea    0x1(%rbp),%rbp
je     1210 <colog_use_line+0xc0>
lea    0xddf(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     125c <colog_use_line+0x10c>
lea    0xdd0(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    1276 <colog_use_line+0x126>
mov    %r14d,%edi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %r13,%rcx
mov    $0x1,%r8d
mov    %rbp,%r9
call   1060 <colog_sent_message@plt>
jmp    1276 <colog_use_line+0x126>
mov    %r14d,%edi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %r13,%rcx
mov    $0x2,%r8d
mov    %rbp,%r9
call   1040 <colog_received_message@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.colog_module = type { i32 }
@.str = [4 x i8] c"<--\00"
@.str.1 = [4 x i8] c"-->\00"
define i32 @colog_use_line(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca %struct.colog_module*
store i8* %0, i8** %3
%12 = load i8*, i8** %3
store i8* %12, i8** %4
%13 = load i8*, i8** %4
store i8* %13, i8** %5
%14 = call i8* @scanpast(i8* %13, i8 signext 58)
store i8* %14, i8** %4
%15 = load i8*, i8** %5
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %6
%17 = load i8*, i8** %4
store i8* %17, i8** %5
%18 = call i8* @scanpast(i8* %17, i8 signext 58)
store i8* %18, i8** %4
%19 = load i8*, i8** %5
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %7
%21 = load i8*, i8** %4
store i8* %21, i8** %5
%22 = call i8* @scanpast(i8* %21, i8 signext 58)
store i8* %22, i8** %4
%23 = load i8*, i8** %5
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %8
%25 = load i32, i32* %7
%26 = icmp ne i32 %25, 0
br i1 %26, label %28, label %27
27: ; preds = %1
store i32 0, i32* %2
br label %85
28: ; preds = %1
br label %29
29: ; preds = %34, %28
%30 = load i8*, i8** %4
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 32
br i1 %33, label %34, label %37
34: ; preds = %29
%35 = load i8*, i8** %4
%36 = getelementptr inbounds i8, i8* %35, i32 1
store i8* %36, i8** %4
br label %29
37: ; preds = %29
%38 = load i8*, i8** %4
store i8* %38, i8** %9
%39 = call i8* @scanpast(i8* %38, i8 signext 47)
store i8* %39, i8** %4
%40 = load i8*, i8** %4
%41 = call i8* @scanpast(i8* %40, i8 signext 32)
store i8* %41, i8** %4
br label %42
42: ; preds = %47, %37
%43 = load i8*, i8** %4
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 32
br i1 %46, label %47, label %50
47: ; preds = %42
%48 = load i8*, i8** %4
%49 = getelementptr inbounds i8, i8* %48, i32 1
store i8* %49, i8** %4
br label %42
50: ; preds = %42
%51 = load i8*, i8** %4
store i8* %51, i8** %5
%52 = call i8* @scanpast(i8* %51, i8 signext 32)
store i8* %52, i8** %4
br label %53
53: ; preds = %58, %50
%54 = load i8*, i8** %4
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 32
br i1 %57, label %58, label %61
58: ; preds = %53
%59 = load i8*, i8** %4
%60 = getelementptr inbounds i8, i8* %59, i32 1
store i8* %60, i8** %4
br label %53
61: ; preds = %53
%62 = load i8*, i8** %5
%63 = call i32 @strcmp(i8* %62, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%64 = icmp ne i32 %63, 0
br i1 %64, label %72, label %65
65: ; preds = %61
%66 = load i32, i32* %6
%67 = load i32, i32* %7
%68 = load i32, i32* %8
%69 = load i8*, i8** %9
%70 = load i8*, i8** %4
%71 = call i32 @colog_received_message(i32 %66, i32 %67, i32 %68, i8* %69, i32 2, i8* %70)
br label %84
72: ; preds = %61
%73 = load i8*, i8** %5
%74 = call i32 @strcmp(i8* %73, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%75 = icmp ne i32 %74, 0
br i1 %75, label %83, label %76
76: ; preds = %72
%77 = load i32, i32* %6
%78 = load i32, i32* %7
%79 = load i32, i32* %8
%80 = load i8*, i8** %9
%81 = load i8*, i8** %4
%82 = call i32 @colog_sent_message(i32 %77, i32 %78, i32 %79, i8* %80, i32 1, i8* %81)
br label %83
83: ; preds = %76, %72
br label %84
84: ; preds = %83, %65
store i32 0, i32* %2
br label %85
85: ; preds = %84, %27
%86 = load i32, i32* %2
ret i32 %86
}

LLVM IR (-O2):
%struct.colog_module = type { i32 }
@.str = [4 x i8] c"<--\00"
@.str.1 = [4 x i8] c"-->\00"
define i32 @colog_use_line(i8* %0) {
%2 = tail call i8* @scanpast(i8* %0, i8 signext 58)
%3 = tail call i32 @atoi(i8* %0)
%4 = tail call i8* @scanpast(i8* %2, i8 signext 58)
%5 = tail call i32 @atoi(i8* %2)
%6 = tail call i8* @scanpast(i8* %4, i8 signext 58)
%7 = tail call i32 @atoi(i8* %4)
%8 = icmp eq i32 %5, 0
br i1 %8, label %39, label %9
9: ; preds = %1, %9
%10 = phi i8* [ %13, %9 ], [ %6, %1 ]
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 32
%13 = getelementptr inbounds i8, i8* %10, i64 1
br i1 %12, label %9, label %14
14: ; preds = %9
%15 = tail call i8* @scanpast(i8* %10, i8 signext 47)
%16 = tail call i8* @scanpast(i8* %15, i8 signext 32)
br label %17
17: ; preds = %17, %14
%18 = phi i8* [ %16, %14 ], [ %21, %17 ]
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 32
%21 = getelementptr inbounds i8, i8* %18, i64 1
br i1 %20, label %17, label %22
22: ; preds = %17
%23 = tail call i8* @scanpast(i8* %18, i8 signext 32)
br label %24
24: ; preds = %24, %22
%25 = phi i8* [ %23, %22 ], [ %28, %24 ]
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 32
%28 = getelementptr inbounds i8, i8* %25, i64 1
br i1 %27, label %24, label %29
29: ; preds = %24
%30 = tail call i32 @strcmp(i8* %18, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = tail call i32 @colog_received_message(i32 %3, i32 %5, i32 %7, i8* %10, i32 2, i8* %25)
br label %39
34: ; preds = %29
%35 = tail call i32 @strcmp(i8* %18, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = tail call i32 @colog_sent_message(i32 %3, i32 %5, i32 %7, i8* %10, i32 1, i8* %25)
br label %39
39: ; preds = %32, %37, %34, %1
ret i32 0
}