#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 fstat(int, double *);
int real_fstat64(int, void *);
scalar_t__ smbw_fd(int);
int /*<<< orphan*/ stat64_convert(double *, void *);
int fstat64(int fd, void *st64) {
  if (smbw_fd(fd)) {
    double xx[32];
    int ret = fstat(fd, xx);
    stat64_convert(xx, st64);
    return ret;
  }
  return real_fstat64(fd, st64);
}


x86 assembly (clang, -O0):
<fstat64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <smbw_fd@plt>
cmp    $0x0,%rax
je     1197 <fstat64+0x57>
mov    -0x8(%rbp),%edi
lea    -0x110(%rbp),%rsi
call   1060 <fstat@plt>
mov    %eax,-0x114(%rbp)
lea    -0x110(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <stat64_convert@plt>
mov    -0x114(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a6 <fstat64+0x66>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <real_fstat64@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fstat64>:
push   %rbp
push   %r14
push   %rbx
sub    $0x100,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
call   1050 <smbw_fd@plt>
test   %rax,%rax
je     1182 <fstat64+0x42>
mov    %rsp,%r14
mov    %ebp,%edi
mov    %r14,%rsi
call   1060 <fstat@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <stat64_convert@plt>
mov    %ebp,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <real_fstat64@plt>

LLVM IR (-O0):
define i32 @fstat64(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca [32 x double]
%7 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
%8 = load i32, i32* %4
%9 = call i64 @smbw_fd(i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %2
%12 = load i32, i32* %4
%13 = getelementptr inbounds [32 x double], [32 x double]* %6, i64 0, i64 0
%14 = call i32 @fstat(i32 %12, double* %13)
store i32 %14, i32* %7
%15 = getelementptr inbounds [32 x double], [32 x double]* %6, i64 0, i64 0
%16 = load i8*, i8** %5
%17 = call i32 @stat64_convert(double* %15, i8* %16)
%18 = load i32, i32* %7
store i32 %18, i32* %3
br label %23
19: ; preds = %2
%20 = load i32, i32* %4
%21 = load i8*, i8** %5
%22 = call i32 @real_fstat64(i32 %20, i8* %21)
store i32 %22, i32* %3
br label %23
23: ; preds = %19, %11
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @fstat64(i32 %0, i8* %1) {
%3 = alloca [32 x double]
%4 = tail call i64 @smbw_fd(i32 %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = bitcast [32 x double]* %3 to i8*
%8 = getelementptr inbounds [32 x double], [32 x double]* %3, i64 0, i64 0
%9 = call i32 @fstat(i32 %0, double* %8)
%10 = call i32 @stat64_convert(double* %8, i8* %1)
br label %13
11: ; preds = %2
%12 = tail call i32 @real_fstat64(i32 %0, i8* %1)
br label %13
13: ; preds = %11, %6
%14 = phi i32 [ %9, %6 ], [ %12, %11 ]
ret i32 %14
}