#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*/ LC_ALL;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ setlocale(int /*<<< orphan*/, char *);
int main() {
  setlocale(LC_ALL, "Portuguese");
  char nome[31];
  char sexo;
  printf("Digite o seu nome: ");
  scanf("%30s", nome);
  printf("Digite o seu sexo M (Masculino) ou F (Feminino): ");
  scanf("%c", &sexo);
  if (sexo == 'f' || sexo == 'F')
    printf("\nOlá %s o seu sexo é feminino.", nome);
  else if (sexo == 'm' || sexo == 'M')
    printf("\nOlá %s o seu sexo é masculino.", nome);
  else
    printf("Sexo inválido");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
lea    0xeb1(%rip),%rsi
call   1040 <setlocale@plt>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xeb2(%rip),%rdi
call   1050 <scanf@plt>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x31(%rbp),%rsi
call   1050 <scanf@plt>
movsbl -0x31(%rbp),%eax
cmp    $0x66,%eax
je     11aa <main+0x7a>
movsbl -0x31(%rbp),%eax
cmp    $0x46,%eax
jne    11c1 <main+0x91>
lea    -0x30(%rbp),%rsi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1205 <main+0xd5>
movsbl -0x31(%rbp),%eax
cmp    $0x6d,%eax
je     11db <main+0xab>
movsbl -0x31(%rbp),%eax
cmp    $0x4d,%eax
jne    11f2 <main+0xc2>
lea    -0x30(%rbp),%rsi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1200 <main+0xd0>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1205 <main+0xd5>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
lea    0xebc(%rip),%rsi
call   1040 <setlocale@plt>
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1050 <scanf@plt>
lea    0xeb5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
lea    0xf(%rsp),%rsi
call   1050 <scanf@plt>
mov    0xf(%rsp),%al
and    $0xdf,%al
cmp    $0x4d,%al
je     119e <main+0x6e>
cmp    $0x46,%al
jne    11b3 <main+0x83>
lea    0xebd(%rip),%rdi
jmp    11a5 <main+0x75>
lea    0xed5(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    11c1 <main+0x91>
lea    0xee2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@LC_ALL = global i32 0
@.str = [11 x i8] c"Portuguese\00"
@.str.1 = [20 x i8] c"Digite o seu nome: \00"
@.str.2 = [5 x i8] c"%30s\00"
@.str.3 = [50 x i8] c"Digite o seu sexo M (Masculino) ou F (Feminino): \00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [33 x i8] c"\0AOl\C3\A1 %s o seu sexo \C3\A9 feminino.\00"
@.str.6 = [34 x i8] c"\0AOl\C3\A1 %s o seu sexo \C3\A9 masculino.\00"
@.str.7 = [15 x i8] c"Sexo inv\C3\A1lido\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [31 x i8]
%3 = alloca i8
store i32 0, i32* %1
%4 = load i32, i32* @LC_ALL
%5 = call i32 @setlocale(i32 %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [31 x i8], [31 x i8]* %2, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%11 = load i8, i8* %3
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 102
br i1 %13, label %18, label %14
14: ; preds = %0
%15 = load i8, i8* %3
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 70
br i1 %17, label %18, label %21
18: ; preds = %14, %0
%19 = getelementptr inbounds [31 x i8], [31 x i8]* %2, i64 0, i64 0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i8* %19)
br label %35
21: ; preds = %14
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 109
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i8, i8* %3
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 77
br i1 %28, label %29, label %32
29: ; preds = %25, %21
%30 = getelementptr inbounds [31 x i8], [31 x i8]* %2, i64 0, i64 0
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* %30)
br label %34
32: ; preds = %25
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %34
34: ; preds = %32, %29
br label %35
35: ; preds = %34, %18
%36 = load i32, i32* %1
ret i32 %36
}

LLVM IR (-O2):
@LC_ALL = global i32 0
@.str = [11 x i8] c"Portuguese\00"
@.str.1 = [20 x i8] c"Digite o seu nome: \00"
@.str.2 = [5 x i8] c"%30s\00"
@.str.3 = [50 x i8] c"Digite o seu sexo M (Masculino) ou F (Feminino): \00"
@.str.4 = [3 x i8] c"%c\00"
@.str.5 = [33 x i8] c"\0AOl\C3\A1 %s o seu sexo \C3\A9 feminino.\00"
@.str.6 = [34 x i8] c"\0AOl\C3\A1 %s o seu sexo \C3\A9 masculino.\00"
@.str.7 = [15 x i8] c"Sexo inv\C3\A1lido\00"
define i32 @main() {
%1 = alloca [31 x i8]
%2 = alloca i8
%3 = load i32, i32* @LC_ALL
%4 = tail call i32 @setlocale(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [31 x i8], [31 x i8]* %1, i64 0, i64 0
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%10 = load i8, i8* %2
%11 = and i8 %10, -33
switch i8 %11, label %16 [
i8 70, label %12
i8 77, label %14
]
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i8* %5)
br label %18
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0), i8* %5)
br label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0))
br label %18
18: ; preds = %14, %16, %12
ret i32 0
}