#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();
size_t strlcat(char *dst, const char *src, size_t size) {
  int size_src;
  int size_dst;
  int res;
  res = __infer_nondet_int();
  size_src = __get_array_size(src);
  size_dst = __get_array_size(dst);
  if (size > size_dst)
    while (1)
      ;
  if (res > size || res < 0)
    while (1)
      ;
  return res;
}


x86 assembly (clang, -O0):
<strlcat>:
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    -0x10(%rbp),%rdi
call   1040 <__get_array_size@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <__get_array_size@plt>
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
cmp    %rcx,%rax
jbe    1171 <strlcat+0x51>
jmp    116c <strlcat+0x4c>
jmp    116c <strlcat+0x4c>
movslq -0x24(%rbp),%rax
cmp    -0x18(%rbp),%rax
ja     1189 <strlcat+0x69>
cmpl   $0x0,-0x24(%rbp)
jge    1193 <strlcat+0x73>
jmp    118e <strlcat+0x6e>
jmp    118e <strlcat+0x6e>
movslq -0x24(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlcat>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%rbp
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <__infer_nondet_int@plt>
mov    %eax,%r14d
mov    %rbp,%rdi
call   1040 <__get_array_size@plt>
mov    %rbx,%rdi
call   1040 <__get_array_size@plt>
cltq
cmp    %r15,%rax
jae    1162 <strlcat+0x42>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
jmp    1160 <strlcat+0x40>
test   %r14d,%r14d
js     1180 <strlcat+0x60>
movslq %r14d,%rax
cmp    %r15,%rax
ja     1180 <strlcat+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
nopw   0x0(%rax,%rax,1)
jmp    1180 <strlcat+0x60>

LLVM IR (-O0):
define i64 @strlcat(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** %5
%12 = call i32 @__get_array_size(i8* %11)
store i32 %12, i32* %7
%13 = load i8*, i8** %4
%14 = call i32 @__get_array_size(i8* %13)
store i32 %14, i32* %8
%15 = load i64, i64* %6
%16 = load i32, i32* %8
%17 = sext i32 %16 to i64
%18 = icmp ugt i64 %15, %17
br i1 %18, label %19, label %21
19: ; preds = %3
br label %20
20: ; preds = %19, %20
br label %20
21: ; preds = %3
%22 = load i32, i32* %9
%23 = sext i32 %22 to i64
%24 = load i64, i64* %6
%25 = icmp ugt i64 %23, %24
br i1 %25, label %29, label %26
26: ; preds = %21
%27 = load i32, i32* %9
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %26, %21
br label %30
30: ; preds = %29, %30
br label %30
31: ; preds = %26
%32 = load i32, i32* %9
%33 = sext i32 %32 to i64
ret i64 %33
}

LLVM IR (-O2):
define i64 @strlcat(i8* %0, i8* %1, i64 %2) {
%4 = tail call i32 (...) @__infer_nondet_int()
%5 = tail call i32 @__get_array_size(i8* %1)
%6 = tail call i32 @__get_array_size(i8* %0)
%7 = sext i32 %6 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
%11 = sext i32 %4 to i64
%12 = icmp ugt i64 %11, %2
%13 = icmp slt i32 %4, 0
%14 = or i1 %13, %12
br i1 %14, label %15, label %16
15: ; preds = %10, %15
br label %15
16: ; preds = %10
ret i64 %11
}