#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 /*<<< orphan*/ LOG_WARNING;
int /*<<< orphan*/ log_msg(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ strcasecmp(char *, char *);
char *strtok(char *, char *);
int proc_logfile_name(char *arg) {
  char *s;
  if (arg == NULL)
    return 1;
  s = strtok(arg, ":");
  if (arg[0] == ':')
    arg[0] = '\0';
  if (s == NULL || !strcasecmp(s, "logtime"))
    return 1;
  if (!strcasecmp(s, "nologtime"))
    return 0;
  log_msg(LOG_WARNING, "unknown value '%s', ignoring", s);
  return 1;
}


x86 assembly (clang, -O0):
<proc_logfile_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1153 <proc_logfile_name+0x23>
movl   $0x1,-0x4(%rbp)
jmp    11f3 <proc_logfile_name+0xc3>
mov    -0x10(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    117e <proc_logfile_name+0x4e>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
cmpq   $0x0,-0x18(%rbp)
je     11a2 <proc_logfile_name+0x72>
mov    -0x18(%rbp),%rdi
lea    0xe70(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    11ae <proc_logfile_name+0x7e>
movl   $0x1,-0x4(%rbp)
jmp    11f3 <proc_logfile_name+0xc3>
mov    -0x18(%rbp),%rdi
lea    0xe49(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%eax
jne    11d3 <proc_logfile_name+0xa3>
movl   $0x0,-0x4(%rbp)
jmp    11f3 <proc_logfile_name+0xc3>
mov    0x2e0e(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe25(%rip),%rsi
call   1040 <log_msg@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<proc_logfile_name>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%r14d
test   %rdi,%rdi
je     11a3 <proc_logfile_name+0x73>
mov    %rdi,%rbp
lea    0xeb7(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,%rbx
cmpb   $0x3a,0x0(%rbp)
jne    115b <proc_logfile_name+0x2b>
movb   $0x0,0x0(%rbp)
test   %rbx,%rbx
je     11a3 <proc_logfile_name+0x73>
lea    0xe9d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     11a3 <proc_logfile_name+0x73>
lea    0xe88(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %eax,%eax
je     11a0 <proc_logfile_name+0x70>
mov    0x2e5b(%rip),%rax
mov    (%rax),%edi
lea    0xe76(%rip),%rsi
mov    %rbx,%rdx
call   1040 <log_msg@plt>
jmp    11a3 <proc_logfile_name+0x73>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c":\00"
@.str.1 = [8 x i8] c"logtime\00"
@.str.2 = [10 x i8] c"nologtime\00"
@LOG_WARNING = global i32 0
@.str.3 = [29 x i8] c"unknown value '%s', ignoring\00"
define i32 @proc_logfile_name(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %2
br label %36
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i8* @strtok(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %10, i8** %4
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 58
br i1 %15, label %16, label %19
16: ; preds = %8
%17 = load i8*, i8** %3
%18 = getelementptr inbounds i8, i8* %17, i64 0
store i8 0, i8* %18
br label %19
19: ; preds = %16, %8
%20 = load i8*, i8** %4
%21 = icmp eq i8* %20, null
br i1 %21, label %26, label %22
22: ; preds = %19
%23 = load i8*, i8** %4
%24 = call i32 @strcasecmp(i8* %23, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %22, %19
store i32 1, i32* %2
br label %36
27: ; preds = %22
%28 = load i8*, i8** %4
%29 = call i32 @strcasecmp(i8* %28, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
br i1 %30, label %32, label %31
31: ; preds = %27
store i32 0, i32* %2
br label %36
32: ; preds = %27
%33 = load i32, i32* @LOG_WARNING
%34 = load i8*, i8** %4
%35 = call i32 @log_msg(i32 %33, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %34)
store i32 1, i32* %2
br label %36
36: ; preds = %32, %31, %26, %7
%37 = load i32, i32* %2
ret i32 %37
}

LLVM IR (-O2):
@.str = [2 x i8] c":\00"
@.str.1 = [8 x i8] c"logtime\00"
@.str.2 = [10 x i8] c"nologtime\00"
@LOG_WARNING = global i32 0
@.str.3 = [29 x i8] c"unknown value '%s', ignoring\00"
define i32 @proc_logfile_name(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %19, label %3
3: ; preds = %1
%4 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 58
br i1 %6, label %7, label %8
7: ; preds = %3
store i8 0, i8* %0
br label %8
8: ; preds = %7, %3
%9 = icmp eq i8* %4, null
br i1 %9, label %19, label %10
10: ; preds = %8
%11 = tail call i32 @strcasecmp(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
br i1 %12, label %19, label %13
13: ; preds = %10
%14 = tail call i32 @strcasecmp(i8* %4, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = load i32, i32* @LOG_WARNING
%18 = tail call i32 @log_msg(i32 %17, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0), i8* %4)
br label %19
19: ; preds = %13, %8, %10, %1, %16
%20 = phi i32 [ 1, %16 ], [ 1, %1 ], [ 1, %10 ], [ 1, %8 ], [ 0, %13 ]
ret i32 %20
}