#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*/ free(char *);
char *iraf2str(char *, int);
scalar_t__ strncmp(char *, char *, int);
int irafncmp(char *irafheader, char *teststring, int nc) {
  char *line;
  if ((line = iraf2str(irafheader, nc)) == NULL)
    return (1);
  if (strncmp(line, teststring, nc) == 0) {
    free(line);
    return (0);
  } else {
    free(line);
    return (1);
  }
}


x86 assembly (clang, -O0):
<irafncmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1050 <iraf2str@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1169 <irafncmp+0x39>
movl   $0x1,-0x4(%rbp)
jmp    11a8 <irafncmp+0x78>
mov    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1040 <strncmp@plt>
cmp    $0x0,%rax
jne    1198 <irafncmp+0x68>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
jmp    11a8 <irafncmp+0x78>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<irafncmp>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %edx,%esi
call   1050 <iraf2str@plt>
test   %rax,%rax
je     1168 <irafncmp+0x38>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1040 <strncmp@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    116d <irafncmp+0x3d>
mov    $0x1,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @irafncmp(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load i8*, i8** %5
%10 = load i32, i32* %7
%11 = call i8* @iraf2str(i8* %9, i32 %10)
store i8* %11, i8** %8
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 1, i32* %4
br label %26
14: ; preds = %3
%15 = load i8*, i8** %8
%16 = load i8*, i8** %6
%17 = load i32, i32* %7
%18 = call i64 @strncmp(i8* %15, i8* %16, i32 %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %14
%21 = load i8*, i8** %8
%22 = call i32 @free(i8* %21)
store i32 0, i32* %4
br label %26
23: ; preds = %14
%24 = load i8*, i8** %8
%25 = call i32 @free(i8* %24)
store i32 1, i32* %4
br label %26
26: ; preds = %23, %20, %13
%27 = load i32, i32* %4
ret i32 %27
}

LLVM IR (-O2):
define i32 @irafncmp(i8* %0, i8* %1, i32 %2) {
%4 = tail call i8* @iraf2str(i8* %0, i32 %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = tail call i64 @strncmp(i8* %4, i8* %1, i32 %2)
%8 = icmp ne i64 %7, 0
%9 = tail call i32 @free(i8* %4)
%10 = zext i1 %8 to i32
br label %11
11: ; preds = %6, %3
%12 = phi i32 [ 1, %3 ], [ %10, %6 ]
ret i32 %12
}