#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 */
unsigned int strtoul(char const *, char **, int);
const char *parse_syslog(const char *line, unsigned *facility,
                         unsigned *priority) {
  unsigned num;
  if (*line++ != '<')
    return 0;
  num = strtoul(line, (char **)&line, 10);
  if (num >= 8 * 24 || *line++ != '>')
    return 0;
  *facility = num >> 3;
  *priority = num & 7;
  return line;
}


x86 assembly (clang, -O0):
<parse_syslog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x3c,%eax
je     114c <parse_syslog+0x3c>
movq   $0x0,-0x8(%rbp)
jmp    11b6 <parse_syslog+0xa6>
mov    -0x10(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtoul@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xc0,-0x24(%rbp)
jae    1189 <parse_syslog+0x79>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x3e,%eax
je     1196 <parse_syslog+0x86>
movq   $0x0,-0x8(%rbp)
jmp    11b6 <parse_syslog+0xa6>
mov    -0x24(%rbp),%ecx
shr    $0x3,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x24(%rbp),%ecx
and    $0x7,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_syslog>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rax
add    $0x1,%rdi
mov    %rdi,(%rsp)
cmpb   $0x3c,(%rax)
jne    1160 <parse_syslog+0x50>
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rsp,%rsi
mov    $0xa,%edx
call   1030 <strtoul@plt>
cmp    $0xbf,%eax
ja     1160 <parse_syslog+0x50>
mov    %eax,%ecx
mov    (%rsp),%rdx
lea    0x1(%rdx),%rax
mov    %rax,(%rsp)
cmpb   $0x3e,(%rdx)
jne    1160 <parse_syslog+0x50>
mov    %ecx,%edx
shr    $0x3,%edx
mov    %edx,(%rbx)
and    $0x7,%ecx
mov    %ecx,(%r14)
jmp    1162 <parse_syslog+0x52>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @parse_syslog(i8* %0, i32* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
store i8* %0, i8** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
%9 = load i8*, i8** %5
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %5
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 60
br i1 %13, label %14, label %15
14: ; preds = %3
store i8* null, i8** %4
br label %35
15: ; preds = %3
%16 = load i8*, i8** %5
%17 = call i32 @strtoul(i8* %16, i8** %5, i32 10)
store i32 %17, i32* %8
%18 = load i32, i32* %8
%19 = icmp uge i32 %18, 192
br i1 %19, label %26, label %20
20: ; preds = %15
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %5
%23 = load i8, i8* %21
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 62
br i1 %25, label %26, label %27
26: ; preds = %20, %15
store i8* null, i8** %4
br label %35
27: ; preds = %20
%28 = load i32, i32* %8
%29 = lshr i32 %28, 3
%30 = load i32*, i32** %6
store i32 %29, i32* %30
%31 = load i32, i32* %8
%32 = and i32 %31, 7
%33 = load i32*, i32** %7
store i32 %32, i32* %33
%34 = load i8*, i8** %5
store i8* %34, i8** %4
br label %35
35: ; preds = %27, %26, %14
%36 = load i8*, i8** %4
ret i8* %36
}

LLVM IR (-O2):
define i8* @parse_syslog(i8* %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca i8*
%5 = getelementptr inbounds i8, i8* %0, i64 1
store i8* %5, i8** %4
%6 = load i8, i8* %0
%7 = icmp eq i8 %6, 60
br i1 %7, label %8, label %19
8: ; preds = %3
%9 = call i32 @strtoul(i8* %5, i8** %4, i32 10)
%10 = icmp ugt i32 %9, 191
br i1 %10, label %19, label %11
11: ; preds = %8
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 1
store i8* %13, i8** %4
%14 = load i8, i8* %12
%15 = icmp eq i8 %14, 62
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = lshr i32 %9, 3
store i32 %17, i32* %1
%18 = and i32 %9, 7
store i32 %18, i32* %2
br label %19
19: ; preds = %8, %11, %3, %16
%20 = phi i8* [ %13, %16 ], [ null, %3 ], [ null, %11 ], [ null, %8 ]
ret i8* %20
}