#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*/ clang_analyzer_eval(int);
scalar_t__ strlen(char *);
char *strncpy(char *, char *, int);
void strncpy_effects(char *x, char *y) {
  char a = x[0];
  clang_analyzer_eval(strncpy(x, y, 5) == x);
  clang_analyzer_eval(strlen(x) == strlen(y));
  clang_analyzer_eval(a == x[0]);
}


x86 assembly (clang, -O0):
<strncpy_effects>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x5,%edx
call   1030 <strncpy@plt>
cmp    -0x8(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <clang_analyzer_eval@plt>
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <clang_analyzer_eval@plt>
movsbl -0x11(%rbp),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <clang_analyzer_eval@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncpy_effects>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%bpl
mov    $0x5,%edx
call   1030 <strncpy@plt>
xor    %edi,%edi
cmp    %rbx,%rax
sete   %dil
call   1050 <clang_analyzer_eval@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <strlen@plt>
xor    %edi,%edi
cmp    %rax,%r15
sete   %dil
call   1050 <clang_analyzer_eval@plt>
xor    %edi,%edi
cmp    (%rbx),%bpl
sete   %dil
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <clang_analyzer_eval@plt>

LLVM IR (-O0):
define void @strncpy_effects(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
store i8 %8, i8* %5
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = call i8* @strncpy(i8* %9, i8* %10, i32 5)
%12 = load i8*, i8** %3
%13 = icmp eq i8* %11, %12
%14 = zext i1 %13 to i32
%15 = call i32 @clang_analyzer_eval(i32 %14)
%16 = load i8*, i8** %3
%17 = call i64 @strlen(i8* %16)
%18 = load i8*, i8** %4
%19 = call i64 @strlen(i8* %18)
%20 = icmp eq i64 %17, %19
%21 = zext i1 %20 to i32
%22 = call i32 @clang_analyzer_eval(i32 %21)
%23 = load i8, i8* %5
%24 = sext i8 %23 to i32
%25 = load i8*, i8** %3
%26 = getelementptr inbounds i8, i8* %25, i64 0
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %24, %28
%30 = zext i1 %29 to i32
%31 = call i32 @clang_analyzer_eval(i32 %30)
ret void
}

LLVM IR (-O2):
define void @strncpy_effects(i8* %0, i8* %1) {
%3 = load i8, i8* %0
%4 = tail call i8* @strncpy(i8* %0, i8* %1, i32 5)
%5 = icmp eq i8* %4, %0
%6 = zext i1 %5 to i32
%7 = tail call i32 @clang_analyzer_eval(i32 %6)
%8 = tail call i64 @strlen(i8* %0)
%9 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%10 = icmp eq i64 %8, %9
%11 = zext i1 %10 to i32
%12 = tail call i32 @clang_analyzer_eval(i32 %11)
%13 = load i8, i8* %0
%14 = icmp eq i8 %3, %13
%15 = zext i1 %14 to i32
%16 = tail call i32 @clang_analyzer_eval(i32 %15)
ret void
}