#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 */
char *_strncpy(char *, char *, int);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  char s1[98];
  char *p;
  int i;
  for (i = 0; i < 98 - 1; i++) {
    s1[i] = '*';
  }
  s1[i] = '\0';
  printf("%s\n", s1);
  p = _strncpy(s1, "First, solve the problem. Then, write the code\n", 5);
  printf("%s\n", s1);
  printf("%s\n", p);
  p = _strncpy(s1, "First, solve the problem. Then, write the code\n", 90);
  printf("%s", s1);
  printf("%s", p);
  for (i = 0; i < 98; i++) {
    if (i % 10) {
      printf(" ");
    }
    if (!(i % 10) && i) {
      printf("\n");
    }
    printf("0x%02x", s1[i]);
  }
  printf("\n");
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x7c(%rbp)
cmpl   $0x61,-0x7c(%rbp)
jge    115a <main+0x3a>
movslq -0x7c(%rbp),%rax
movb   $0x2a,-0x70(%rbp,%rax,1)
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    1139 <main+0x19>
movslq -0x7c(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
lea    -0x70(%rbp),%rsi
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe84(%rip),%rsi
mov    $0x5,%edx
call   1040 <_strncpy@plt>
mov    %rax,-0x78(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x78(%rbp),%rsi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    0xe47(%rip),%rsi
mov    $0x5a,%edx
call   1040 <_strncpy@plt>
mov    %rax,-0x78(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x78(%rbp),%rsi
lea    0xe4c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x7c(%rbp)
cmpl   $0x62,-0x7c(%rbp)
jge    1273 <main+0x153>
mov    -0x7c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1222 <main+0x102>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x7c(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    124e <main+0x12e>
cmpl   $0x0,-0x7c(%rbp)
je     124e <main+0x12e>
lea    0xdeb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x7c(%rbp),%rax
movsbl -0x70(%rbp,%rax,1),%esi
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    11f6 <main+0xd6>
lea    0xdb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
movaps 0xeaf(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movw   $0x2a,0x60(%rsp)
mov    %rsp,%r15
mov    %r15,%rdi
call   1040 <puts@plt>
lea    0xe89(%rip),%r14
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x5,%edx
call   1060 <_strncpy@plt>
mov    %rax,%rbx
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x5a,%edx
call   1060 <_strncpy@plt>
mov    %rax,%rbx
lea    0xe7c(%rip),%r14
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
movsbl (%rsp),%esi
lea    0xe5a(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%ebx
mov    $0xff,%bpl
jmp    1221 <main+0xe1>
nopl   (%rax)
call   1030 <putchar@plt>
movsbl (%rsp,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
add    $0xff,%bpl
cmp    $0x62,%rbx
je     1244 <main+0x104>
movzbl %bl,%eax
imul   $0xcd,%eax,%eax
shr    $0xa,%eax
and    $0xfffffffe,%eax
lea    (%rax,%rax,4),%eax
mov    $0xa,%edi
add    %bpl,%al
je     1200 <main+0xc0>
mov    $0x20,%edi
jmp    1200 <main+0xc0>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [48 x i8] c"First, solve the problem. Then, write the code\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [2 x i8] c"\0A\00"
@.str.5 = [7 x i8] c"0x%02x\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [98 x i8]
%3 = alloca i8*
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
br label %5
5: ; preds = %12, %0
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 97
br i1 %7, label %8, label %15
8: ; preds = %5
%9 = load i32, i32* %4
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [98 x i8], [98 x i8]* %2, i64 0, i64 %10
store i8 42, i8* %11
br label %12
12: ; preds = %8
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 1
store i32 %14, i32* %4
br label %5
15: ; preds = %5
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [98 x i8], [98 x i8]* %2, i64 0, i64 %17
store i8 0, i8* %18
%19 = getelementptr inbounds [98 x i8], [98 x i8]* %2, i64 0, i64 0
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds [98 x i8], [98 x i8]* %2, i64 0, i64 0
%22 = call i8* @_strncpy(i8* %21, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 5)
store i8* %22, i8** %3
%23 = getelementptr inbounds [98 x i8], [98 x i8]* %2, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = load i8*, i8** %3
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %25)
%27 = getelementptr inbounds [98 x i8], [98 x i8]* %2, i64 0, i64 0
%28 = call i8* @_strncpy(i8* %27, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 90)
store i8* %28, i8** %3
%29 = getelementptr inbounds [98 x i8], [98 x i8]* %2, i64 0, i64 0
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%31 = load i8*, i8** %3
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %31)
store i32 0, i32* %4
br label %33
33: ; preds = %58, %15
%34 = load i32, i32* %4
%35 = icmp slt i32 %34, 98
br i1 %35, label %36, label %61
36: ; preds = %33
%37 = load i32, i32* %4
%38 = srem i32 %37, 10
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %42
42: ; preds = %40, %36
%43 = load i32, i32* %4
%44 = srem i32 %43, 10
%45 = icmp ne i32 %44, 0
br i1 %45, label %51, label %46
46: ; preds = %42
%47 = load i32, i32* %4
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %51
51: ; preds = %49, %46, %42
%52 = load i32, i32* %4
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [98 x i8], [98 x i8]* %2, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %56)
br label %58
58: ; preds = %51
%59 = load i32, i32* %4
%60 = add nsw i32 %59, 1
store i32 %60, i32* %4
br label %33
61: ; preds = %33
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [48 x i8] c"First, solve the problem. Then, write the code\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@.str.5 = [7 x i8] c"0x%02x\00"
define i32 @main() {
%1 = alloca [98 x i8]
%2 = getelementptr inbounds [98 x i8], [98 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [98 x i8], [98 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [98 x i8], [98 x i8]* %1, i64 0, i64 97
store i8 0, i8* %4
%5 = call i32 @puts(i8* %3)
%6 = call i8* @_strncpy(i8* %3, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 5)
%7 = call i32 @puts(i8* %3)
%8 = call i32 @puts(i8* dereferenceable(1) %6)
%9 = call i8* @_strncpy(i8* %3, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0), i32 90)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%12 = getelementptr inbounds [98 x i8], [98 x i8]* %1, i64 0, i64 0
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %0, %16
%17 = phi i64 [ 1, %0 ], [ %27, %16 ]
%18 = trunc i64 %17 to i8
%19 = urem i8 %18, 10
%20 = icmp eq i8 %19, 0
%21 = select i1 %20, i32 10, i32 32
%22 = call i32 @putchar(i32 %21)
%23 = getelementptr inbounds [98 x i8], [98 x i8]* %1, i64 0, i64 %17
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i32 %25)
%27 = add nuw nsw i64 %17, 1
%28 = icmp eq i64 %27, 98
br i1 %28, label %29, label %16
29: ; preds = %16
%30 = call i32 @putchar(i32 10)
ret i32 0
}