#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 *);
int __infer_nondet_int();
size_t confstr(int name, char *buf, size_t len) {
  int size;
  int ret;
  ret = __infer_nondet_int();
  if (ret < 0)
    while (1)
      ;
  if (len)
    size = __get_array_size(buf);
  else if (buf != 0)
    while (1)
      ;
  return ret;
}


x86 assembly (clang, -O0):
<confstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <__infer_nondet_int@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    1151 <confstr+0x31>
jmp    114c <confstr+0x2c>
jmp    114c <confstr+0x2c>
cmpq   $0x0,-0x18(%rbp)
je     116d <confstr+0x4d>
mov    -0x10(%rbp),%rdi
call   1040 <__get_array_size@plt>
mov    %eax,-0x1c(%rbp)
jmp    1187 <confstr+0x67>
cmpq   $0x0,-0x10(%rbp)
je     1182 <confstr+0x62>
jmp    117d <confstr+0x5d>
jmp    117d <confstr+0x5d>
jmp    1187 <confstr+0x67>
movslq -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<confstr>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
xor    %eax,%eax
call   1030 <__infer_nondet_int@plt>
test   %eax,%eax
js     1150 <confstr+0x30>
mov    %eax,%ebx
test   %r15,%r15
je     1152 <confstr+0x32>
mov    %r14,%rdi
call   1040 <__get_array_size@plt>
jmp    1162 <confstr+0x42>
nopw   0x0(%rax,%rax,1)
jmp    1150 <confstr+0x30>
test   %r14,%r14
je     1162 <confstr+0x42>
nopw   0x0(%rax,%rax,1)
jmp    1160 <confstr+0x40>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @confstr(i32 %0, i8* %1, i64 %2) {
%4 = tail call i32 (...) @__infer_nondet_int()
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %3, %6
br label %6
7: ; preds = %3
%8 = icmp eq i64 %2, 0
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = tail call i32 @__get_array_size(i8* %1)
br label %14
11: ; preds = %7
%12 = icmp eq i8* %1, null
br i1 %12, label %14, label %13
13: ; preds = %11, %13
br label %13
14: ; preds = %11, %9
%15 = zext i32 %4 to i64
ret i64 %15
}