#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 __infer_nondet_int();
int strncmp(const char *s1, const char *s2, size_t n) {
  int size_s1;
  int size_s2;
  int res;
  res = __infer_nondet_int();
  size_s1 = __get_array_size(s1);
  size_s2 = __get_array_size(s2);
  if ((n > size_s1) || (n > size_s2))
    while (1)
      ;
  return res;
}


x86 assembly (clang, -O0):
<strncmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <__infer_nondet_int@plt>
mov    %eax,-0x24(%rbp)
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
ja     1178 <strncmp+0x58>
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
cmp    %rcx,%rax
jbe    1182 <strncmp+0x62>
jmp    117d <strncmp+0x5d>
jmp    117d <strncmp+0x5d>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strncmp>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r15
mov    %rdi,%rbp
xor    %eax,%eax
call   1030 <__infer_nondet_int@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
call   1040 <__get_array_size@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   1040 <__get_array_size@plt>
movslq %ebp,%rcx
cmp    %rbx,%rcx
jb     1170 <strncmp+0x50>
cltq
cmp    %rbx,%rax
jb     1170 <strncmp+0x50>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
nopl   0x0(%rax)
jmp    1170 <strncmp+0x50>

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

LLVM IR (-O2):
define i32 @strncmp(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 (...) @__infer_nondet_int()
%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
%9 = sext i32 %6 to i64
%10 = icmp ult i64 %9, %2
%11 = select i1 %8, i1 true, i1 %10
br i1 %11, label %12, label %13
12: ; preds = %3, %12
br label %12
13: ; preds = %3
ret i32 %4
}