#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 */
char EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
char fscanf(int /*<<< orphan*/ *, char *, int *, char *, char **, int *,
            float *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  FILE *arq_cliente;
  char var_sexo, var_arquivo_aux, nomecli[50];
  int cd_cli, vl_idade, indice = 0;
  float vl_limite_credito;
  arq_cliente = fopen("cliente.txt", "r");
  if (arq_cliente == NULL) {
    printf("\nArquivo cliente.txt não pode ser aberto.");
    printf("\nOcorreu um Erro Grave! Use alguma tecla para finalizar!");
    system("pause");
  } else {
    var_arquivo_aux = fscanf(arq_cliente, "%d %c %s %d %f", &cd_cli, &var_sexo,
                             &nomecli, &vl_idade, &vl_limite_credito);
    while (var_arquivo_aux != EOF) {
      indice = indice + 1;
      printf("\n------------------------------------------------------");
      printf("\n Dados do %dº cliente:", indice);
      printf("\n Codigo do cliente: %d \n Sexo %c", cd_cli, var_sexo);
      printf("\n Nome do cliente: %s ", nomecli);
      printf("\n Idade %d Credito: %8.2f", vl_idade, vl_limite_credito);
      printf("\n------------------------------------------------------");
      var_arquivo_aux =
          fscanf(arq_cliente, "%d %c %s %d %f", &cd_cli, &var_sexo, &nomecli,
                 &vl_idade, &vl_limite_credito);
    }
    fclose(arq_cliente);
    printf("\n *** FIM : [TECLE ALGO] ");
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x5c(%rbp)
lea    0xe8c(%rip),%rdi
lea    0xe91(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11bc <main+0x6c>
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xec0(%rip),%rdi
call   1040 <system@plt>
jmp    12c2 <main+0x172>
mov    -0x18(%rbp),%rdi
lea    -0x50(%rbp),%r8
lea    0xead(%rip),%rsi
lea    -0x54(%rbp),%rdx
lea    -0x19(%rbp),%rcx
lea    -0x58(%rbp),%r9
lea    -0x60(%rbp),%rax
mov    %rax,(%rsp)
call   1060 <fscanf@plt>
mov    %al,-0x1a(%rbp)
movsbl -0x1a(%rbp),%eax
mov    0x2df6(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     12a4 <main+0x154>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x5c(%rbp),%esi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x54(%rbp),%esi
movsbl -0x19(%rbp),%edx
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x50(%rbp),%rsi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x58(%rbp),%esi
movss  -0x60(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeb2(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xe1a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    -0x50(%rbp),%r8
lea    0xdf5(%rip),%rsi
lea    -0x54(%rbp),%rdx
lea    -0x19(%rbp),%rcx
lea    -0x58(%rbp),%r9
lea    -0x60(%rbp),%rax
mov    %rax,(%rsp)
call   1060 <fscanf@plt>
mov    %al,-0x1a(%rbp)
jmp    11e7 <main+0x97>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
lea    0xe9b(%rip),%rdi
lea    0xea0(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     1285 <main+0x135>
mov    %rax,%r14
lea    0x14(%rsp),%rax
mov    %rax,(%rsp)
lea    0xeeb(%rip),%rsi
lea    0x1c(%rsp),%rdx
lea    0x13(%rsp),%rcx
lea    0x20(%rsp),%r8
lea    0x18(%rsp),%r9
mov    %r14,%rdi
call   1060 <fscanf@plt>
mov    0x2e38(%rip),%r13
cmp    0x0(%r13),%al
je     126d <main+0x11d>
mov    $0x1,%ebp
lea    0xec1(%rip),%rbx
lea    0x20(%rsp),%r15
lea    0x18(%rsp),%r12
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xede(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x1c(%rsp),%esi
movsbl 0x13(%rsp),%edx
lea    0xede(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xef2(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x18(%rsp),%esi
movss  0x14(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xeea(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0x14(%rsp),%rax
mov    %rax,(%rsp)
mov    %r14,%rdi
lea    0xe2d(%rip),%rsi
lea    0x1c(%rsp),%rdx
lea    0x13(%rsp),%rcx
mov    %r15,%r8
mov    %r12,%r9
call   1060 <fscanf@plt>
add    $0x1,%ebp
cmp    0x0(%r13),%al
jne    11d0 <main+0x80>
mov    %r14,%rdi
call   1030 <fclose@plt>
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    12ad <main+0x15d>
lea    0xd82(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xd9f(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xdca(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"cliente.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [43 x i8] c"\0AArquivo cliente.txt n\C3\A3o pode ser aberto.\00"
@.str.3 = [57 x i8] c"\0AOcorreu um Erro Grave! Use alguma tecla para finalizar!\00"
@.str.4 = [6 x i8] c"pause\00"
@.str.5 = [15 x i8] c"%d %c %s %d %f\00"
@EOF = global i8 0
@.str.6 = [56 x i8] c"\0A------------------------------------------------------\00"
@.str.7 = [25 x i8] c"\0A Dados do %d\C2\BA cliente:\00"
@.str.8 = [34 x i8] c"\0A Codigo do cliente: %d \0A Sexo %c\00"
@.str.9 = [23 x i8] c"\0A Nome do cliente: %s \00"
@.str.10 = [26 x i8] c"\0A Idade %d Credito: %8.2f\00"
@.str.11 = [26 x i8] c"\0A *** FIM : [TECLE ALGO] \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8
%8 = alloca i8
%9 = alloca [50 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %12
%14 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %14, i32** %6
%15 = load i32*, i32** %6
%16 = icmp eq i32* %15, null
br i1 %16, label %17, label %21
17: ; preds = %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %55
21: ; preds = %2
%22 = load i32*, i32** %6
%23 = bitcast [50 x i8]* %9 to i8**
%24 = call signext i8 @fscanf(i32* %22, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32* %10, i8* %7, i8** %23, i32* %11, float* %13)
store i8 %24, i8* %8
br label %25
25: ; preds = %31, %21
%26 = load i8, i8* %8
%27 = sext i8 %26 to i32
%28 = load i8, i8* @EOF
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %27, %29
br i1 %30, label %31, label %51
31: ; preds = %25
%32 = load i32, i32* %12
%33 = add nsw i32 %32, 1
store i32 %33, i32* %12
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0))
%35 = load i32, i32* %12
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %10
%38 = load i8, i8* %7
%39 = sext i8 %38 to i32
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i32 %37, i32 %39)
%41 = getelementptr inbounds [50 x i8], [50 x i8]* %9, i64 0, i64 0
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8* %41)
%43 = load i32, i32* %11
%44 = load float, float* %13
%45 = fpext float %44 to double
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i32 %43, double %45)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0))
%48 = load i32*, i32** %6
%49 = bitcast [50 x i8]* %9 to i8**
%50 = call signext i8 @fscanf(i32* %48, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32* %10, i8* %7, i8** %49, i32* %11, float* %13)
store i8 %50, i8* %8
br label %25
51: ; preds = %25
%52 = load i32*, i32** %6
%53 = call i32 @fclose(i32* %52)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %3
br label %55
55: ; preds = %51, %17
%56 = load i32, i32* %3
ret i32 %56
}

LLVM IR (-O2):
@.str = [12 x i8] c"cliente.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [43 x i8] c"\0AArquivo cliente.txt n\C3\A3o pode ser aberto.\00"
@.str.3 = [57 x i8] c"\0AOcorreu um Erro Grave! Use alguma tecla para finalizar!\00"
@.str.4 = [6 x i8] c"pause\00"
@.str.5 = [15 x i8] c"%d %c %s %d %f\00"
@EOF = global i8 0
@.str.6 = [56 x i8] c"\0A------------------------------------------------------\00"
@.str.7 = [25 x i8] c"\0A Dados do %d\C2\BA cliente:\00"
@.str.8 = [34 x i8] c"\0A Codigo do cliente: %d \0A Sexo %c\00"
@.str.9 = [23 x i8] c"\0A Nome do cliente: %s \00"
@.str.10 = [26 x i8] c"\0A Idade %d Credito: %8.2f\00"
@.str.11 = [26 x i8] c"\0A *** FIM : [TECLE ALGO] \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i8
%4 = alloca [50 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = bitcast float* %7 to i8*
%12 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %18
14: ; preds = %2
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0))
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
%17 = tail call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
br label %44
18: ; preds = %2
%19 = bitcast [50 x i8]* %4 to i8**
%20 = call signext i8 @fscanf(i32* %12, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32* %5, i8* %3, i8** %19, i32* %6, float* %7)
%21 = load i8, i8* @EOF
%22 = icmp eq i8 %20, %21
br i1 %22, label %41, label %23
23: ; preds = %18, %23
%24 = phi i32 [ %25, %23 ], [ 0, %18 ]
%25 = add nuw nsw i32 %24, 1
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %25)
%28 = load i32, i32* %5
%29 = load i8, i8* %3
%30 = sext i8 %29 to i32
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i32 %28, i32 %30)
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8* %8)
%33 = load i32, i32* %6
%34 = load float, float* %7
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0), i32 %33, double %35)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @.str.6, i64 0, i64 0))
%38 = call signext i8 @fscanf(i32* %12, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0), i32* %5, i8* %3, i8** %19, i32* %6, float* %7)
%39 = load i8, i8* @EOF
%40 = icmp eq i8 %38, %39
br i1 %40, label %41, label %23
41: ; preds = %23, %18
%42 = call i32 @fclose(i32* %12)
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.11, i64 0, i64 0))
br label %44
44: ; preds = %14, %41
ret i32 0
}