char *stars(int number) {
  static char string[32 + 1];
  int i;
  for (i = 0; i < 32; i++) {
    if (i < number)
      string[i] = '*';
    else
      string[i] = ' ';
  }
  string[32] = '\0';
  return string;
}


x86 assembly (clang, -O0):
<stars>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    115a <stars+0x5a>
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1138 <stars+0x38>
movslq -0x8(%rbp),%rcx
lea    0x2f01(%rip),%rax
movb   $0x2a,(%rax,%rcx,1)
jmp    1147 <stars+0x47>
movslq -0x8(%rbp),%rcx
lea    0x2eed(%rip),%rax
movb   $0x20,(%rax,%rcx,1)
jmp    114c <stars+0x4c>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <stars+0xe>
movb   $0x0,0x2eef(%rip)
lea    0x2ec8(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stars>:
movslq %edi,%rax
movq   %rax,%xmm0
pshufd $0x44,%xmm0,%xmm0
pxor   0xeeb(%rip),%xmm0
movdqa 0xef3(%rip),%xmm1
movdqa %xmm0,%xmm2
pcmpgtd %xmm1,%xmm2
pcmpeqd %xmm0,%xmm1
pshufd $0xf5,%xmm1,%xmm1
pand   %xmm2,%xmm1
pshufd $0xf5,%xmm2,%xmm2
por    %xmm1,%xmm2
movdqa 0xedd(%rip),%xmm1
pand   %xmm1,%xmm2
movdqa 0xee1(%rip),%xmm3
movdqa %xmm0,%xmm4
pcmpgtd %xmm3,%xmm4
pcmpeqd %xmm0,%xmm3
pshufd $0xf5,%xmm3,%xmm3
pand   %xmm4,%xmm3
pshufd $0xf5,%xmm4,%xmm4
por    %xmm3,%xmm4
pand   %xmm1,%xmm4
packuswb %xmm2,%xmm4
packuswb %xmm4,%xmm3
movdqa 0xebf(%rip),%xmm2
movdqa %xmm0,%xmm4
pcmpgtd %xmm2,%xmm4
pcmpeqd %xmm0,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm4,%xmm2
pshufd $0xf5,%xmm4,%xmm4
por    %xmm2,%xmm4
pand   %xmm1,%xmm4
movdqa 0xea5(%rip),%xmm2
movdqa %xmm0,%xmm5
pcmpgtd %xmm2,%xmm5
pcmpeqd %xmm0,%xmm2
pshufd $0xf5,%xmm2,%xmm6
pand   %xmm5,%xmm6
pshufd $0xf5,%xmm5,%xmm2
por    %xmm6,%xmm2
pand   %xmm1,%xmm2
packuswb %xmm4,%xmm2
packuswb %xmm2,%xmm2
packuswb %xmm3,%xmm2
movdqa 0xe7f(%rip),%xmm3
movdqa %xmm0,%xmm4
pcmpgtd %xmm3,%xmm4
pcmpeqd %xmm0,%xmm3
pshufd $0xf5,%xmm3,%xmm3
pand   %xmm4,%xmm3
pshufd $0xf5,%xmm4,%xmm4
por    %xmm3,%xmm4
pand   %xmm1,%xmm4
movdqa 0xe65(%rip),%xmm3
movdqa %xmm0,%xmm5
pcmpgtd %xmm3,%xmm5
pcmpeqd %xmm0,%xmm3
pshufd $0xf5,%xmm3,%xmm3
pand   %xmm5,%xmm3
pshufd $0xf5,%xmm5,%xmm5
por    %xmm3,%xmm5
pand   %xmm1,%xmm5
packuswb %xmm4,%xmm5
packuswb %xmm5,%xmm3
movdqa 0xe43(%rip),%xmm4
movdqa %xmm0,%xmm5
pcmpgtd %xmm4,%xmm5
pcmpeqd %xmm0,%xmm4
pshufd $0xf5,%xmm4,%xmm4
pand   %xmm5,%xmm4
pshufd $0xf5,%xmm5,%xmm5
por    %xmm4,%xmm5
pand   %xmm1,%xmm5
movdqa 0xe29(%rip),%xmm4
movdqa %xmm0,%xmm6
pcmpgtd %xmm4,%xmm6
pcmpeqd %xmm0,%xmm4
pshufd $0xf5,%xmm4,%xmm4
pand   %xmm6,%xmm4
pshufd $0xf5,%xmm6,%xmm6
por    %xmm4,%xmm6
pand   %xmm1,%xmm6
packuswb %xmm5,%xmm6
packuswb %xmm6,%xmm6
packuswb %xmm3,%xmm6
shufps $0xcc,%xmm2,%xmm6
movaps 0xdff(%rip),%xmm8
movaps %xmm6,%xmm4
andnps %xmm8,%xmm4
movaps 0xe01(%rip),%xmm3
andps  %xmm3,%xmm6
orps   %xmm4,%xmm6
movaps %xmm6,0x2d74(%rip)
lea    0x2d6d(%rip),%rax
movdqa 0xdf5(%rip),%xmm4
movdqa %xmm0,%xmm5
pcmpgtd %xmm4,%xmm5
pcmpeqd %xmm0,%xmm4
pshufd $0xf5,%xmm4,%xmm4
pand   %xmm5,%xmm4
pshufd $0xf5,%xmm5,%xmm5
por    %xmm4,%xmm5
pand   %xmm1,%xmm5
movdqa 0xddb(%rip),%xmm4
movdqa %xmm0,%xmm6
pcmpgtd %xmm4,%xmm6
pcmpeqd %xmm0,%xmm4
pshufd $0xf5,%xmm4,%xmm4
pand   %xmm6,%xmm4
pshufd $0xf5,%xmm6,%xmm6
por    %xmm4,%xmm6
pand   %xmm1,%xmm6
packuswb %xmm5,%xmm6
packuswb %xmm6,%xmm5
movdqa 0xdb9(%rip),%xmm4
movdqa %xmm0,%xmm6
pcmpgtd %xmm4,%xmm6
pcmpeqd %xmm0,%xmm4
pshufd $0xf5,%xmm4,%xmm4
pand   %xmm6,%xmm4
pshufd $0xf5,%xmm6,%xmm6
por    %xmm4,%xmm6
pand   %xmm1,%xmm6
movdqa 0xd9f(%rip),%xmm4
movdqa %xmm0,%xmm7
pcmpgtd %xmm4,%xmm7
pcmpeqd %xmm0,%xmm4
pshufd $0xf5,%xmm4,%xmm2
pand   %xmm7,%xmm2
pshufd $0xf5,%xmm7,%xmm4
por    %xmm2,%xmm4
pand   %xmm1,%xmm4
packuswb %xmm6,%xmm4
packuswb %xmm4,%xmm4
packuswb %xmm5,%xmm4
movdqa 0xd79(%rip),%xmm2
movdqa %xmm0,%xmm5
pcmpgtd %xmm2,%xmm5
pcmpeqd %xmm0,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm5,%xmm2
pshufd $0xf5,%xmm5,%xmm5
por    %xmm2,%xmm5
pand   %xmm1,%xmm5
movdqa 0xd5f(%rip),%xmm2
movdqa %xmm0,%xmm6
pcmpgtd %xmm2,%xmm6
pcmpeqd %xmm0,%xmm2
pshufd $0xf5,%xmm2,%xmm2
pand   %xmm6,%xmm2
pshufd $0xf5,%xmm6,%xmm6
por    %xmm2,%xmm6
pand   %xmm1,%xmm6
packuswb %xmm5,%xmm6
packuswb %xmm6,%xmm2
movdqa 0xd3d(%rip),%xmm5
movdqa %xmm0,%xmm6
pcmpgtd %xmm5,%xmm6
pcmpeqd %xmm0,%xmm5
pshufd $0xf5,%xmm5,%xmm5
pand   %xmm6,%xmm5
pshufd $0xf5,%xmm6,%xmm6
por    %xmm5,%xmm6
pand   %xmm1,%xmm6
movdqa 0xd23(%rip),%xmm5
movdqa %xmm0,%xmm7
pcmpgtd %xmm5,%xmm7
pcmpeqd %xmm5,%xmm0
pshufd $0xf5,%xmm0,%xmm0
pand   %xmm7,%xmm0
pshufd $0xf5,%xmm7,%xmm5
por    %xmm0,%xmm5
pand   %xmm1,%xmm5
packuswb %xmm6,%xmm5
packuswb %xmm5,%xmm5
packuswb %xmm2,%xmm5
shufps $0xcc,%xmm4,%xmm5
movaps %xmm5,%xmm0
andnps %xmm8,%xmm0
andps  %xmm3,%xmm5
orps   %xmm0,%xmm5
movaps %xmm5,0x2bed(%rip)
movb   $0x0,0x2bf6(%rip)
ret

LLVM IR (-O0):
@stars.string = internal global [33 x i8] zeroinitializer
define i8* @stars(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
br label %4
4: ; preds = %20, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 32
br i1 %6, label %7, label %23
7: ; preds = %4
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [33 x i8], [33 x i8]* @stars.string, i64 0, i64 %13
store i8 42, i8* %14
br label %19
15: ; preds = %7
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [33 x i8], [33 x i8]* @stars.string, i64 0, i64 %17
store i8 32, i8* %18
br label %19
19: ; preds = %15, %11
br label %20
20: ; preds = %19
%21 = load i32, i32* %3
%22 = add nsw i32 %21, 1
store i32 %22, i32* %3
br label %4
23: ; preds = %4
store i8 0, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @stars.string, i64 0, i64 32)
ret i8* getelementptr inbounds ([33 x i8], [33 x i8]* @stars.string, i64 0, i64 0)
}

LLVM IR (-O2):
@stars.string = internal global [33 x i8] zeroinitializer
define i8* @stars(i32 %0) {
%2 = sext i32 %0 to i64
%3 = insertelement <16 x i64> poison, i64 %2, i64 0
%4 = shufflevector <16 x i64> %3, <16 x i64> poison, <16 x i32> zeroinitializer
%5 = icmp sgt <16 x i64> %4, <i64 0, i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15>
%6 = select <16 x i1> %5, <16 x i8> <i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42>, <16 x i8> <i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32>
store <16 x i8> %6, <16 x i8>* bitcast ([33 x i8]* @stars.string to <16 x i8>*)
%7 = icmp sgt <16 x i64> %4, <i64 16, i64 17, i64 18, i64 19, i64 20, i64 21, i64 22, i64 23, i64 24, i64 25, i64 26, i64 27, i64 28, i64 29, i64 30, i64 31>
%8 = select <16 x i1> %7, <16 x i8> <i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42, i8 42>, <16 x i8> <i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32, i8 32>
store <16 x i8> %8, <16 x i8>* bitcast (i8* getelementptr inbounds ([33 x i8], [33 x i8]* @stars.string, i64 0, i64 16) to <16 x i8>*)
store i8 0, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @stars.string, i64 0, i64 32)
ret i8* getelementptr inbounds ([33 x i8], [33 x i8]* @stars.string, i64 0, i64 0)
}