#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 */
scalar_t__ cpfIsValid(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ usage(char *);
int main(int argc, char **argv) {
  if (argc == 1) {
    usage(argv[0]);
    return -1;
  }
  printf("CPF %s is %s\n", argv[1], cpfIsValid(argv[1]) ? "valid" : "invalid");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1168 <main+0x38>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1050 <usage@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b1 <main+0x81>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <cpfIsValid@plt>
mov    -0x18(%rbp),%rsi
mov    %rax,%rcx
lea    0xe7f(%rip),%rdx
lea    0xe7a(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rdx
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x1,%edi
jne    1145 <main+0x15>
mov    (%rsi),%rdi
call   1050 <usage@plt>
mov    $0xffffffff,%eax
pop    %rbx
ret
mov    0x8(%rsi),%rbx
mov    %rbx,%rdi
call   1040 <cpfIsValid@plt>
test   %rax,%rax
lea    0xeb3(%rip),%rax
lea    0xeae(%rip),%rdx
cmove  %rax,%rdx
lea    0xe93(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"CPF %s is %s\0A\00"
@.str.1 = [6 x i8] c"valid\00"
@.str.2 = [8 x i8] c"invalid\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @usage(i8* %11)
store i32 -1, i32* %3
br label %25
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i64 @cpfIsValid(i8* %19)
%21 = icmp ne i64 %20, 0
%22 = zext i1 %21 to i64
%23 = select i1 %21, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%24 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %23)
store i32 0, i32* %3
br label %25
25: ; preds = %13, %8
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
@.str = [14 x i8] c"CPF %s is %s\0A\00"
@.str.1 = [6 x i8] c"valid\00"
@.str.2 = [8 x i8] c"invalid\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @usage(i8* %5)
br label %14
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i64 @cpfIsValid(i8* %9)
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %12)
br label %14
14: ; preds = %7, %4
%15 = phi i32 [ -1, %4 ], [ 0, %7 ]
ret i32 %15
}