#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__ strncmp(char *, char *, int);
int conf_file_fixup1(char *target, char *part, int len) {
  if (strncmp(target, part, len))
    return 1;
  while ((target[0] = target[len]))
    target++;
  return 0;
}


x86 assembly (clang, -O0):
<conf_file_fixup1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1149 <conf_file_fixup1+0x39>
movl   $0x1,-0x4(%rbp)
jmp    117f <conf_file_fixup1+0x6f>
jmp    114e <conf_file_fixup1+0x3e>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x10(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
je     1178 <conf_file_fixup1+0x68>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    114e <conf_file_fixup1+0x3e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<conf_file_fixup1>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
call   1030 <strncmp@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    1140 <conf_file_fixup1+0x30>
movslq %ebp,%rax
nopl   (%rax)
movzbl (%rbx,%rax,1),%ecx
mov    %cl,(%rbx)
add    $0x1,%rbx
test   %cl,%cl
jne    1130 <conf_file_fixup1+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @conf_file_fixup1(i8* %0, i8* %1, i32 %2) {
%4 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %2)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = sext i32 %2 to i64
br label %8
8: ; preds = %8, %6
%9 = phi i8* [ %13, %8 ], [ %0, %6 ]
%10 = getelementptr inbounds i8, i8* %9, i64 %7
%11 = load i8, i8* %10
store i8 %11, i8* %9
%12 = icmp eq i8 %11, 0
%13 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %12, label %14, label %8
14: ; preds = %8, %3
%15 = phi i32 [ 1, %3 ], [ 0, %8 ]
ret i32 %15
}