#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t __infer_nondet_size_t();
size_t fwrite(const void *__restrict ptr, size_t size, size_t nmemb,
              FILE *__restrict stream) {
  size_t res;
  res = __infer_nondet_size_t();
  if (size == 0 || nmemb == 0)
    return 0;
  if (res < 0 || res > nmemb)
    while (1)
      ;
  return res;
}


x86 assembly (clang, -O0):
<fwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    $0x0,%al
call   1030 <__infer_nondet_size_t@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1149 <fwrite+0x39>
cmpq   $0x0,-0x20(%rbp)
jne    1156 <fwrite+0x46>
movq   $0x0,-0x8(%rbp)
jmp    1181 <fwrite+0x71>
cmpq   $0x0,-0x30(%rbp)
jb     116f <fwrite+0x5f>
mov    -0x30(%rbp),%rax
cmp    -0x20(%rbp),%rax
jbe    1179 <fwrite+0x69>
jmp    1174 <fwrite+0x64>
jmp    1174 <fwrite+0x64>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fwrite>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%rbx
xor    %r14d,%r14d
xor    %eax,%eax
call   1030 <__infer_nondet_size_t@plt>
test   %rbx,%rbx
je     1142 <fwrite+0x32>
test   %r15,%r15
je     1142 <fwrite+0x32>
mov    %rax,%r14
cmp    %r15,%rax
jbe    1142 <fwrite+0x32>
nopw   0x0(%rax,%rax,1)
jmp    1140 <fwrite+0x30>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @fwrite(i8* noalias nocapture readnone %0, i64 %1, i64 %2, i32* noalias nocapture readnone %3) {
%5 = tail call i64 (...) @__infer_nondet_size_t()
%6 = icmp eq i64 %1, 0
%7 = icmp eq i64 %2, 0
%8 = or i1 %6, %7
br i1 %8, label %12, label %9
9: ; preds = %4
%10 = icmp ugt i64 %5, %2
br i1 %10, label %11, label %12
11: ; preds = %9, %11
br label %11
12: ; preds = %9, %4
%13 = phi i64 [ 0, %4 ], [ %5, %9 ]
ret i64 %13
}