#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 *, int, ...);
int /*<<< orphan*/ scanf(char *, int *, char *);
int strlen(char *);
int main() {
  int n;
  char str[21];
  scanf("%d %s", &n, str);
  int k = strlen(str);
  printf("n is %d, k is %d\n", n, k);
  int result = 1;
  for (int i = n; i > 0; i -= k) {
    result *= i;
  }
  printf("%d\n", result);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdx
lea    0xeb6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x24(%rbp),%edx
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x28(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jle    11a4 <main+0x74>
mov    -0x2c(%rbp),%eax
imul   -0x28(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x2c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x2c(%rbp)
jmp    1180 <main+0x50>
mov    -0x28(%rbp),%esi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xec4(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdx
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%esi
lea    0xea3(%rip),%rdi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
mov    $0x1,%esi
test   %eax,%eax
jle    1189 <main+0x59>
nopl   0x0(%rax)
imul   %eax,%esi
sub    %ebx,%eax
test   %eax,%eax
jg     1180 <main+0x50>
lea    0xe84(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %s\00"
@.str.1 = [18 x i8] c"n is %d, k is %d\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [21 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, i8* %7)
%9 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %4
%11 = load i32, i32* %2
%12 = load i32, i32* %4
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %12)
store i32 1, i32* %5
%14 = load i32, i32* %2
store i32 %14, i32* %6
br label %15
15: ; preds = %22, %0
%16 = load i32, i32* %6
%17 = icmp sgt i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = load i32, i32* %6
%20 = load i32, i32* %5
%21 = mul nsw i32 %20, %19
store i32 %21, i32* %5
br label %22
22: ; preds = %18
%23 = load i32, i32* %4
%24 = load i32, i32* %6
%25 = sub nsw i32 %24, %23
store i32 %25, i32* %6
br label %15
26: ; preds = %15
%27 = load i32, i32* %5
%28 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d %s\00"
@.str.1 = [18 x i8] c"n is %d, k is %d\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [21 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %1, i8* %4)
%6 = call i32 @strlen(i8* %4)
%7 = load i32, i32* %1
%8 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %6)
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %14, %0
%12 = phi i32 [ 1, %0 ], [ %17, %14 ]
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %12)
ret i32 0
14: ; preds = %0, %14
%15 = phi i32 [ %18, %14 ], [ %9, %0 ]
%16 = phi i32 [ %17, %14 ], [ 1, %0 ]
%17 = mul nsw i32 %15, %16
%18 = sub nsw i32 %15, %6
%19 = icmp sgt i32 %18, 0
br i1 %19, label %14, label %11
}