#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*/ fpos_t;

/* Variables and functions */
int /*<<< orphan*/ fgetpos(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ fsetpos(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stdin;
int main(void) {
  fpos_t pos;
  (void)fgetpos(stdin, &pos);
  (void)fsetpos(stdin, &pos);
  printf("#undef HAVE_FPOS\n");
  printf("#define HAVE_FPOS 1  /* yes */\n\n");
  printf("typedef fpos_t FILEPOS;\n");
  printf("#define FPOS_POS_BITS %d\n\n", sizeof(fpos_t) * 8);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1040 <fgetpos@plt>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1050 <fsetpos@plt>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
mov    $0x20,%esi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    0x2e9d(%rip),%r14
mov    (%r14),%edi
lea    0x4(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <fgetpos@plt>
mov    (%r14),%edi
mov    %rbx,%rsi
call   1060 <fsetpos@plt>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
lea    0xec7(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6f(%rip),%rdi
mov    $0x20,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [18 x i8] c"#undef HAVE_FPOS\0A\00"
@.str.1 = [33 x i8] c"#define HAVE_FPOS 1 /* yes */\0A\0A\00"
@.str.2 = [25 x i8] c"typedef fpos_t FILEPOS;\0A\00"
@.str.3 = [27 x i8] c"#define FPOS_POS_BITS %d\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = load i32, i32* @stdin
%4 = call i32 @fgetpos(i32 %3, i32* %2)
%5 = load i32, i32* @stdin
%6 = call i32 @fsetpos(i32 %5, i32* %2)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i64 32)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@.str.3 = [27 x i8] c"#define FPOS_POS_BITS %d\0A\0A\00"
@str = [17 x i8] c"#undef HAVE_FPOS\00"
@str.4 = [32 x i8] c"#define HAVE_FPOS 1 /* yes */\0A\00"
@str.5 = [24 x i8] c"typedef fpos_t FILEPOS;\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = load i32, i32* @stdin
%4 = call i32 @fgetpos(i32 %3, i32* %1)
%5 = load i32, i32* @stdin
%6 = call i32 @fsetpos(i32 %5, i32* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.4, i64 0, i64 0))
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.5, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i64 32)
ret i32 0
}