#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 atoi(char *);
int pow(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int i;
  if (argc < 3)
    return -1;
  int n = atoi(argv[1]);
  int m = atoi(argv[2]);
  if (n < 1 || n > 9 || m < 2 || m > 999999999)
    return -1;
  for (i = pow(10, n) - 1; i > 0; i--) {
    if (!(i % m)) {
      printf("%d\n", i);
      return 0;
    }
  }
  printf("%d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    115c <main+0x2c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1224 <main+0xf4>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0x18(%rbp)
jl     11a7 <main+0x77>
cmpl   $0x9,-0x18(%rbp)
jg     11a7 <main+0x77>
cmpl   $0x2,-0x1c(%rbp)
jl     11a7 <main+0x77>
cmpl   $0x3b9ac9ff,-0x1c(%rbp)
jle    11b3 <main+0x83>
movl   $0xffffffff,-0x4(%rbp)
jmp    1224 <main+0xf4>
mov    -0x18(%rbp),%esi
mov    $0xa,%edi
call   1040 <pow@plt>
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jle    120e <main+0xde>
mov    -0x14(%rbp),%eax
cltd
idivl  -0x1c(%rbp)
cmp    $0x0,%edx
jne    11fb <main+0xcb>
mov    -0x14(%rbp),%esi
lea    0xe16(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1224 <main+0xf4>
jmp    1200 <main+0xd0>
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    11c6 <main+0x96>
mov    -0x14(%rbp),%esi
lea    0xde8(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    $0xffffffff,%ebp
cmp    $0x3,%edi
jl     11b3 <main+0x83>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%r14d
mov    0x10(%rbx),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
lea    -0xa(%r14),%eax
cmp    $0xfffffff7,%eax
jb     11b3 <main+0x83>
cmp    $0x2,%ebx
jl     11b3 <main+0x83>
cmp    $0x3b9ac9ff,%ebx
jg     11b3 <main+0x83>
mov    $0xa,%edi
mov    %r14d,%esi
call   1040 <pow@plt>
mov    %eax,%esi
test   %eax,%eax
mov    $0x1,%ecx
cmovle %eax,%ecx
add    $0xffffffff,%ecx
nopw   0x0(%rax,%rax,1)
cmp    $0x2,%esi
jl     11a3 <main+0x73>
add    $0xffffffff,%esi
mov    %esi,%eax
cltd
idiv   %ebx
test   %edx,%edx
jne    1190 <main+0x60>
jmp    11a5 <main+0x75>
mov    %ecx,%esi
lea    0xe54(%rip),%rdi
call   1030 <printf@plt>
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %55
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @atoi(i8* %15)
store i32 %16, i32* %7
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %8
%21 = load i32, i32* %7
%22 = icmp slt i32 %21, 1
br i1 %22, label %32, label %23
23: ; preds = %12
%24 = load i32, i32* %7
%25 = icmp sgt i32 %24, 9
br i1 %25, label %32, label %26
26: ; preds = %23
%27 = load i32, i32* %8
%28 = icmp slt i32 %27, 2
br i1 %28, label %32, label %29
29: ; preds = %26
%30 = load i32, i32* %8
%31 = icmp sgt i32 %30, 999999999
br i1 %31, label %32, label %33
32: ; preds = %29, %26, %23, %12
store i32 -1, i32* %3
br label %55
33: ; preds = %29
%34 = load i32, i32* %7
%35 = call i32 @pow(i32 10, i32 %34)
%36 = sub nsw i32 %35, 1
store i32 %36, i32* %6
br label %37
37: ; preds = %49, %33
%38 = load i32, i32* %6
%39 = icmp sgt i32 %38, 0
br i1 %39, label %40, label %52
40: ; preds = %37
%41 = load i32, i32* %6
%42 = load i32, i32* %8
%43 = srem i32 %41, %42
%44 = icmp ne i32 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %40
%46 = load i32, i32* %6
%47 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %46)
store i32 0, i32* %3
br label %55
48: ; preds = %40
br label %49
49: ; preds = %48
%50 = load i32, i32* %6
%51 = add nsw i32 %50, -1
store i32 %51, i32* %6
br label %37
52: ; preds = %37
%53 = load i32, i32* %6
%54 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %53)
store i32 0, i32* %3
br label %55
55: ; preds = %52, %45, %32, %11
%56 = load i32, i32* %3
ret i32 %56
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %31, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = add i32 %7, -10
%12 = icmp ult i32 %11, -9
%13 = icmp slt i32 %10, 2
%14 = select i1 %12, i1 true, i1 %13
%15 = icmp sgt i32 %10, 999999999
%16 = select i1 %14, i1 true, i1 %15
br i1 %16, label %31, label %17
17: ; preds = %4
%18 = tail call i32 @pow(i32 10, i32 %7)
%19 = call i32 @llvm.smin.i32(i32 %18, i32 1)
%20 = add i32 %19, -1
br label %21
21: ; preds = %25, %17
%22 = phi i32 [ %18, %17 ], [ %23, %25 ]
%23 = add nsw i32 %22, -1
%24 = icmp sgt i32 %22, 1
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = srem i32 %23, %10
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %21
28: ; preds = %21, %25
%29 = phi i32 [ %23, %25 ], [ %20, %21 ]
%30 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %28, %4, %2
%32 = phi i32 [ -1, %2 ], [ -1, %4 ], [ 0, %28 ]
ret i32 %32
}