#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 /*<<< orphan*/ scanf(char *, int *);
main() {
  int octeto;
  char classe;
  printf("informe o octeto: ");
  scanf("%d", &octeto);
  if (octeto > 0 && octeto <= 127)
    classe = 'A';
  if (octeto > 127 && octeto <= 191)
    classe = 'B';
  if (octeto > 191 && octeto <= 223)
    classe = 'C';
  if (octeto > 223 && octeto <= 239)
    classe = 'D';
  if (octeto >= 240)
    classe = 'E';
  printf("Ip pertence a classe %c", classe);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    1165 <main+0x45>
cmpl   $0x7f,-0x8(%rbp)
jg     1165 <main+0x45>
movb   $0x41,-0x9(%rbp)
cmpl   $0x7f,-0x8(%rbp)
jle    1180 <main+0x60>
cmpl   $0xbf,-0x8(%rbp)
jg     1180 <main+0x60>
movb   $0x42,-0x9(%rbp)
cmpl   $0xbf,-0x8(%rbp)
jle    119e <main+0x7e>
cmpl   $0xdf,-0x8(%rbp)
jg     119e <main+0x7e>
movb   $0x43,-0x9(%rbp)
cmpl   $0xdf,-0x8(%rbp)
jle    11bc <main+0x9c>
cmpl   $0xef,-0x8(%rbp)
jg     11bc <main+0x9c>
movb   $0x44,-0x9(%rbp)
cmpl   $0xf0,-0x8(%rbp)
jl     11cd <main+0xad>
movb   $0x45,-0x9(%rbp)
movsbl -0x9(%rbp),%esi
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
mov    %eax,%ecx
and    $0xffffffc0,%ecx
xor    %edx,%edx
cmp    $0x80,%ecx
sete   %dl
add    $0x41,%edx
mov    %eax,%ecx
and    $0xffffffe0,%ecx
cmp    $0xc0,%ecx
mov    $0x43,%ecx
cmovne %edx,%ecx
mov    %eax,%edx
and    $0xfffffff0,%edx
cmp    $0xe0,%edx
mov    $0x44,%edx
cmovne %ecx,%edx
cmp    $0xf0,%eax
mov    $0x45,%esi
cmovl  %edx,%esi
lea    0xe85(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"informe o octeto: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"Ip pertence a classe %c\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 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)
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %12
8: ; preds = %0
%9 = load i32, i32* %2
%10 = icmp sle i32 %9, 127
br i1 %10, label %11, label %12
11: ; preds = %8
store i8 65, i8* %3
br label %12
12: ; preds = %11, %8, %0
%13 = load i32, i32* %2
%14 = icmp sgt i32 %13, 127
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sle i32 %16, 191
br i1 %17, label %18, label %19
18: ; preds = %15
store i8 66, i8* %3
br label %19
19: ; preds = %18, %15, %12
%20 = load i32, i32* %2
%21 = icmp sgt i32 %20, 191
br i1 %21, label %22, label %26
22: ; preds = %19
%23 = load i32, i32* %2
%24 = icmp sle i32 %23, 223
br i1 %24, label %25, label %26
25: ; preds = %22
store i8 67, i8* %3
br label %26
26: ; preds = %25, %22, %19
%27 = load i32, i32* %2
%28 = icmp sgt i32 %27, 223
br i1 %28, label %29, label %33
29: ; preds = %26
%30 = load i32, i32* %2
%31 = icmp sle i32 %30, 239
br i1 %31, label %32, label %33
32: ; preds = %29
store i8 68, i8* %3
br label %33
33: ; preds = %32, %29, %26
%34 = load i32, i32* %2
%35 = icmp sge i32 %34, 240
br i1 %35, label %36, label %37
36: ; preds = %33
store i8 69, i8* %3
br label %37
37: ; preds = %36, %33
%38 = load i8, i8* %3
%39 = sext i8 %38 to i32
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %1
ret i32 %41
}

LLVM IR (-O2):
@.str = [19 x i8] c"informe o octeto: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [24 x i8] c"Ip pertence a classe %c\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 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 = load i32, i32* %1
%6 = and i32 %5, -64
%7 = icmp eq i32 %6, 128
%8 = select i1 %7, i32 66, i32 65
%9 = and i32 %5, -32
%10 = icmp eq i32 %9, 192
%11 = select i1 %10, i32 67, i32 %8
%12 = and i32 %5, -16
%13 = icmp eq i32 %12, 224
%14 = select i1 %13, i32 68, i32 %11
%15 = icmp sgt i32 %5, 239
%16 = select i1 %15, i32 69, i32 %14
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %16)
ret i32 0
}