void f4(char *x, char **y, int z, char w[64]) {
  const char *s1 = "foobarbaz";
  const char *s2 = "abcde12345678";
  __builtin___strncpy_chk(x, s1, sizeof(s1), __builtin_object_size(x, 1));
  __builtin___strncat_chk(x, s2, sizeof(s2), __builtin_object_size(x, 1));
  __builtin___stpncpy_chk(x, s1, sizeof(s1), __builtin_object_size(x, 1));
  __builtin___strncpy_chk(w, s1, sizeof(w), __builtin_object_size(w, 1));
  __builtin___strncat_chk(w, s2, sizeof(w), __builtin_object_size(w, 1));
  __builtin___stpncpy_chk(w, s1, sizeof(w), __builtin_object_size(w, 1));
  const char s3[] = "foobarbaz";
  const char s4[] = "abcde12345678";
  __builtin___strncpy_chk(x, s3, sizeof(s3), __builtin_object_size(x, 1));
  __builtin___strncat_chk(x, s4, sizeof(s4), __builtin_object_size(x, 1));
  __builtin___stpncpy_chk(x, s3, sizeof(s3), __builtin_object_size(x, 1));
}


x86 assembly (clang, -O0):
<f4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xeb2(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xeb1(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x8,%edx
mov    $0xffffffffffffffff,%rcx
call   1040 <__strncpy_chk@plt>
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    $0x8,%edx
mov    $0xffffffffffffffff,%rcx
call   1050 <__strncat_chk@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x8,%edx
mov    $0xffffffffffffffff,%rcx
call   1030 <__stpncpy_chk@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x8,%edx
mov    $0xffffffffffffffff,%rcx
call   1040 <__strncpy_chk@plt>
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    $0x8,%edx
mov    $0xffffffffffffffff,%rcx
call   1050 <__strncat_chk@plt>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x8,%edx
mov    $0xffffffffffffffff,%rcx
call   1030 <__stpncpy_chk@plt>
mov    0xe06(%rip),%rax
mov    %rax,-0x3a(%rbp)
mov    0xe03(%rip),%ax
mov    %ax,-0x32(%rbp)
mov    0xdfa(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xdf8(%rip),%eax
mov    %eax,-0x40(%rbp)
mov    0xdf2(%rip),%ax
mov    %ax,-0x3c(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x3a(%rbp),%rsi
mov    $0xa,%edx
mov    $0xffffffffffffffff,%rcx
call   1040 <__strncpy_chk@plt>
mov    -0x8(%rbp),%rdi
lea    -0x48(%rbp),%rsi
mov    $0xe,%edx
mov    $0xffffffffffffffff,%rcx
call   1050 <__strncat_chk@plt>
mov    -0x8(%rbp),%rdi
lea    -0x3a(%rbp),%rsi
mov    $0xa,%edx
mov    $0xffffffffffffffff,%rcx
call   1030 <__stpncpy_chk@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f4>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rcx,%r14
mov    %rdi,%rbx
movabs $0x61627261626f6f66,%r13
72 62 61
mov    %r13,(%rdi)
lea    0xeb3(%rip),%r15
mov    $0x8,%edx
mov    %r15,%rsi
call   1040 <strncat@plt>
lea    0xe95(%rip),%r12
mov    $0x8,%edx
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <stpncpy@plt>
mov    %r13,(%r14)
mov    $0x8,%edx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <strncat@plt>
mov    $0x8,%edx
mov    %r14,%rdi
mov    %r12,%rsi
call   1050 <stpncpy@plt>
mov    %r13,(%rsp)
movw   $0x7a,0x8(%rsp)
movabs $0x38373635343332,%rax
mov    %rax,0x16(%rsp)
movabs $0x3332316564636261,%rax
31 32 33
mov    %rax,0x10(%rsp)
mov    %rsp,%r14
mov    $0xa,%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strncpy@plt>
lea    0x10(%rsp),%rsi
mov    $0xe,%edx
mov    %rbx,%rdi
call   1040 <strncat@plt>
mov    $0xa,%edx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <stpncpy@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"foobarbaz\00"
@.str.1 = [14 x i8] c"abcde12345678\00"
@__const.f4.s3 = [10 x i8] c"foobarbaz\00"
@__const.f4.s4 = [14 x i8] c"abcde12345678\00"
define void @f4(i8* %0, i8** %1, i32 %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [10 x i8]
%12 = alloca [14 x i8]
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
store i8* %3, i8** %8
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %9
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8** %10
%13 = load i8*, i8** %5
%14 = load i8*, i8** %9
%15 = load i8*, i8** %5
%16 = call i64 @llvm.objectsize.i64.p0i8(i8* %15, i1 false, i1 true, i1 false)
%17 = call i8* @__strncpy_chk(i8* %13, i8* %14, i64 8, i64 %16)
%18 = load i8*, i8** %5
%19 = load i8*, i8** %10
%20 = load i8*, i8** %5
%21 = call i64 @llvm.objectsize.i64.p0i8(i8* %20, i1 false, i1 true, i1 false)
%22 = call i8* @__strncat_chk(i8* %18, i8* %19, i64 8, i64 %21)
%23 = load i8*, i8** %5
%24 = load i8*, i8** %9
%25 = load i8*, i8** %5
%26 = call i64 @llvm.objectsize.i64.p0i8(i8* %25, i1 false, i1 true, i1 false)
%27 = call i8* @__stpncpy_chk(i8* %23, i8* %24, i64 8, i64 %26)
%28 = load i8*, i8** %8
%29 = load i8*, i8** %9
%30 = load i8*, i8** %8
%31 = call i64 @llvm.objectsize.i64.p0i8(i8* %30, i1 false, i1 true, i1 false)
%32 = call i8* @__strncpy_chk(i8* %28, i8* %29, i64 8, i64 %31)
%33 = load i8*, i8** %8
%34 = load i8*, i8** %10
%35 = load i8*, i8** %8
%36 = call i64 @llvm.objectsize.i64.p0i8(i8* %35, i1 false, i1 true, i1 false)
%37 = call i8* @__strncat_chk(i8* %33, i8* %34, i64 8, i64 %36)
%38 = load i8*, i8** %8
%39 = load i8*, i8** %9
%40 = load i8*, i8** %8
%41 = call i64 @llvm.objectsize.i64.p0i8(i8* %40, i1 false, i1 true, i1 false)
%42 = call i8* @__stpncpy_chk(i8* %38, i8* %39, i64 8, i64 %41)
%43 = bitcast [10 x i8]* %11 to i8*
%44 = bitcast [14 x i8]* %12 to i8*
%45 = load i8*, i8** %5
%46 = getelementptr inbounds [10 x i8], [10 x i8]* %11, i64 0, i64 0
%47 = load i8*, i8** %5
%48 = call i64 @llvm.objectsize.i64.p0i8(i8* %47, i1 false, i1 true, i1 false)
%49 = call i8* @__strncpy_chk(i8* %45, i8* %46, i64 10, i64 %48)
%50 = load i8*, i8** %5
%51 = getelementptr inbounds [14 x i8], [14 x i8]* %12, i64 0, i64 0
%52 = load i8*, i8** %5
%53 = call i64 @llvm.objectsize.i64.p0i8(i8* %52, i1 false, i1 true, i1 false)
%54 = call i8* @__strncat_chk(i8* %50, i8* %51, i64 14, i64 %53)
%55 = load i8*, i8** %5
%56 = getelementptr inbounds [10 x i8], [10 x i8]* %11, i64 0, i64 0
%57 = load i8*, i8** %5
%58 = call i64 @llvm.objectsize.i64.p0i8(i8* %57, i1 false, i1 true, i1 false)
%59 = call i8* @__stpncpy_chk(i8* %55, i8* %56, i64 10, i64 %58)
ret void
}

LLVM IR (-O2):
@__const.f4.s3 = [10 x i8] c"foobarbaz\00"
@__const.f4.s4 = [14 x i8] c"abcde12345678\00"
define void @f4(i8* %0, i8** nocapture readnone %1, i32 %2, i8* %3) {
%5 = alloca [10 x i8]
%6 = alloca [14 x i8]
%7 = bitcast i8* %0 to i64*
store i64 7017296931985518438, i64* %7
%8 = tail call i8* @strncat(i8* dereferenceable(1) %0, i8* dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @__const.f4.s4, i64 0, i64 0), i64 8)
%9 = tail call i8* @stpncpy(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__const.f4.s3, i64 0, i64 0), i64 8)
%10 = bitcast i8* %3 to i64*
store i64 7017296931985518438, i64* %10
%11 = tail call i8* @strncat(i8* dereferenceable(1) %3, i8* dereferenceable(14) getelementptr inbounds ([14 x i8], [14 x i8]* @__const.f4.s4, i64 0, i64 0), i64 8)
%12 = tail call i8* @stpncpy(i8* %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @__const.f4.s3, i64 0, i64 0), i64 8)
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%14 = getelementptr inbounds [14 x i8], [14 x i8]* %6, i64 0, i64 0
%15 = call i8* @strncpy(i8* dereferenceable(1) %0, i8* dereferenceable(1) %13, i64 10)
%16 = call i8* @strncat(i8* dereferenceable(1) %0, i8* dereferenceable(1) %14, i64 14)
%17 = call i8* @stpncpy(i8* %0, i8* %13, i64 10)
ret void
}