#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 conta_digitos(int, int);
int eh_permut(int num1, int num2) {
  while (num1 != 0) {
    switch (conta_digitos(num2, num1 % 10)) {
    case 1:
      num1 = num1 / 10;
      break;
    default:
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<eh_permut>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1185 <eh_permut+0x75>
mov    -0xc(%rbp),%edi
movslq -0x8(%rbp),%rax
mov    %eax,%esi
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x22,%rcx
add    %eax,%ecx
add    %ecx,%ecx
mov    %ecx,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
call   1030 <conta_digitos@plt>
sub    $0x1,%eax
jne    1174 <eh_permut+0x64>
jmp    1161 <eh_permut+0x51>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1180 <eh_permut+0x70>
movl   $0x0,-0x4(%rbp)
jmp    118c <eh_permut+0x7c>
jmp    111e <eh_permut+0xe>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eh_permut>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%r14d
test   %edi,%edi
je     116c <eh_permut+0x5c>
mov    %esi,%r15d
mov    %edi,%ebx
cs nopw 0x0(%rax,%rax,1)
movslq %ebx,%rsi
imul   $0x66666667,%rsi,%rbp
mov    %rbp,%rax
shr    $0x3f,%rax
sar    $0x22,%rbp
add    %eax,%ebp
lea    0x0(%rbp,%rbp,1),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%esi
mov    %r15d,%edi
call   1030 <conta_digitos@plt>
cmp    $0x1,%eax
jne    1169 <eh_permut+0x59>
add    $0x9,%ebx
cmp    $0x12,%ebx
mov    %ebp,%ebx
ja     1130 <eh_permut+0x20>
jmp    116c <eh_permut+0x5c>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @eh_permut(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = srem i32 %11, 10
%13 = call i32 @conta_digitos(i32 %10, i32 %12)
switch i32 %13, label %17 [
i32 1, label %14
]
14: ; preds = %9
%15 = load i32, i32* %4
%16 = sdiv i32 %15, 10
store i32 %16, i32* %4
br label %18
17: ; preds = %9
store i32 0, i32* %3
br label %20
18: ; preds = %14
br label %6
19: ; preds = %6
store i32 1, i32* %3
br label %20
20: ; preds = %19, %17
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
define i32 @eh_permut(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %13, label %4
4: ; preds = %2, %10
%5 = phi i32 [ %7, %10 ], [ %0, %2 ]
%6 = srem i32 %5, 10
%7 = sdiv i32 %5, 10
%8 = tail call i32 @conta_digitos(i32 %1, i32 %6)
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %13
10: ; preds = %4
%11 = add i32 %5, 9
%12 = icmp ult i32 %11, 19
br i1 %12, label %13, label %4
13: ; preds = %4, %10, %2
%14 = phi i32 [ 1, %2 ], [ 1, %10 ], [ 0, %4 ]
ret i32 %14
}