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

/* Variables and functions */
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ errno;
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, char *);
char *strerror(int /*<<< orphan*/);
int main() {
  int ret;
  FILE *fp = fopen("gn", "rw");
  ret = fseek(fp, 10, SEEK_SET);
  ret = fgetc(fp);
  printf("%d, %s\n", ret, strerror(errno));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xe96(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    0x2e57(%rip),%rax
mov    (%rax),%edx
mov    $0xa,%esi
call   1050 <fseek@plt>
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
mov    -0x14(%rbp),%esi
mov    %rax,%rdx
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xea8(%rip),%rdi
lea    0xea4(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    0x2e6a(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1050 <fseek@plt>
mov    %rbx,%rdi
call   1040 <fgetc@plt>
mov    %eax,%ebx
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
call   1070 <strerror@plt>
lea    0xe6a(%rip),%rdi
mov    %ebx,%esi
mov    %rax,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"gn\00"
@.str.1 = [3 x i8] c"rw\00"
@SEEK_SET = global i32 0
@.str.2 = [8 x i8] c"%d, %s\0A\00"
@errno = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32* @fopen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = load i32, i32* @SEEK_SET
%7 = call i32 @fseek(i32* %5, i32 10, i32 %6)
store i32 %7, i32* %2
%8 = load i32*, i32** %3
%9 = call i32 @fgetc(i32* %8)
store i32 %9, i32* %2
%10 = load i32, i32* %2
%11 = load i32, i32* @errno
%12 = call i8* @strerror(i32 %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %10, i8* %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"gn\00"
@.str.1 = [3 x i8] c"rw\00"
@SEEK_SET = global i32 0
@.str.2 = [8 x i8] c"%d, %s\0A\00"
@errno = global i32 0
define i32 @main() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%2 = load i32, i32* @SEEK_SET
%3 = tail call i32 @fseek(i32* %1, i32 10, i32 %2)
%4 = tail call i32 @fgetc(i32* %1)
%5 = load i32, i32* @errno
%6 = tail call i8* @strerror(i32 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 %4, i8* %6)
ret i32 0
}