#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 big(int, int);
int fits(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int small(int, int);
int main(int argc, const char *argv[]) {
  int num1, num2, maior, menor, val;
  printf("Insira um numero: \n");
  scanf("%d", &num1);
  printf("Insira um numero: \n");
  scanf("%d", &num2);
  maior = big(num1, num2);
  menor = small(num1, num2);
  val = 0;
  while (maior >= menor) {
    if (fits(maior, menor) == 1)
      val = 1;
    maior /= 10;
  }
  if (val == 1) {
    if (num1 > num2) {
      printf("%d é segmento de %d \n", num2, num1);
    } else {
      printf("%d é segmento de %d \n", num1, num2);
    }
  } else {
    if (num1 > num2) {
      printf("%d nao é segmento de %d \n", num2, num1);
    } else {
      printf("%d nao é segmento de %d \n", num1, num2);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe99(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7b(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1050 <big@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <small@plt>
mov    %eax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jl     11ff <main+0xaf>
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
call   1070 <fits@plt>
cmp    $0x1,%eax
jne    11ec <main+0x9c>
movl   $0x1,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
jmp    11c5 <main+0x75>
cmpl   $0x1,-0x24(%rbp)
jne    1247 <main+0xf7>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    122e <main+0xde>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1242 <main+0xf2>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xddc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1285 <main+0x135>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    126c <main+0x11c>
mov    -0x18(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1280 <main+0x130>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xdb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1285 <main+0x135>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec6(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xe82(%rip),%rbp
lea    0xc(%rsp),%rsi
mov    %rbp,%rdi
call   1070 <scanf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbp,%rdi
call   1070 <scanf@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1060 <big@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1050 <small@plt>
cmp    %eax,%ebx
jl     121a <main+0xba>
mov    %eax,%r14d
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
mov    %r14d,%esi
call   1080 <fits@plt>
cmp    $0x1,%eax
cmove  %eax,%ebp
movslq %ebx,%rax
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x22,%rbx
add    %eax,%ebx
cmp    %r14d,%ebx
jge    11d0 <main+0x70>
cmp    $0x1,%ebp
jne    121a <main+0xba>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%eax
lea    0xdf3(%rip),%rdi
cmp    %eax,%edx
jg     122d <main+0xcd>
mov    %edx,%esi
mov    %eax,%edx
jmp    122f <main+0xcf>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%eax
lea    0xdf1(%rip),%rdi
cmp    %eax,%edx
jle    1214 <main+0xb4>
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"Insira um numero: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"%d \C3\A9 segmento de %d \0A\00"
@.str.3 = [27 x i8] c"%d nao \C3\A9 segmento de %d \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = call i32 @big(i32 %15, i32 %16)
store i32 %17, i32* %8
%18 = load i32, i32* %6
%19 = load i32, i32* %7
%20 = call i32 @small(i32 %18, i32 %19)
store i32 %20, i32* %9
store i32 0, i32* %10
br label %21
21: ; preds = %31, %2
%22 = load i32, i32* %8
%23 = load i32, i32* %9
%24 = icmp sge i32 %22, %23
br i1 %24, label %25, label %34
25: ; preds = %21
%26 = load i32, i32* %8
%27 = load i32, i32* %9
%28 = call i32 @fits(i32 %26, i32 %27)
%29 = icmp eq i32 %28, 1
br i1 %29, label %30, label %31
30: ; preds = %25
store i32 1, i32* %10
br label %31
31: ; preds = %30, %25
%32 = load i32, i32* %8
%33 = sdiv i32 %32, 10
store i32 %33, i32* %8
br label %21
34: ; preds = %21
%35 = load i32, i32* %10
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %50
37: ; preds = %34
%38 = load i32, i32* %6
%39 = load i32, i32* %7
%40 = icmp sgt i32 %38, %39
br i1 %40, label %41, label %45
41: ; preds = %37
%42 = load i32, i32* %7
%43 = load i32, i32* %6
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %42, i32 %43)
br label %49
45: ; preds = %37
%46 = load i32, i32* %6
%47 = load i32, i32* %7
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %46, i32 %47)
br label %49
49: ; preds = %45, %41
br label %63
50: ; preds = %34
%51 = load i32, i32* %6
%52 = load i32, i32* %7
%53 = icmp sgt i32 %51, %52
br i1 %53, label %54, label %58
54: ; preds = %50
%55 = load i32, i32* %7
%56 = load i32, i32* %6
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %55, i32 %56)
br label %62
58: ; preds = %50
%59 = load i32, i32* %6
%60 = load i32, i32* %7
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %59, i32 %60)
br label %62
62: ; preds = %58, %54
br label %63
63: ; preds = %62, %49
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"%d \C3\A9 segmento de %d \0A\00"
@.str.3 = [27 x i8] c"%d nao \C3\A9 segmento de %d \0A\00"
@str.4 = [19 x i8] c"Insira um numero: \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.4, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.4, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = call i32 @big(i32 %11, i32 %12)
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i32 @small(i32 %14, i32 %15)
%17 = icmp slt i32 %13, %16
br i1 %17, label %36, label %18
18: ; preds = %2, %18
%19 = phi i32 [ %23, %18 ], [ 0, %2 ]
%20 = phi i32 [ %24, %18 ], [ %13, %2 ]
%21 = call i32 @fits(i32 %20, i32 %16)
%22 = icmp eq i32 %21, 1
%23 = select i1 %22, i32 1, i32 %19
%24 = sdiv i32 %20, 10
%25 = icmp slt i32 %24, %16
br i1 %25, label %26, label %18
26: ; preds = %18
%27 = icmp eq i32 %23, 1
br i1 %27, label %28, label %36
28: ; preds = %26
%29 = load i32, i32* %3
%30 = load i32, i32* %4
%31 = icmp sgt i32 %29, %30
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %30, i32 %29)
br label %44
34: ; preds = %28
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %29, i32 %30)
br label %44
36: ; preds = %2, %26
%37 = load i32, i32* %3
%38 = load i32, i32* %4
%39 = icmp sgt i32 %37, %38
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %38, i32 %37)
br label %44
42: ; preds = %36
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i32 %37, i32 %38)
br label %44
44: ; preds = %40, %42, %32, %34
ret i32 0
}