#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 */
scalar_t__ isspace(int /*<<< orphan*/);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strncmp(char *, char *, int);
int isdefine(char *line, char *name, char *defn) {
  char *name_ptr = line;
  char *defn_ptr = line;
  char *end_ptr = line;
  if (strncmp(line, "#define", 7) == 0) {
    name_ptr += 7;
    while (isspace(*(name_ptr++)))
      ;
    name_ptr -= 1;
    defn_ptr = name_ptr;
    while (!isspace(*(defn_ptr++)))
      ;
    defn_ptr -= 1;
    *(defn_ptr++) = '\0';
    while (isspace(*(defn_ptr++)))
      ;
    defn_ptr -= 1;
    end_ptr = defn_ptr;
    while (*(end_ptr++) != '\n')
      ;
    end_ptr -= 1;
    *end_ptr = '\0';
    strcpy(name, name_ptr);
    strcpy(defn, defn_ptr);
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<isdefine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe99(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    12a4 <isdefine+0x174>
mov    -0x28(%rbp),%rax
add    $0x7,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movsbl (%rax),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
je     11ad <isdefine+0x7d>
jmp    1187 <isdefine+0x57>
mov    -0x28(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
movsbl (%rax),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    11ee <isdefine+0xbe>
jmp    11f3 <isdefine+0xc3>
jmp    11c1 <isdefine+0x91>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
movb   $0x0,(%rax)
mov    -0x30(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x30(%rbp)
movsbl (%rax),%edi
call   1050 <isspace@plt>
cmp    $0x0,%rax
je     1237 <isdefine+0x107>
jmp    1211 <isdefine+0xe1>
mov    -0x30(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x38(%rbp)
movsbl (%rax),%eax
cmp    $0xa,%eax
je     126b <isdefine+0x13b>
jmp    124b <isdefine+0x11b>
mov    -0x38(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   1040 <strcpy@plt>
movl   $0x1,-0x4(%rbp)
jmp    12ab <isdefine+0x17b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isdefine>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xeb8(%rip),%rsi
mov    $0x7,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    11f8 <isdefine+0xc8>
add    $0x5,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsbl 0x2(%rbx),%edi
call   1050 <isspace@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1170 <isdefine+0x40>
lea    0x1(%rbx),%r12
cs nopw 0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1050 <isspace@plt>
test   %rax,%rax
je     1190 <isdefine+0x60>
movb   $0x0,(%rbx)
cs nopw 0x0(%rax,%rax,1)
nop
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1050 <isspace@plt>
test   %rax,%rax
jne    11b0 <isdefine+0x80>
mov    %rbx,%rax
cs nopw 0x0(%rax,%rax,1)
nop
cmpb   $0xa,(%rax)
lea    0x1(%rax),%rax
jne    11d0 <isdefine+0xa0>
movb   $0x0,-0x1(%rax)
mov    %r15,%rdi
mov    %r12,%rsi
call   1040 <strcpy@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [8 x i8] c"#define\00"
define i32 @isdefine(i8* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%11 = load i8*, i8** %5
store i8* %11, i8** %8
%12 = load i8*, i8** %5
store i8* %12, i8** %9
%13 = load i8*, i8** %5
store i8* %13, i8** %10
%14 = load i8*, i8** %5
%15 = call i64 @strncmp(i8* %14, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %75
17: ; preds = %3
%18 = load i8*, i8** %8
%19 = getelementptr inbounds i8, i8* %18, i64 7
store i8* %19, i8** %8
br label %20
20: ; preds = %27, %17
%21 = load i8*, i8** %8
%22 = getelementptr inbounds i8, i8* %21, i32 1
store i8* %22, i8** %8
%23 = load i8, i8* %21
%24 = sext i8 %23 to i32
%25 = call i64 @isspace(i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %20
br label %20
28: ; preds = %20
%29 = load i8*, i8** %8
%30 = getelementptr inbounds i8, i8* %29, i64 -1
store i8* %30, i8** %8
%31 = load i8*, i8** %8
store i8* %31, i8** %9
br label %32
32: ; preds = %40, %28
%33 = load i8*, i8** %9
%34 = getelementptr inbounds i8, i8* %33, i32 1
store i8* %34, i8** %9
%35 = load i8, i8* %33
%36 = sext i8 %35 to i32
%37 = call i64 @isspace(i32 %36)
%38 = icmp ne i64 %37, 0
%39 = xor i1 %38, true
br i1 %39, label %40, label %41
40: ; preds = %32
br label %32
41: ; preds = %32
%42 = load i8*, i8** %9
%43 = getelementptr inbounds i8, i8* %42, i64 -1
store i8* %43, i8** %9
%44 = load i8*, i8** %9
%45 = getelementptr inbounds i8, i8* %44, i32 1
store i8* %45, i8** %9
store i8 0, i8* %44
br label %46
46: ; preds = %53, %41
%47 = load i8*, i8** %9
%48 = getelementptr inbounds i8, i8* %47, i32 1
store i8* %48, i8** %9
%49 = load i8, i8* %47
%50 = sext i8 %49 to i32
%51 = call i64 @isspace(i32 %50)
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %46
br label %46
54: ; preds = %46
%55 = load i8*, i8** %9
%56 = getelementptr inbounds i8, i8* %55, i64 -1
store i8* %56, i8** %9
%57 = load i8*, i8** %9
store i8* %57, i8** %10
br label %58
58: ; preds = %64, %54
%59 = load i8*, i8** %10
%60 = getelementptr inbounds i8, i8* %59, i32 1
store i8* %60, i8** %10
%61 = load i8, i8* %59
%62 = sext i8 %61 to i32
%63 = icmp ne i32 %62, 10
br i1 %63, label %64, label %65
64: ; preds = %58
br label %58
65: ; preds = %58
%66 = load i8*, i8** %10
%67 = getelementptr inbounds i8, i8* %66, i64 -1
store i8* %67, i8** %10
%68 = load i8*, i8** %10
store i8 0, i8* %68
%69 = load i8*, i8** %6
%70 = load i8*, i8** %8
%71 = call i32 @strcpy(i8* %69, i8* %70)
%72 = load i8*, i8** %7
%73 = load i8*, i8** %9
%74 = call i32 @strcpy(i8* %72, i8* %73)
store i32 1, i32* %4
br label %76
75: ; preds = %3
store i32 0, i32* %4
br label %76
76: ; preds = %75, %65
%77 = load i32, i32* %4
ret i32 %77
}

LLVM IR (-O2):
@.str = [8 x i8] c"#define\00"
define i32 @isdefine(i8* %0, i8* %1, i8* %2) {
%4 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 7)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %38
6: ; preds = %3
%7 = getelementptr inbounds i8, i8* %0, i64 7
br label %8
8: ; preds = %8, %6
%9 = phi i8* [ %7, %6 ], [ %10, %8 ]
%10 = getelementptr inbounds i8, i8* %9, i64 1
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = tail call i64 @isspace(i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %8
15: ; preds = %8, %15
%16 = phi i8* [ %17, %15 ], [ %9, %8 ]
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8, i8* %16
%19 = sext i8 %18 to i32
%20 = tail call i64 @isspace(i32 %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %15, label %22
22: ; preds = %15
store i8 0, i8* %16
br label %23
23: ; preds = %23, %22
%24 = phi i8* [ %16, %22 ], [ %25, %23 ]
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = tail call i64 @isspace(i32 %27)
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %23
30: ; preds = %23, %30
%31 = phi i8* [ %32, %30 ], [ %25, %23 ]
%32 = getelementptr inbounds i8, i8* %31, i64 1
%33 = load i8, i8* %31
%34 = icmp eq i8 %33, 10
br i1 %34, label %35, label %30
35: ; preds = %30
store i8 0, i8* %31
%36 = tail call i32 @strcpy(i8* %1, i8* %9)
%37 = tail call i32 @strcpy(i8* %2, i8* %25)
br label %38
38: ; preds = %3, %35
%39 = phi i32 [ 1, %35 ], [ 0, %3 ]
ret i32 %39
}