#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*/ *fopen(char *, char *);
int fseek(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, long);
void randomSample2() {
  FILE *file = fopen("H:\\codes\\C\\C-File\\file\\test4", "r");
  int result = fseek(file, 20, 0);
  printf("%d--", result);
  long cur = ftell(file);
  printf("cur = %d", cur);
}


x86 assembly (clang, -O0):
<randomSample2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
lea    0xec7(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x14,%esi
xor    %edx,%edx
call   1050 <fseek@plt>
mov    %eax,-0xc(%rbp)
movslq -0xc(%rbp),%rsi
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <ftell@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randomSample2>:
push   %rbx
lea    0xeb8(%rip),%rdi
lea    0xece(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x14,%esi
xor    %edx,%edx
call   1050 <fseek@plt>
movslq %eax,%rsi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
call   1040 <ftell@plt>
lea    0xea0(%rip),%rdi
mov    %rax,%rsi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"H:\\codes\\C\\C-File\\file\\test4\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [5 x i8] c"%d--\00"
@.str.3 = [9 x i8] c"cur = %d\00"
define void @randomSample2() {
%1 = alloca i32*
%2 = alloca i32
%3 = alloca i64
%4 = call i32* @fopen(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %1
%5 = load i32*, i32** %1
%6 = call i32 @fseek(i32* %5, i32 20, i32 0)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %8)
%10 = load i32*, i32** %1
%11 = call i64 @ftell(i32* %10)
store i64 %11, i64* %3
%12 = load i64, i64* %3
%13 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 %12)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"H:\\codes\\C\\C-File\\file\\test4\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [5 x i8] c"%d--\00"
@.str.3 = [9 x i8] c"cur = %d\00"
define void @randomSample2() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @fseek(i32* %1, i32 20, i32 0)
%3 = sext i32 %2 to i64
%4 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i64 %3)
%5 = tail call i64 @ftell(i32* %1)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i64 %5)
ret void
}