int main(void) {
  char s1[30] = {0};
  char s2[30] = {"zSome Stringza"};
  char ct[30] = {"zzzzzzzz"};
  Sstrncpy(s1, ct, 10);
  printf("s1 = %s\n", s1);
  Sstrncat(s2, ct, 5);
  printf("s2 = %s\n", s2);
  printf("Return of Sstrncmp = %d\n", Sstrncmp(s2, ct, 1));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x1e,%edx
call   1050 <memset@plt>
mov    0xe8a(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xe87(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xe84(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xe82(%rip),%eax
mov    %eax,-0x38(%rbp)
mov    0xe7c(%rip),%ax
mov    %ax,-0x34(%rbp)
mov    0xe75(%rip),%rax
mov    %rax,-0x70(%rbp)
mov    0xe72(%rip),%rax
mov    %rax,-0x68(%rbp)
mov    0xe6f(%rip),%rax
mov    %rax,-0x60(%rbp)
mov    0xe6d(%rip),%eax
mov    %eax,-0x58(%rbp)
mov    0xe67(%rip),%ax
mov    %ax,-0x54(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    $0xa,%edx
mov    $0x0,%al
call   1030 <Sstrncpy@plt>
lea    -0x30(%rbp),%rsi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    $0x5,%edx
mov    $0x0,%al
call   1070 <Sstrncat@plt>
lea    -0x50(%rbp),%rsi
lea    0xe29(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x50(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    $0x1,%edx
mov    $0x0,%al
call   1060 <Sstrncmp@plt>
mov    %eax,%esi
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0x4e(%rsp)
movaps %xmm0,0x40(%rsp)
movups 0xeb3(%rip),%xmm0
movups %xmm0,0x2e(%rsp)
movaps 0xe99(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movups 0xebb(%rip),%xmm0
movups %xmm0,0xe(%rsp)
movaps 0xea1(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x40(%rsp),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0xa,%edx
xor    %eax,%eax
call   1030 <Sstrncpy@plt>
lea    0xe9a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
xor    %eax,%eax
call   1060 <Sstrncat@plt>
lea    0xe7b(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
xor    %eax,%eax
call   1050 <Sstrncmp@plt>
lea    0xe61(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.s2 = [30 x i8] c"zSome Stringza\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.ct = [30 x i8] c"zzzzzzzz\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [9 x i8] c"s1 = %s\0A\00"
@.str.1 = [9 x i8] c"s2 = %s\0A\00"
@.str.2 = [25 x i8] c"Return of Sstrncmp = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
%3 = alloca [30 x i8]
%4 = alloca [30 x i8]
store i32 0, i32* %1
%5 = bitcast [30 x i8]* %2 to i8*
%6 = bitcast [30 x i8]* %3 to i8*
%7 = bitcast [30 x i8]* %4 to i8*
%8 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%10 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @Sstrncpy to i32 (i8*, i8*, i32, ...)*)(i8* %8, i8* %9, i32 10)
%11 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%14 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%15 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @Sstrncat to i32 (i8*, i8*, i32, ...)*)(i8* %13, i8* %14, i32 5)
%16 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%19 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%20 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @Sstrncmp to i32 (i8*, i8*, i32, ...)*)(i8* %18, i8* %19, i32 1)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s2 = [30 x i8] c"zSome Stringza\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@__const.main.ct = [30 x i8] c"zzzzzzzz\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [9 x i8] c"s1 = %s\0A\00"
@.str.1 = [9 x i8] c"s2 = %s\0A\00"
@.str.2 = [25 x i8] c"Return of Sstrncmp = %d\0A\00"
define i32 @main() {
%1 = alloca [30 x i8]
%2 = alloca [30 x i8]
%3 = alloca [30 x i8]
%4 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%7 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @Sstrncpy to i32 (i8*, i8*, i32, ...)*)(i8* %4, i8* %6, i32 10)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %4)
%9 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @Sstrncat to i32 (i8*, i8*, i32, ...)*)(i8* %5, i8* %6, i32 5)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%11 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @Sstrncmp to i32 (i8*, i8*, i32, ...)*)(i8* %5, i8* %6, i32 1)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %11)
ret i32 0
}