#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 fscanf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
float getactime(FILE *fp) {
  int card, date;
  float ac;
  fseek(fp, 0, 0);
  if (3 == fscanf(fp, "%d %d %f\n", &card, &date, &ac)) {
    fseek(fp, 0, 0);
    return 0.0;
  }
  if (1 == fscanf(fp, "%f\n", &ac))
    return ac;
  perror("some strange error\n");
  fseek(fp, 0, 0);
  return 0.0;
}


x86 assembly (clang, -O0):
<getactime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <fseek@plt>
mov    -0x10(%rbp),%rdi
lea    0xeac(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x1c(%rbp),%r8
mov    $0x0,%al
call   1030 <fscanf@plt>
mov    %eax,%ecx
mov    $0x3,%eax
cmp    %ecx,%eax
jne    1190 <getactime+0x60>
mov    -0x10(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <fseek@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e5 <getactime+0xb5>
mov    -0x10(%rbp),%rdi
lea    0xe6b(%rip),%rsi
lea    -0x1c(%rbp),%rdx
mov    $0x0,%al
call   1030 <fscanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    %ecx,%eax
jne    11c4 <getactime+0x94>
movss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11e5 <getactime+0xb5>
lea    0xe3f(%rip),%rdi
call   1050 <perror@plt>
mov    -0x10(%rbp),%rdi
xor    %edx,%edx
mov    %edx,%esi
call   1040 <fseek@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getactime>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
xor    %esi,%esi
xor    %edx,%edx
call   1040 <fseek@plt>
lea    0xeb8(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <fscanf@plt>
cmp    $0x3,%eax
jne    1177 <getactime+0x47>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <fseek@plt>
xorps  %xmm0,%xmm0
jmp    1198 <getactime+0x68>
lea    0xe88(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <fscanf@plt>
cmp    $0x1,%eax
jne    119e <getactime+0x6e>
movss  0x4(%rsp),%xmm0
add    $0x10,%rsp
pop    %rbx
ret
lea    0xe65(%rip),%rdi
call   1050 <perror@plt>
jmp    1166 <getactime+0x36>

LLVM IR (-O0):
@.str = [10 x i8] c"%d %d %f\0A\00"
@.str.1 = [4 x i8] c"%f\0A\00"
@.str.2 = [20 x i8] c"some strange error\0A\00"
define float @getactime(i32* %0) {
%2 = alloca float
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
store i32* %0, i32** %3
%7 = load i32*, i32** %3
%8 = call i32 @fseek(i32* %7, i32 0, i32 0)
%9 = load i32*, i32** %3
%10 = call i32 (i32*, i8*, ...) @fscanf(i32* %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5, float* %6)
%11 = icmp eq i32 3, %10
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load i32*, i32** %3
%14 = call i32 @fseek(i32* %13, i32 0, i32 0)
store float 0.000000e+00, float* %2
br label %25
15: ; preds = %1
%16 = load i32*, i32** %3
%17 = call i32 (i32*, i8*, ...) @fscanf(i32* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float* %6)
%18 = icmp eq i32 1, %17
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = load float, float* %6
store float %20, float* %2
br label %25
21: ; preds = %15
%22 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%23 = load i32*, i32** %3
%24 = call i32 @fseek(i32* %23, i32 0, i32 0)
store float 0.000000e+00, float* %2
br label %25
25: ; preds = %21, %19, %12
%26 = load float, float* %2
ret float %26
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d %f\0A\00"
@.str.1 = [4 x i8] c"%f\0A\00"
@.str.2 = [20 x i8] c"some strange error\0A\00"
define float @getactime(i32* nocapture %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = bitcast float* %4 to i8*
%8 = tail call i32 @fseek(i32* %0, i32 0, i32 0)
%9 = call i32 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, float* %4)
%10 = icmp eq i32 %9, 3
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @fseek(i32* %0, i32 0, i32 0)
br label %21
13: ; preds = %1
%14 = call i32 (i32*, i8*, ...) @fscanf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), float* %4)
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = load float, float* %4
br label %21
18: ; preds = %13
%19 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @fseek(i32* %0, i32 0, i32 0)
br label %21
21: ; preds = %18, %16, %11
%22 = phi float [ 0.000000e+00, %11 ], [ %17, %16 ], [ 0.000000e+00, %18 ]
ret float %22
}