#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*/ Mmc_Fat_Append();
int /*<<< orphan*/ Mmc_Fat_Assign(char *, int);
unsigned long Mmc_Fat_Get_File_Size();
int /*<<< orphan*/ Mmc_Fat_Write(char *, int);
unsigned int mem_data_wr(unsigned int *ana_res) {
  unsigned int thousands, hundreds, tens, ones, temp, i;
  const unsigned long size = 65536;
  char holder[6];
  unsigned long mmc_size;
  unsigned int re;
  Mmc_Fat_Assign("te_value.txt", 0xA0);
  mmc_size = Mmc_Fat_Get_File_Size();
  if (mmc_size < size) {
    Mmc_Fat_Append();
    for (i = 0; i < 128; i++) {
      thousands = ana_res[i] / 1000;
      temp = ana_res[i] % 1000;
      hundreds = temp / 100;
      temp = temp % 100;
      tens = temp / 10;
      ones = temp % 10;
      holder[0] = thousands + 48;
      holder[1] = hundreds + 48;
      holder[2] = tens + 48;
      holder[3] = ones + 48;
      holder[4] = '\r';
      holder[5] = '\n';
      Mmc_Fat_Write(holder, 6);
    }
    re = 1;
  } else {
    re = 0;
  }
  return re;
}


x86 assembly (clang, -O0):
<mem_data_wr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x10000,-0x28(%rbp)
lea    0xea5(%rip),%rdi
mov    $0xa0,%esi
call   1040 <Mmc_Fat_Assign@plt>
mov    $0x0,%al
call   1050 <Mmc_Fat_Get_File_Size@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x10000,-0x38(%rbp)
jae    1255 <mem_data_wr+0x115>
mov    $0x0,%al
call   1060 <Mmc_Fat_Append@plt>
movl   $0x0,-0x20(%rbp)
cmpl   $0x80,-0x20(%rbp)
jae    1249 <mem_data_wr+0x109>
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    (%rax,%rcx,4),%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x64,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x10(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x64,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x2e(%rbp)
mov    -0x10(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x2d(%rbp)
mov    -0x14(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x2c(%rbp)
mov    -0x18(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x2b(%rbp)
movb   $0xd,-0x2a(%rbp)
movb   $0xa,-0x29(%rbp)
lea    -0x2e(%rbp),%rdi
mov    $0x6,%esi
call   1030 <Mmc_Fat_Write@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    118c <mem_data_wr+0x4c>
movl   $0x1,-0x3c(%rbp)
jmp    125c <mem_data_wr+0x11c>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mem_data_wr>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xeae(%rip),%rdi
mov    $0xa0,%esi
call   1040 <Mmc_Fat_Assign@plt>
xor    %ebp,%ebp
xor    %eax,%eax
call   1050 <Mmc_Fat_Get_File_Size@plt>
cmp    $0xffff,%rax
ja     1202 <mem_data_wr+0xc2>
xor    %ebp,%ebp
xor    %eax,%eax
call   1060 <Mmc_Fat_Append@plt>
lea    0xa(%rsp),%r14
nop
mov    (%rbx,%rbp,4),%eax
imul   $0x10624dd3,%rax,%rcx
shr    $0x26,%rcx
imul   $0x3e8,%ecx,%edx
sub    %edx,%eax
movzwl %ax,%edx
shr    $0x2,%edx
imul   $0x147b,%edx,%edx
shr    $0x11,%edx
imul   $0x64,%edx,%esi
sub    %esi,%eax
imul   $0xcd,%eax,%esi
movzwl %si,%esi
shr    $0xb,%esi
lea    (%rsi,%rsi,1),%edi
lea    (%rdi,%rdi,4),%edi
sub    %dil,%al
add    $0x30,%cl
mov    %cl,0xa(%rsp)
or     $0x30,%dl
mov    %dl,0xb(%rsp)
or     $0x30,%sil
mov    %sil,0xc(%rsp)
or     $0x30,%al
mov    %al,0xd(%rsp)
movw   $0xa0d,0xe(%rsp)
mov    %r14,%rdi
mov    $0x6,%esi
call   1030 <Mmc_Fat_Write@plt>
add    $0x1,%rbp
cmp    $0x80,%rbp
jne    1180 <mem_data_wr+0x40>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"te_value.txt\00"
define i32 @mem_data_wr(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca [6 x i8]
%11 = alloca i64
%12 = alloca i32
store i32* %0, i32** %2
store i64 65536, i64* %9
%13 = call i32 @Mmc_Fat_Assign(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 160)
%14 = call i64 (...) @Mmc_Fat_Get_File_Size()
store i64 %14, i64* %11
%15 = load i64, i64* %11
%16 = icmp ult i64 %15, 65536
br i1 %16, label %17, label %67
17: ; preds = %1
%18 = call i32 (...) @Mmc_Fat_Append()
store i32 0, i32* %8
br label %19
19: ; preds = %63, %17
%20 = load i32, i32* %8
%21 = icmp ult i32 %20, 128
br i1 %21, label %22, label %66
22: ; preds = %19
%23 = load i32*, i32** %2
%24 = load i32, i32* %8
%25 = zext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = load i32, i32* %26
%28 = udiv i32 %27, 1000
store i32 %28, i32* %3
%29 = load i32*, i32** %2
%30 = load i32, i32* %8
%31 = zext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %29, i64 %31
%33 = load i32, i32* %32
%34 = urem i32 %33, 1000
store i32 %34, i32* %7
%35 = load i32, i32* %7
%36 = udiv i32 %35, 100
store i32 %36, i32* %4
%37 = load i32, i32* %7
%38 = urem i32 %37, 100
store i32 %38, i32* %7
%39 = load i32, i32* %7
%40 = udiv i32 %39, 10
store i32 %40, i32* %5
%41 = load i32, i32* %7
%42 = urem i32 %41, 10
store i32 %42, i32* %6
%43 = load i32, i32* %3
%44 = add i32 %43, 48
%45 = trunc i32 %44 to i8
%46 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 0
store i8 %45, i8* %46
%47 = load i32, i32* %4
%48 = add i32 %47, 48
%49 = trunc i32 %48 to i8
%50 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 1
store i8 %49, i8* %50
%51 = load i32, i32* %5
%52 = add i32 %51, 48
%53 = trunc i32 %52 to i8
%54 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 2
store i8 %53, i8* %54
%55 = load i32, i32* %6
%56 = add i32 %55, 48
%57 = trunc i32 %56 to i8
%58 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 3
store i8 %57, i8* %58
%59 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 4
store i8 13, i8* %59
%60 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 5
store i8 10, i8* %60
%61 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 0
%62 = call i32 @Mmc_Fat_Write(i8* %61, i32 6)
br label %63
63: ; preds = %22
%64 = load i32, i32* %8
%65 = add i32 %64, 1
store i32 %65, i32* %8
br label %19
66: ; preds = %19
store i32 1, i32* %12
br label %68
67: ; preds = %1
store i32 0, i32* %12
br label %68
68: ; preds = %67, %66
%69 = load i32, i32* %12
ret i32 %69
}

LLVM IR (-O2):
@.str = [13 x i8] c"te_value.txt\00"
define i32 @mem_data_wr(i32* nocapture %0) {
%2 = alloca [6 x i8]
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @Mmc_Fat_Assign(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 160)
%5 = tail call i64 (...) @Mmc_Fat_Get_File_Size()
%6 = icmp ult i64 %5, 65536
br i1 %6, label %7, label %35
7: ; preds = %1
%8 = tail call i32 (...) @Mmc_Fat_Append()
%9 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 1
%10 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 2
%11 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 3
%12 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 4
%13 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 5
br label %14
14: ; preds = %7, %14
%15 = phi i64 [ 0, %7 ], [ %33, %14 ]
%16 = getelementptr inbounds i32, i32* %0, i64 %15
%17 = load i32, i32* %16
%18 = udiv i32 %17, 1000
%19 = urem i32 %17, 1000
%20 = trunc i32 %19 to i16
%21 = udiv i16 %20, 100
%22 = urem i16 %20, 100
%23 = trunc i16 %22 to i8
%24 = udiv i8 %23, 10
%25 = urem i8 %23, 10
%26 = trunc i32 %18 to i8
%27 = add i8 %26, 48
store i8 %27, i8* %3
%28 = trunc i16 %21 to i8
%29 = or i8 %28, 48
store i8 %29, i8* %9
%30 = or i8 %24, 48
store i8 %30, i8* %10
%31 = or i8 %25, 48
store i8 %31, i8* %11
store i8 13, i8* %12
store i8 10, i8* %13
%32 = call i32 @Mmc_Fat_Write(i8* %3, i32 6)
%33 = add nuw nsw i64 %15, 1
%34 = icmp eq i64 %33, 128
br i1 %34, label %35, label %14
35: ; preds = %14, %1
%36 = phi i32 [ 0, %1 ], [ 1, %14 ]
ret i32 %36
}