#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 *);
scalar_t__ smbw_fd(int);
int smbw_fstat(int, void *);
int /*<<< orphan*/ xstat_convert(int, void *, double *);
int __fxstat(int vers, int fd, void *st) {
  double xx[32];
  int ret;
  if (smbw_fd(fd)) {
    return smbw_fstat(fd, st);
  }
  ret = (__fstat(fd, xx));
  xstat_convert(vers, st, xx);
  return ret;
}


x86 assembly (clang, -O0):
<__fxstat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <smbw_fd@plt>
cmp    $0x0,%rax
je     117b <__fxstat+0x3b>
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1030 <smbw_fstat@plt>
mov    %eax,-0x4(%rbp)
jmp    11ac <__fxstat+0x6c>
mov    -0xc(%rbp),%edi
lea    -0x120(%rbp),%rsi
call   1050 <__fstat@plt>
mov    %eax,-0x124(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
lea    -0x120(%rbp),%rdx
call   1060 <xstat_convert@plt>
mov    -0x124(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fxstat>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdx,%rbx
mov    %esi,%ebp
mov    %edi,%r14d
mov    %esi,%edi
call   1040 <smbw_fd@plt>
test   %rax,%rax
je     1178 <__fxstat+0x38>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x108,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <smbw_fstat@plt>
mov    %rsp,%r15
mov    %ebp,%edi
mov    %r15,%rsi
call   1050 <__fstat@plt>
mov    %eax,%ebp
mov    %r14d,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1060 <xstat_convert@plt>
mov    %ebp,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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