#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 */
scalar_t__ EOF;
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ imprimeAltera(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ imprimeConsulta(int /*<<< orphan*/ *, char *, char *,
                                   char *);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
int /*<<< orphan*/ toUpperCase(char *, char *);
void geraCodigo(FILE *fEntrada, FILE *fConsulta, FILE *fAltera) {
  char tipo[80];
  char nome[80];
  char nomeUpperCase[80];
  while (fscanf(fEntrada, " %s %[^[;]%*s", tipo, nome) != EOF) {
    toUpperCase(nomeUpperCase, nome);
    printf("%s\t%s\t%s\n", tipo, nome, nomeUpperCase);
    imprimeConsulta(fConsulta, tipo, nome, nomeUpperCase);
    imprimeAltera(fAltera, tipo, nome, nomeUpperCase);
  }
}


x86 assembly (clang, -O0):
<geraCodigo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x70(%rbp),%rdx
lea    -0xc0(%rbp),%rcx
lea    0xe83(%rip),%rsi
call   1050 <fscanf@plt>
mov    0x2e5f(%rip),%rcx
cmp    (%rcx),%rax
je     11fe <geraCodigo+0xae>
lea    -0x110(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1070 <toUpperCase@plt>
lea    -0x70(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
lea    -0x110(%rbp),%rcx
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
lea    -0x70(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
lea    -0x110(%rbp),%rcx
call   1030 <imprimeConsulta@plt>
mov    -0x18(%rbp),%rdi
lea    -0x70(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
lea    -0x110(%rbp),%rcx
call   1060 <imprimeAltera@plt>
jmp    1167 <geraCodigo+0x17>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geraCodigo>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x108,%rsp
mov    %rdx,0x8(%rsp)
mov    %rsi,%r15
mov    %rdi,%r12
lea    0xe8d(%rip),%rsi
lea    0x60(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1050 <fscanf@plt>
mov    0x2e5f(%rip),%r14
cmp    (%r14),%rax
je     11fe <geraCodigo+0xae>
lea    0xb0(%rsp),%r13
lea    0x10(%rsp),%rbx
lea    0x60(%rsp),%rbp
mov    %r13,%rdi
mov    %rbx,%rsi
call   1070 <toUpperCase@plt>
lea    0xe5c(%rip),%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r13,%rcx
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r13,%rcx
call   1030 <imprimeConsulta@plt>
mov    0x8(%rsp),%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r13,%rcx
call   1060 <imprimeAltera@plt>
mov    %r12,%rdi
lea    0xe12(%rip),%rsi
mov    %rbp,%rdx
mov    %rbx,%rcx
call   1050 <fscanf@plt>
cmp    (%r14),%rax
jne    11a0 <geraCodigo+0x50>
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c" %s %[^[;]%*s\00"
@EOF = global i64 0
@.str.1 = [10 x i8] c"%s\09%s\09%s\0A\00"
define void @geraCodigo(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca [80 x i8]
%8 = alloca [80 x i8]
%9 = alloca [80 x i8]
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
br label %10
10: ; preds = %17, %3
%11 = load i32*, i32** %4
%12 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%13 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%14 = call i64 @fscanf(i32* %11, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %12, i8* %13)
%15 = load i64, i64* @EOF
%16 = icmp ne i64 %14, %15
br i1 %16, label %17, label %35
17: ; preds = %10
%18 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%20 = call i32 @toUpperCase(i8* %18, i8* %19)
%21 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%22 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%23 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%24 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %21, i8* %22, i8* %23)
%25 = load i32*, i32** %5
%26 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%27 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%28 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%29 = call i32 @imprimeConsulta(i32* %25, i8* %26, i8* %27, i8* %28)
%30 = load i32*, i32** %6
%31 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%32 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%33 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
%34 = call i32 @imprimeAltera(i32* %30, i8* %31, i8* %32, i8* %33)
br label %10
35: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c" %s %[^[;]%*s\00"
@EOF = global i64 0
@.str.1 = [10 x i8] c"%s\09%s\09%s\0A\00"
define void @geraCodigo(i32* nocapture %0, i32* %1, i32* %2) {
%4 = alloca [80 x i8]
%5 = alloca [80 x i8]
%6 = alloca [80 x i8]
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%10 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
%11 = load i64, i64* @EOF
%12 = icmp eq i64 %10, %11
br i1 %12, label %21, label %13
13: ; preds = %3, %13
%14 = call i32 @toUpperCase(i8* %9, i8* %8)
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %7, i8* %8, i8* %9)
%16 = call i32 @imprimeConsulta(i32* %1, i8* %7, i8* %8, i8* %9)
%17 = call i32 @imprimeAltera(i32* %2, i8* %7, i8* %8, i8* %9)
%18 = call i64 @fscanf(i32* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8)
%19 = load i64, i64* @EOF
%20 = icmp eq i64 %18, %19
br i1 %20, label %21, label %13
21: ; preds = %13, %3
ret void
}