#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*/ printf(char *);
int scanf(char *, int *);
int main(void) {
  int n, r;
  printf("\nDigite o número a ser analisado: ");
  r = scanf("%d", &n);
  printf("\n\n");
  if (r != 1) {
    printf("Valor invalido!!\n\n");
    return 1;
  }
  if (n % 2 == 0) {
    printf("É par!");
  } else {
    printf("É ímpar!");
  }
  printf("\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    %eax,-0xc(%rbp)
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x1,-0xc(%rbp)
je     117c <main+0x5c>
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11c0 <main+0xa0>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11a1 <main+0x81>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
jmp    11ad <main+0x8d>
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
call   1040 <printf@plt>
lea    0xede(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    %eax,%ebp
lea    0xef1(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
cmp    $0x1,%ebp
jne    1186 <main+0x56>
testb  $0x1,0x4(%rsp)
lea    0xeb5(%rip),%rax
lea    0xeb6(%rip),%rdi
cmove  %rax,%rdi
call   1040 <printf@plt>
xor    %ebp,%ebp
jmp    1192 <main+0x62>
mov    $0x1,%ebp
lea    0xea8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"\0ADigite o n\C3\BAmero a ser analisado: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [3 x i8] c"\0A\0A\00"
@.str.3 = [19 x i8] c"Valor invalido!!\0A\0A\00"
@.str.4 = [8 x i8] c"\C3\89 par!\00"
@.str.5 = [11 x i8] c"\C3\89 \C3\ADmpar!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 %5, i32* %3
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%7 = load i32, i32* %3
%8 = icmp ne i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %1
br label %21
11: ; preds = %0
%12 = load i32, i32* %2
%13 = srem i32 %12, 2
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br label %19
17: ; preds = %11
%18 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
br label %19
19: ; preds = %17, %15
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %1
br label %21
21: ; preds = %19, %9
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
@.str = [36 x i8] c"\0ADigite o n\C3\BAmero a ser analisado: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [8 x i8] c"\C3\89 par!\00"
@.str.5 = [11 x i8] c"\C3\89 \C3\ADmpar!\00"
@str.6 = [2 x i8] c"\0A\00"
@str.7 = [18 x i8] c"Valor invalido!!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0))
%6 = icmp eq i32 %4, 1
br i1 %6, label %7, label %13
7: ; preds = %0
%8 = load i32, i32* %1
%9 = and i32 %8, 1
%10 = icmp eq i32 %9, 0
%11 = select i1 %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0)
%12 = call i32 @printf(i8* dereferenceable(1) %11)
br label %13
13: ; preds = %0, %7
%14 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0), %7 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.7, i64 0, i64 0), %0 ]
%15 = phi i32 [ 0, %7 ], [ 1, %0 ]
%16 = call i32 @puts(i8* dereferenceable(1) %14)
ret i32 %15
}