#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*/ printf(char *, char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
char *strlen(char *);
int main(void) {
  char name[10];
  scanf("%s", name);
  printf("\"%s\"\n", name);
  printf("\"%20s\"\n", name);
  printf("\"%-20s\"\n", name);
  printf("\"%*s\"\n", strlen(name) + 3, name);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1050 <scanf@plt>
lea    -0xe(%rbp),%rsi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xe(%rbp),%rsi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xe(%rbp),%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xe(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rsi
add    $0x3,%rsi
lea    -0xe(%rbp),%rdx
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
lea    0x6(%rsp),%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
lea    0xeb3(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea8(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9f(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
lea    0x3(%rax),%rsi
lea    0xe8b(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [6 x i8] c"\22%s\22\0A\00"
@.str.2 = [8 x i8] c"\22%20s\22\0A\00"
@.str.3 = [9 x i8] c"\22%-20s\22\0A\00"
@.str.4 = [7 x i8] c"\22%*s\22\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%6 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%8 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%10 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %9)
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%12 = call i8* @strlen(i8* %11)
%13 = getelementptr inbounds i8, i8* %12, i64 3
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%15 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %13, i8* %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [6 x i8] c"\22%s\22\0A\00"
@.str.2 = [8 x i8] c"\22%20s\22\0A\00"
@.str.3 = [9 x i8] c"\22%-20s\22\0A\00"
@.str.4 = [7 x i8] c"\22%*s\22\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%5 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%6 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%7 = call i8* @strlen(i8* %2)
%8 = getelementptr inbounds i8, i8* %7, i64 3
%9 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %8, i8* %2)
ret i32 0
}