#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 /*<<< orphan*/ do_fsave(unsigned char *);
unsigned char *malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ show_fpustate(unsigned char *, int);
int main(int argc, char **argv) {
  int i;
  unsigned char *buf = malloc(108);
  int xx = argc > 1;
  printf("Re-run with any arg to suppress least-significant\n"
         "   16 bits of FP numbers\n");
  for (i = 0; i < 108; i++)
    buf[i] = 0xAA;
  do_fsave(buf);
  show_fpustate(buf, xx);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x6c,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpl   $0x1,-0x8(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x24(%rbp)
lea    0xe86(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
cmpl   $0x6c,-0x14(%rbp)
jge    11aa <main+0x6a>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0xaa,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1186 <main+0x46>
mov    -0x20(%rbp),%rdi
call   1030 <do_fsave@plt>
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1050 <show_fpustate@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%r14d
mov    $0x6c,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
movaps 0xe99(%rip),%xmm0
movups %xmm0,(%rbx)
movups %xmm0,0x10(%rbx)
movups %xmm0,0x20(%rbx)
movups %xmm0,0x30(%rbx)
movups %xmm0,0x40(%rbx)
movups %xmm0,0x50(%rbx)
movups %xmm0,0x5c(%rbx)
xor    %ebp,%ebp
cmp    $0x2,%r14d
setge  %bpl
mov    %rbx,%rdi
call   1040 <do_fsave@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1050 <show_fpustate@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [76 x i8] c"Re-run with any arg to suppress least-significant\0A 16 bits of FP numbers\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i8* @malloc(i32 108)
store i8* %9, i8** %7
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 1
%12 = zext i1 %11 to i32
store i32 %12, i32* %8
%13 = call i32 @printf(i8* getelementptr inbounds ([76 x i8], [76 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
br label %14
14: ; preds = %22, %2
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 108
br i1 %16, label %17, label %25
17: ; preds = %14
%18 = load i8*, i8** %7
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 -86, i8* %21
br label %22
22: ; preds = %17
%23 = load i32, i32* %6
%24 = add nsw i32 %23, 1
store i32 %24, i32* %6
br label %14
25: ; preds = %14
%26 = load i8*, i8** %7
%27 = call i32 @do_fsave(i8* %26)
%28 = load i8*, i8** %7
%29 = load i32, i32* %8
%30 = call i32 @show_fpustate(i8* %28, i32 %29)
ret i32 0
}

LLVM IR (-O2):
@str = [75 x i8] c"Re-run with any arg to suppress least-significant\0A 16 bits of FP numbers\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call dereferenceable_or_null(108) i8* @malloc(i32 108)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([75 x i8], [75 x i8]* @str, i64 0, i64 0))
%5 = icmp sgt i32 %0, 1
%6 = zext i1 %5 to i32
%7 = tail call i32 @do_fsave(i8* %3)
%8 = tail call i32 @show_fpustate(i8* %3, i32 %6)
ret i32 0
}