#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 /*<<< orphan*/ sprintf(char *, char *, int);
scalar_t__ strlen(char *);
scalar_t__ write(int, char *, scalar_t__);
int /*<<< orphan*/ x_perror(char *);
void print_signature(void) {
  char buf[256];
  sprintf(buf, "\002rep-remote; protocol %d\002\001", 1);
  if (write(1, buf, strlen(buf)) != strlen(buf)) {
    x_perror("print_signature");
  }
}


x86 assembly (clang, -O0):
<print_signature>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
lea    -0x100(%rbp),%rdi
lea    0xea7(%rip),%rsi
mov    $0x1,%edx
call   1060 <sprintf@plt>
lea    -0x100(%rbp),%rax
mov    %rax,-0x110(%rbp)
lea    -0x100(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x110(%rbp),%rsi
mov    %rax,%rdx
mov    $0x1,%edi
call   1040 <write@plt>
mov    %rax,-0x108(%rbp)
lea    -0x100(%rbp),%rdi
call   1050 <strlen@plt>
mov    %rax,%rcx
mov    -0x108(%rbp),%rax
cmp    %rcx,%rax
je     11c3 <print_signature+0x83>
lea    0xe5d(%rip),%rdi
call   1030 <x_perror@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_signature>:
push   %r14
push   %rbx
sub    $0x108,%rsp
lea    0xeaf(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x1,%edx
call   1060 <sprintf@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    $0x1,%edi
mov    %r14,%rsi
mov    %rax,%rdx
call   1040 <write@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1050 <strlen@plt>
cmp    %rax,%rbx
jne    1194 <print_signature+0x54>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe80(%rip),%rdi
add    $0x108,%rsp
pop    %rbx
pop    %r14
jmp    1030 <x_perror@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"\02rep-remote; protocol %d\02\01\00"
@.str.1 = [16 x i8] c"print_signature\00"
define void @print_signature() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%6 = call i64 @strlen(i8* %5)
%7 = call i64 @write(i32 1, i8* %4, i64 %6)
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%9 = call i64 @strlen(i8* %8)
%10 = icmp ne i64 %7, %9
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @x_perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %11, %0
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"\02rep-remote; protocol %d\02\01\00"
@.str.1 = [16 x i8] c"print_signature\00"
define void @print_signature() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = call i64 @strlen(i8* %2)
%5 = call i64 @write(i32 1, i8* %2, i64 %4)
%6 = call i64 @strlen(i8* %2)
%7 = icmp eq i64 %5, %6
br i1 %7, label %10, label %8
8: ; preds = %0
%9 = tail call i32 @x_perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %10
10: ; preds = %8, %0
ret void
}