#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 */
struct inotify_event {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int inotifytools_sprintf(char *, struct inotify_event *, char *);
int inotifytools_fprintf(FILE *file, struct inotify_event *event, char *fmt) {
  static char out[4096 + 1];
  static int ret;
  ret = inotifytools_sprintf(out, event, fmt);
  if (-1 != ret)
    fprintf(file, "%s", out);
  return ret;
}


x86 assembly (clang, -O0):
<inotifytools_fprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0x2efd(%rip),%rdi
call   1040 <inotifytools_sprintf@plt>
mov    %eax,0x3ef6(%rip)
mov    $0xffffffff,%eax
cmp    0x3eeb(%rip),%eax
je     1176 <inotifytools_fprintf+0x56>
mov    -0x8(%rbp),%rdi
lea    0xe96(%rip),%rsi
lea    0x2ecf(%rip),%rdx
call   1030 <fprintf@plt>
mov    0x3ec8(%rip),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inotifytools_fprintf>:
push   %rbx
mov    %rdi,%rbx
lea    0x2f15(%rip),%rdi
call   1040 <inotifytools_sprintf@plt>
mov    %eax,0x3f0e(%rip)
cmp    $0xffffffff,%eax
je     1152 <inotifytools_fprintf+0x32>
lea    0x2efe(%rip),%rdi
mov    %rbx,%rsi
call   1030 <fputs@plt>
mov    0x3ef4(%rip),%eax
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.inotify_event = type { i32 }
@inotifytools_fprintf.out = internal global [4097 x i8] zeroinitializer
@inotifytools_fprintf.ret = internal global i32 0
@.str = [3 x i8] c"%s\00"
define i32 @inotifytools_fprintf(i32* %0, %struct.inotify_event* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca %struct.inotify_event*
%6 = alloca i8*
store i32* %0, i32** %4
store %struct.inotify_event* %1, %struct.inotify_event** %5
store i8* %2, i8** %6
%7 = load %struct.inotify_event*, %struct.inotify_event** %5
%8 = load i8*, i8** %6
%9 = call i32 @inotifytools_sprintf(i8* getelementptr inbounds ([4097 x i8], [4097 x i8]* @inotifytools_fprintf.out, i64 0, i64 0), %struct.inotify_event* %7, i8* %8)
store i32 %9, i32* @inotifytools_fprintf.ret
%10 = load i32, i32* @inotifytools_fprintf.ret
%11 = icmp ne i32 -1, %10
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i32*, i32** %4
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4097 x i8], [4097 x i8]* @inotifytools_fprintf.out, i64 0, i64 0))
br label %15
15: ; preds = %12, %3
%16 = load i32, i32* @inotifytools_fprintf.ret
ret i32 %16
}

LLVM IR (-O2):
%struct.inotify_event = type { i32 }
@inotifytools_fprintf.out = internal global [4097 x i8] zeroinitializer
@inotifytools_fprintf.ret = internal unnamed_addr global i32 0
define i32 @inotifytools_fprintf(i32* nocapture %0, %struct.inotify_event* %1, i8* %2) {
%4 = tail call i32 @inotifytools_sprintf(i8* getelementptr inbounds ([4097 x i8], [4097 x i8]* @inotifytools_fprintf.out, i64 0, i64 0), %struct.inotify_event* %1, i8* %2)
store i32 %4, i32* @inotifytools_fprintf.ret
%5 = icmp eq i32 %4, -1
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i32 @fputs(i8* getelementptr inbounds ([4097 x i8], [4097 x i8]* @inotifytools_fprintf.out, i64 0, i64 0), i32* %0)
%8 = load i32, i32* @inotifytools_fprintf.ret
br label %9
9: ; preds = %6, %3
%10 = phi i32 [ %8, %6 ], [ -1, %3 ]
ret i32 %10
}