#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 *);
int /*<<< orphan*/ slog(int, char *, int);
scalar_t__ strlen(char *);
int getSetAudit(char *string) {
  int sa = 0;
  string += strlen("set_audit=");
  if (strlen(string) > 0) {
    sa = atoi(string);
  }
  if (sa > 1)
    sa = 0;
  slog(2, "set audit: %d \n", sa);
  return sa;
}


x86 assembly (clang, -O0):
<getSetAudit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeb6(%rip),%rdi
call   1030 <strlen@plt>
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jle    1176 <getSetAudit+0x46>
mov    -0x8(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jle    1187 <getSetAudit+0x57>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0x2,%edi
lea    0xe75(%rip),%rsi
call   1040 <slog@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getSetAudit>:
push   %rbx
mov    %rdi,%rbx
add    $0xa,%rbx
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %rax,%rax
jle    1157 <getSetAudit+0x27>
mov    %rbx,%rdi
call   1050 <atoi@plt>
xor    %ebx,%ebx
cmp    $0x2,%eax
cmovl  %eax,%ebx
jmp    1159 <getSetAudit+0x29>
xor    %ebx,%ebx
lea    0xea0(%rip),%rsi
mov    $0x2,%edi
mov    %ebx,%edx
call   1040 <slog@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"set_audit=\00"
@.str.1 = [16 x i8] c"set audit: %d \0A\00"
define i32 @getSetAudit(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
%4 = call i64 @strlen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%5 = load i8*, i8** %2
%6 = getelementptr inbounds i8, i8* %5, i64 %4
store i8* %6, i8** %2
%7 = load i8*, i8** %2
%8 = call i64 @strlen(i8* %7)
%9 = icmp sgt i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i32 @atoi(i8* %11)
store i32 %12, i32* %3
br label %13
13: ; preds = %10, %1
%14 = load i32, i32* %3
%15 = icmp sgt i32 %14, 1
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 0, i32* %3
br label %17
17: ; preds = %16, %13
%18 = load i32, i32* %3
%19 = call i32 @slog(i32 2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"set audit: %d \0A\00"
define i32 @getSetAudit(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 10
%3 = tail call i64 @strlen(i8* %2)
%4 = icmp sgt i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
%6 = tail call i32 @atoi(i8* %2)
%7 = icmp sgt i32 %6, 1
%8 = select i1 %7, i32 0, i32 %6
br label %9
9: ; preds = %5, %1
%10 = phi i32 [ 0, %1 ], [ %8, %5 ]
%11 = tail call i32 @slog(i32 2, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 %10
}