#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 atoi(char *);
scalar_t__ regmatchInsensitive(char *, char *);
int /*<<< orphan*/ slog(int, char *, char *);
int /*<<< orphan*/ strlen(char *);
int getSyslogPriority(char *string) {
  int pri;
  if (regmatchInsensitive(string, "^syslog=[0-9]+$")) {
    string += strlen("syslog=");
    pri = atoi(string);
  } else {
    slog(1,
         "... problems reading the syslog priority: the line %s is not "
         "correct\n",
         string);
    pri = -1;
  }
  return pri;
}


x86 assembly (clang, -O0):
<getSyslogPriority>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1060 <regmatchInsensitive@plt>
cmp    $0x0,%rax
je     1193 <getSyslogPriority+0x53>
lea    0xea3(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0xc(%rbp)
jmp    11af <getSyslogPriority+0x6f>
mov    -0x8(%rbp),%rdx
mov    $0x1,%edi
lea    0xe75(%rip),%rsi
call   1040 <slog@plt>
movl   $0xffffffff,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSyslogPriority>:
push   %rbx
mov    %rdi,%rbx
lea    0xeb5(%rip),%rsi
call   1060 <regmatchInsensitive@plt>
test   %rax,%rax
je     116f <getSyslogPriority+0x2f>
lea    0xeb4(%rip),%rdi
call   1030 <strlen@plt>
cltq
add    %rax,%rbx
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <atoi@plt>
lea    0xea2(%rip),%rsi
mov    $0x1,%edi
mov    %rbx,%rdx
call   1040 <slog@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"^syslog=[0-9]+$\00"
@.str.1 = [8 x i8] c"syslog=\00"
@.str.2 = [70 x i8] c"... problems reading the syslog priority: the line %s is not correct\0A\00"
define i32 @getSyslogPriority(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @regmatchInsensitive(i8* %4, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %14
7: ; preds = %1
%8 = call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%9 = load i8*, i8** %2
%10 = sext i32 %8 to i64
%11 = getelementptr inbounds i8, i8* %9, i64 %10
store i8* %11, i8** %2
%12 = load i8*, i8** %2
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %3
br label %17
14: ; preds = %1
%15 = load i8*, i8** %2
%16 = call i32 @slog(i32 1, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.2, i64 0, i64 0), i8* %15)
store i32 -1, i32* %3
br label %17
17: ; preds = %14, %7
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@.str = [16 x i8] c"^syslog=[0-9]+$\00"
@.str.1 = [8 x i8] c"syslog=\00"
@.str.2 = [70 x i8] c"... problems reading the syslog priority: the line %s is not correct\0A\00"
define i32 @getSyslogPriority(i8* %0) {
%2 = tail call i64 @regmatchInsensitive(i8* %0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = tail call i32 @strlen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = tail call i32 @atoi(i8* %7)
br label %11
9: ; preds = %1
%10 = tail call i32 @slog(i32 1, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %11
11: ; preds = %9, %4
%12 = phi i32 [ %8, %4 ], [ -1, %9 ]
ret i32 %12
}