#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 */
typedef int /*<<< orphan*/ u_char;

/* Variables and functions */
int __b64_pton(char *, int /*<<< orphan*/ *, size_t);
int /*<<< orphan*/ free(char *);
char *ssh_strdup(char const *);
int ssh_uudecode(const char *src, u_char *target, size_t targsize) {
  int len;
  char *encoded, *p;
  encoded = ssh_strdup(src);
  for (p = encoded; *p == ' ' || *p == '\t'; p++)
    ;
  for (; *p != '\0' && *p != ' ' && *p != '\t'; p++)
    ;
  *p = '\0';
  len = __b64_pton(encoded, target, targsize);
  free(encoded);
  return len;
}


x86 assembly (clang, -O0):
<ssh_uudecode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <ssh_strdup@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x31(%rbp)
je     117e <ssh_uudecode+0x4e>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
test   $0x1,%al
jne    118e <ssh_uudecode+0x5e>
jmp    11a4 <ssh_uudecode+0x74>
jmp    1193 <ssh_uudecode+0x63>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1159 <ssh_uudecode+0x29>
jmp    11a9 <ssh_uudecode+0x79>
mov    -0x30(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x32(%rbp)
je     11e3 <ssh_uudecode+0xb3>
mov    -0x30(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x32(%rbp)
je     11e3 <ssh_uudecode+0xb3>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
setne  %al
mov    %al,-0x32(%rbp)
mov    -0x32(%rbp),%al
test   $0x1,%al
jne    11f3 <ssh_uudecode+0xc3>
jmp    1209 <ssh_uudecode+0xd9>
jmp    11f8 <ssh_uudecode+0xc8>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    11a9 <ssh_uudecode+0x79>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <__b64_pton@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ssh_uudecode>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
call   1040 <ssh_strdup@plt>
mov    %rax,%rbx
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rax
movzbl -0x1(%rax),%ecx
cmp    $0x9,%cl
je     1150 <ssh_uudecode+0x20>
cmp    $0x20,%cl
je     1150 <ssh_uudecode+0x20>
movabs $0x100000201,%rdx
jmp    1177 <ssh_uudecode+0x47>
xchg   %ax,%ax
movzbl (%rax),%ecx
add    $0x1,%rax
cmp    $0x20,%cl
ja     1170 <ssh_uudecode+0x40>
movzbl %cl,%ecx
bt     %rcx,%rdx
jae    1170 <ssh_uudecode+0x40>
movb   $0x0,-0x1(%rax)
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1050 <__b64_pton@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ssh_uudecode(i8* %0, i32* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i64
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %4
store i32* %1, i32** %5
store i64 %2, i64* %6
%10 = load i8*, i8** %4
%11 = call i8* @ssh_strdup(i8* %10)
store i8* %11, i8** %8
%12 = load i8*, i8** %8
store i8* %12, i8** %9
br label %13
13: ; preds = %26, %3
%14 = load i8*, i8** %9
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 32
br i1 %17, label %23, label %18
18: ; preds = %13
%19 = load i8*, i8** %9
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 9
br label %23
23: ; preds = %18, %13
%24 = phi i1 [ true, %13 ], [ %22, %18 ]
br i1 %24, label %25, label %29
25: ; preds = %23
br label %26
26: ; preds = %25
%27 = load i8*, i8** %9
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %9
br label %13
29: ; preds = %23
br label %30
30: ; preds = %48, %29
%31 = load i8*, i8** %9
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %45
35: ; preds = %30
%36 = load i8*, i8** %9
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp ne i32 %38, 32
br i1 %39, label %40, label %45
40: ; preds = %35
%41 = load i8*, i8** %9
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp ne i32 %43, 9
br label %45
45: ; preds = %40, %35, %30
%46 = phi i1 [ false, %35 ], [ false, %30 ], [ %44, %40 ]
br i1 %46, label %47, label %51
47: ; preds = %45
br label %48
48: ; preds = %47
%49 = load i8*, i8** %9
%50 = getelementptr inbounds i8, i8* %49, i32 1
store i8* %50, i8** %9
br label %30
51: ; preds = %45
%52 = load i8*, i8** %9
store i8 0, i8* %52
%53 = load i8*, i8** %8
%54 = load i32*, i32** %5
%55 = load i64, i64* %6
%56 = call i32 @__b64_pton(i8* %53, i32* %54, i64 %55)
store i32 %56, i32* %7
%57 = load i8*, i8** %8
%58 = call i32 @free(i8* %57)
%59 = load i32, i32* %7
ret i32 %59
}

LLVM IR (-O2):
define i32 @ssh_uudecode(i8* %0, i32* %1, i64 %2) {
%4 = tail call i8* @ssh_strdup(i8* %0)
br label %5
5: ; preds = %8, %3
%6 = phi i8* [ %4, %3 ], [ %9, %8 ]
%7 = load i8, i8* %6
switch i8 %7, label %10 [
i8 32, label %8
i8 9, label %8
]
8: ; preds = %5, %5
%9 = getelementptr inbounds i8, i8* %6, i64 1
br label %5
10: ; preds = %5, %13
%11 = phi i8 [ %15, %13 ], [ %7, %5 ]
%12 = phi i8* [ %14, %13 ], [ %6, %5 ]
switch i8 %11, label %13 [
i8 0, label %16
i8 32, label %16
i8 9, label %16
]
13: ; preds = %10
%14 = getelementptr inbounds i8, i8* %12, i64 1
%15 = load i8, i8* %14
br label %10
16: ; preds = %10, %10, %10
store i8 0, i8* %12
%17 = tail call i32 @__b64_pton(i8* %4, i32* %1, i64 %2)
%18 = tail call i32 @free(i8* %4)
ret i32 %17
}