#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 getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(void) {
  char nome[10], sobrenome[30], nome_completo[39];
  float n1, n2, nf;
  printf("Digite o primeiro nome: ");
  scanf("%s", &nome);
  printf("Digite o sobrenome: ");
  scanf("%s", &sobrenome);
  printf("Digite a N1: ");
  scanf("%f", &n1);
  printf("Digite a N2: ");
  scanf("%f", &n2);
  strcpy(nome_completo, nome);
  strcat(nome_completo, " ");
  strcat(nome_completo, sobrenome);
  nf = n1 * 0.4 + n2 * 0.6;
  printf("\nO aluno %s tem a media final de %.2f.\n", nome_completo, nf);
  getchar(), getchar();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0xa(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    -0x30(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xea2(%rip),%rdi
lea    -0x64(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe82(%rip),%rdi
lea    -0x68(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x60(%rbp),%rdi
lea    -0xa(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x60(%rbp),%rdi
lea    0xe5d(%rip),%rsi
call   1070 <strcat@plt>
lea    -0x60(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1070 <strcat@plt>
movss  -0x64(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x68(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xdec(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xdd8(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x6c(%rbp)
lea    -0x60(%rbp),%rsi
movss  -0x6c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe13(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x70,%rsp
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebb(%rip),%rbx
lea    0x16(%rsp),%r14
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xea5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x20(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe9a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9a(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe87(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
lea    0xe55(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1070 <strcat@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  0xdd9(%rip),%xmm1
mulsd  0xdd9(%rip),%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe1e(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Digite o primeiro nome: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [21 x i8] c"Digite o sobrenome: \00"
@.str.3 = [14 x i8] c"Digite a N1: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [14 x i8] c"Digite a N2: \00"
@.str.6 = [2 x i8] c" \00"
@.str.7 = [40 x i8] c"\0AO aluno %s tem a media final de %.2f.\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [30 x i8]
%3 = alloca [39 x i8]
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [10 x i8]* %1)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [30 x i8]* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %4)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %5)
%15 = getelementptr inbounds [39 x i8], [39 x i8]* %3, i64 0, i64 0
%16 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%17 = call i32 @strcpy(i8* %15, i8* %16)
%18 = getelementptr inbounds [39 x i8], [39 x i8]* %3, i64 0, i64 0
%19 = call i32 @strcat(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%20 = getelementptr inbounds [39 x i8], [39 x i8]* %3, i64 0, i64 0
%21 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%22 = call i32 @strcat(i8* %20, i8* %21)
%23 = load float, float* %4
%24 = fpext float %23 to double
%25 = load float, float* %5
%26 = fpext float %25 to double
%27 = fmul double %26, 6.000000e-01
%28 = call double @llvm.fmuladd.f64(double %24, double 4.000000e-01, double %27)
%29 = fptrunc double %28 to float
store float %29, float* %6
%30 = getelementptr inbounds [39 x i8], [39 x i8]* %3, i64 0, i64 0
%31 = load float, float* %6
%32 = fpext float %31 to double
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i8* %30, double %32)
%34 = call i32 (...) @getchar()
%35 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"Digite o primeiro nome: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [21 x i8] c"Digite o sobrenome: \00"
@.str.3 = [14 x i8] c"Digite a N1: \00"
@.str.4 = [3 x i8] c"%f\00"
@.str.5 = [14 x i8] c"Digite a N2: \00"
@.str.6 = [2 x i8] c" \00"
@.str.7 = [40 x i8] c"\0AO aluno %s tem a media final de %.2f.\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = alloca [30 x i8]
%3 = alloca [39 x i8]
%4 = alloca float
%5 = alloca float
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [39 x i8], [39 x i8]* %3, i64 0, i64 0
%9 = bitcast float* %4 to i8*
%10 = bitcast float* %5 to i8*
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [10 x i8]* %1)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), [30 x i8]* %2)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %4)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), float* %5)
%19 = call i32 @strcpy(i8* %8, i8* %6)
%20 = call i32 @strcat(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%21 = call i32 @strcat(i8* %8, i8* %7)
%22 = load float, float* %4
%23 = fpext float %22 to double
%24 = load float, float* %5
%25 = fpext float %24 to double
%26 = fmul double %25, 6.000000e-01
%27 = call double @llvm.fmuladd.f64(double %23, double 4.000000e-01, double %26)
%28 = fptrunc double %27 to float
%29 = fpext float %28 to double
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0), i8* %8, double %29)
%31 = call i32 (...) @getchar()
%32 = call i32 (...) @getchar()
ret i32 0
}