#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*/ strcpy(char *, char const *);
char *strtok_r(char *, char *, char **);
int Parse_zone_line(const char *confbuf, char *zone, char *file) {
  int i = 0;
  char buf[1024] = {0};
  char *p = NULL, *str = NULL, *pstr;
  strcpy(buf, confbuf);
  for (p = buf; (str = strtok_r(p, " ", &pstr)) != NULL; p = NULL, i++) {
    if (i == 1) {
      strcpy(zone, str);
    } else if (i == 2) {
      strcpy(file, str);
    }
  }
  if (*zone == '\0' || *file == '\0')
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<Parse_zone_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
lea    -0x430(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
movq   $0x0,-0x438(%rbp)
movq   $0x0,-0x440(%rbp)
lea    -0x430(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x430(%rbp),%rax
mov    %rax,-0x438(%rbp)
mov    -0x438(%rbp),%rdi
lea    0xe5d(%rip),%rsi
lea    -0x448(%rbp),%rdx
call   1050 <strtok_r@plt>
mov    %rax,-0x440(%rbp)
cmp    $0x0,%rax
je     121c <Parse_zone_line+0xec>
cmpl   $0x1,-0x24(%rbp)
jne    11df <Parse_zone_line+0xaf>
mov    -0x18(%rbp),%rdi
mov    -0x440(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    11fe <Parse_zone_line+0xce>
cmpl   $0x2,-0x24(%rbp)
jne    11f9 <Parse_zone_line+0xc9>
mov    -0x20(%rbp),%rdi
mov    -0x440(%rbp),%rsi
call   1030 <strcpy@plt>
jmp    11fe <Parse_zone_line+0xce>
jmp    1203 <Parse_zone_line+0xd3>
movq   $0x0,-0x438(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1195 <Parse_zone_line+0x65>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     123c <Parse_zone_line+0x10c>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1248 <Parse_zone_line+0x118>
movl   $0xffffffff,-0x4(%rbp)
jmp    124f <Parse_zone_line+0x11f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Parse_zone_line>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x410,%rsp
mov    %rdx,%r14
mov    %rsi,%r13
mov    %rdi,%r15
lea    0x10(%rsp),%r12
xor    %ebx,%ebx
mov    $0x400,%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
lea    0xe8f(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %r12,%rdi
call   1050 <strtok_r@plt>
test   %rax,%rax
je     11cf <Parse_zone_line+0x9f>
lea    0xe76(%rip),%r15
lea    0x8(%rsp),%r12
jmp    11bd <Parse_zone_line+0x8d>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rax,%rsi
call   1030 <strcpy@plt>
add    $0x1,%ebx
xor    %edi,%edi
mov    %r15,%rsi
mov    %r12,%rdx
call   1050 <strtok_r@plt>
test   %rax,%rax
je     11cf <Parse_zone_line+0x9f>
mov    %r13,%rdi
cmp    $0x1,%ebx
je     11a0 <Parse_zone_line+0x70>
cmp    $0x2,%ebx
jne    11a8 <Parse_zone_line+0x78>
mov    %r14,%rdi
jmp    11a0 <Parse_zone_line+0x70>
cmpb   $0x0,0x0(%r13)
je     11de <Parse_zone_line+0xae>
cmpb   $0x1,(%r14)
sbb    %eax,%eax
jmp    11e3 <Parse_zone_line+0xb3>
mov    $0xffffffff,%eax
add    $0x410,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c" \00"
define i32 @Parse_zone_line(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca [1024 x i8]
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 0, i32* %8
%13 = bitcast [1024 x i8]* %9 to i8*
store i8* null, i8** %10
store i8* null, i8** %11
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%15 = load i8*, i8** %5
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
store i8* %17, i8** %10
br label %18
18: ; preds = %38, %3
%19 = load i8*, i8** %10
%20 = call i8* @strtok_r(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %12)
store i8* %20, i8** %11
%21 = icmp ne i8* %20, null
br i1 %21, label %22, label %41
22: ; preds = %18
%23 = load i32, i32* %8
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %29
25: ; preds = %22
%26 = load i8*, i8** %6
%27 = load i8*, i8** %11
%28 = call i32 @strcpy(i8* %26, i8* %27)
br label %37
29: ; preds = %22
%30 = load i32, i32* %8
%31 = icmp eq i32 %30, 2
br i1 %31, label %32, label %36
32: ; preds = %29
%33 = load i8*, i8** %7
%34 = load i8*, i8** %11
%35 = call i32 @strcpy(i8* %33, i8* %34)
br label %36
36: ; preds = %32, %29
br label %37
37: ; preds = %36, %25
br label %38
38: ; preds = %37
store i8* null, i8** %10
%39 = load i32, i32* %8
%40 = add nsw i32 %39, 1
store i32 %40, i32* %8
br label %18
41: ; preds = %18
%42 = load i8*, i8** %6
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 0
br i1 %45, label %51, label %46
46: ; preds = %41
%47 = load i8*, i8** %7
%48 = load i8, i8* %47
%49 = sext i8 %48 to i32
%50 = icmp eq i32 %49, 0
br i1 %50, label %51, label %52
51: ; preds = %46, %41
store i32 -1, i32* %4
br label %53
52: ; preds = %46
store i32 0, i32* %4
br label %53
53: ; preds = %52, %51
%54 = load i32, i32* %4
ret i32 %54
}

LLVM IR (-O2):
@.str = [2 x i8] c" \00"
define i32 @Parse_zone_line(i8* %0, i8* %1, i8* %2) {
%4 = alloca [1024 x i8]
%5 = alloca i8*
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = bitcast i8** %5 to i8*
%8 = call i32 @strcpy(i8* %6, i8* %0)
%9 = call i8* @strtok_r(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %5)
%10 = icmp eq i8* %9, null
br i1 %10, label %22, label %11
11: ; preds = %3, %18
%12 = phi i8* [ %20, %18 ], [ %9, %3 ]
%13 = phi i32 [ %19, %18 ], [ 0, %3 ]
switch i32 %13, label %18 [
i32 1, label %15
i32 2, label %14
]
14: ; preds = %11
br label %15
15: ; preds = %11, %14
%16 = phi i8* [ %2, %14 ], [ %1, %11 ]
%17 = call i32 @strcpy(i8* %16, i8* %12)
br label %18
18: ; preds = %15, %11
%19 = add nuw nsw i32 %13, 1
%20 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %5)
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %11
22: ; preds = %18, %3
%23 = load i8, i8* %1
%24 = icmp eq i8 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %22
%26 = load i8, i8* %2
%27 = icmp eq i8 %26, 0
%28 = sext i1 %27 to i32
br label %29
29: ; preds = %25, %22
%30 = phi i32 [ -1, %22 ], [ %28, %25 ]
ret i32 %30
}