#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 __get_array_size(char const *);
int /*<<< orphan*/ __infer_set_flag(char *, char *);
char *strncpy(char *s1, const char *s2, size_t n) {
  int size1, size2;
  __infer_set_flag("ignore_return", "");
  size1 = __get_array_size(s1);
  size2 = __get_array_size(s2);
  if (n > size1)
    while (1)
      ;
  return s1;
}


x86 assembly (clang, -O0):
<strncpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xec5(%rip),%rdi
lea    0xecb(%rip),%rsi
call   1030 <__infer_set_flag@plt>
mov    -0x8(%rbp),%rdi
call   1040 <__get_array_size@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <__get_array_size@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
cmp    %rcx,%rax
jbe    117a <strncpy+0x5a>
jmp    1175 <strncpy+0x55>
jmp    1175 <strncpy+0x55>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncpy>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0xec9(%rip),%rdi
lea    0xecf(%rip),%rsi
call   1030 <__infer_set_flag@plt>
mov    %rbx,%rdi
call   1040 <__get_array_size@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1040 <__get_array_size@plt>
movslq %ebp,%rax
cmp    %r14,%rax
jae    1162 <strncpy+0x42>
nopl   (%rax)
jmp    1160 <strncpy+0x40>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"ignore_return\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @strncpy(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%9 = call i32 @__infer_set_flag(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%10 = load i8*, i8** %4
%11 = call i32 @__get_array_size(i8* %10)
store i32 %11, i32* %7
%12 = load i8*, i8** %5
%13 = call i32 @__get_array_size(i8* %12)
store i32 %13, i32* %8
%14 = load i64, i64* %6
%15 = load i32, i32* %7
%16 = sext i32 %15 to i64
%17 = icmp ugt i64 %14, %16
br i1 %17, label %18, label %20
18: ; preds = %3
br label %19
19: ; preds = %18, %19
br label %19
20: ; preds = %3
%21 = load i8*, i8** %4
ret i8* %21
}

LLVM IR (-O2):
@.str = [14 x i8] c"ignore_return\00"
@.str.1 = [1 x i8] zeroinitializer
define i8* @strncpy(i8* returned %0, i8* %1, i64 %2) {
%4 = tail call i32 @__infer_set_flag(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @__get_array_size(i8* %0)
%6 = tail call i32 @__get_array_size(i8* %1)
%7 = sext i32 %5 to i64
%8 = icmp ult i64 %7, %2
br i1 %8, label %9, label %10
9: ; preds = %3, %9
br label %9
10: ; preds = %3
ret i8* %0
}