#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 _crypt_output_magic(const char *setting, char *output, int size) {
  if (size < 3)
    return -1;
  output[0] = '*';
  output[1] = '0';
  output[2] = '\0';
  if (setting[0] == '*' && setting[1] == '0')
    output[1] = '1';
  return 0;
}


x86 assembly (clang, -O0):
<_crypt_output_magic>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0x3,-0x1c(%rbp)
jge    1125 <_crypt_output_magic+0x25>
movl   $0xffffffff,-0x4(%rbp)
jmp    116c <_crypt_output_magic+0x6c>
mov    -0x18(%rbp),%rax
movb   $0x2a,(%rax)
mov    -0x18(%rbp),%rax
movb   $0x30,0x1(%rax)
mov    -0x18(%rbp),%rax
movb   $0x0,0x2(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
jne    1165 <_crypt_output_magic+0x65>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x30,%eax
jne    1165 <_crypt_output_magic+0x65>
mov    -0x18(%rbp),%rax
movb   $0x31,0x1(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_crypt_output_magic>:
mov    $0xffffffff,%eax
cmp    $0x3,%edx
jl     1124 <_crypt_output_magic+0x24>
movw   $0x302a,(%rsi)
movb   $0x0,0x2(%rsi)
xor    %eax,%eax
cmpb   $0x2a,(%rdi)
jne    1124 <_crypt_output_magic+0x24>
cmpb   $0x30,0x1(%rdi)
jne    1124 <_crypt_output_magic+0x24>
movb   $0x31,0x1(%rsi)
ret

LLVM IR (-O0):
define i32 @_crypt_output_magic(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = icmp slt i32 %8, 3
br i1 %9, label %10, label %11
10: ; preds = %3
store i32 -1, i32* %4
br label %33
11: ; preds = %3
%12 = load i8*, i8** %6
%13 = getelementptr inbounds i8, i8* %12, i64 0
store i8 42, i8* %13
%14 = load i8*, i8** %6
%15 = getelementptr inbounds i8, i8* %14, i64 1
store i8 48, i8* %15
%16 = load i8*, i8** %6
%17 = getelementptr inbounds i8, i8* %16, i64 2
store i8 0, i8* %17
%18 = load i8*, i8** %5
%19 = getelementptr inbounds i8, i8* %18, i64 0
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 42
br i1 %22, label %23, label %32
23: ; preds = %11
%24 = load i8*, i8** %5
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 48
br i1 %28, label %29, label %32
29: ; preds = %23
%30 = load i8*, i8** %6
%31 = getelementptr inbounds i8, i8* %30, i64 1
store i8 49, i8* %31
br label %32
32: ; preds = %29, %23, %11
store i32 0, i32* %4
br label %33
33: ; preds = %32, %10
%34 = load i32, i32* %4
ret i32 %34
}

LLVM IR (-O2):
define i32 @_crypt_output_magic(i8* nocapture %0, i8* nocapture writeonly %1, i32 %2) {
%4 = icmp slt i32 %2, 3
br i1 %4, label %15, label %5
5: ; preds = %3
store i8 42, i8* %1
%6 = getelementptr inbounds i8, i8* %1, i64 1
store i8 48, i8* %6
%7 = getelementptr inbounds i8, i8* %1, i64 2
store i8 0, i8* %7
%8 = load i8, i8* %0
%9 = icmp eq i8 %8, 42
br i1 %9, label %10, label %15
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 48
br i1 %13, label %14, label %15
14: ; preds = %10
store i8 49, i8* %6
br label %15
15: ; preds = %5, %10, %14, %3
%16 = phi i32 [ -1, %3 ], [ 0, %14 ], [ 0, %10 ], [ 0, %5 ]
ret i32 %16
}