#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*/ p_sat_buf(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int strlen(char *);
void p_sat(char *str) {
  char s[20];
  int i;
  snprintf(s, 20, "| %s", str);
  for (i = strlen(s); i < 20 - 2; i++)
    s[i] = ' ';
  s[20 - 2] = '|';
  s[20 - 1] = 0;
  p_sat_buf(s);
}


x86 assembly (clang, -O0):
<p_sat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rcx
mov    $0x14,%esi
lea    0xeb0(%rip),%rdx
call   1040 <snprintf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x12,-0x24(%rbp)
jge    1182 <p_sat+0x52>
movslq -0x24(%rbp),%rax
movb   $0x20,-0x20(%rbp,%rax,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1161 <p_sat+0x31>
movb   $0x7c,-0xe(%rbp)
movb   $0x0,-0xd(%rbp)
lea    -0x20(%rbp),%rdi
call   1050 <p_sat_buf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p_sat>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rcx
lea    0xeb1(%rip),%rdx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x14,%esi
call   1040 <snprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x11,%eax
jg     1188 <p_sat+0x48>
movslq %eax,%rcx
lea    (%rsp,%rcx,1),%rdi
mov    $0x11,%edx
sub    %eax,%edx
add    $0x1,%rdx
mov    $0x20,%esi
call   1050 <memset@plt>
movw   $0x7c,0x12(%rsp)
mov    %rsp,%rdi
call   1060 <p_sat_buf@plt>
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"| %s\00"
define void @p_sat(i8* %0) {
%2 = alloca i8*
%3 = alloca [20 x i8]
%4 = alloca i32
store i8* %0, i8** %2
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%6 = load i8*, i8** %2
%7 = call i32 @snprintf(i8* %5, i32 20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%9 = call i32 @strlen(i8* %8)
store i32 %9, i32* %4
br label %10
10: ; preds = %17, %1
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 18
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 %15
store i8 32, i8* %16
br label %17
17: ; preds = %13
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %10
20: ; preds = %10
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 18
store i8 124, i8* %21
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 19
store i8 0, i8* %22
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%24 = call i32 @p_sat_buf(i8* %23)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"| %s\00"
define void @p_sat(i8* %0) {
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%4 = call i32 @snprintf(i8* %3, i32 20, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%5 = call i32 @strlen(i8* %3)
%6 = icmp slt i32 %5, 18
br i1 %6, label %7, label %13
7: ; preds = %1
%8 = sext i32 %5 to i64
%9 = getelementptr [20 x i8], [20 x i8]* %2, i64 0, i64 %8
%10 = sub i32 17, %5
%11 = zext i32 %10 to i64
%12 = add nuw nsw i64 %11, 1
br label %13
13: ; preds = %7, %1
%14 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 18
store i8 124, i8* %14
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 19
store i8 0, i8* %15
%16 = call i32 @p_sat_buf(i8* %3)
ret void
}