#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 *);
void dig(int n, int m) {
  int i;
  char dig[100000];
  for (i = 0; i < n; i++)
    dig[i] = '5';
  for (; i < m; i++)
    dig[i] = '3';
  dig[i] = '\0';
  printf("%s\n", dig);
}


x86 assembly (clang, -O0):
<dig>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186b0,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    114e <dig+0x3e>
movslq -0xc(%rbp),%rax
movb   $0x35,-0x186b0(%rbp,%rax,1)
35
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <dig+0x18>
jmp    1153 <dig+0x43>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1179 <dig+0x69>
movslq -0xc(%rbp),%rax
movb   $0x33,-0x186b0(%rbp,%rax,1)
33
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1153 <dig+0x43>
movslq -0xc(%rbp),%rax
movb   $0x0,-0x186b0(%rbp,%rax,1)
lea    -0x186b0(%rbp),%rsi
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
add    $0x186b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dig>:
push   %rbp
push   %rbx
sub    $0x186a8,%rsp
mov    %esi,%ebx
test   %edi,%edi
jle    1142 <dig+0x22>
mov    %edi,%ebp
mov    %edi,%edx
mov    %rsp,%rdi
mov    $0x35,%esi
call   1040 <memset@plt>
jmp    1144 <dig+0x24>
xor    %ebp,%ebp
mov    %ebp,%edx
cmp    %ebx,%ebp
jge    1162 <dig+0x42>
lea    (%rsp,%rdx,1),%rdi
not    %edx
add    %ebx,%edx
add    $0x1,%rdx
mov    $0x33,%esi
call   1040 <memset@plt>
mov    %ebx,%edx
movb   $0x0,(%rsp,%rdx,1)
lea    0xe93(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
add    $0x186a8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @dig(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [100000 x i8]
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %15, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %18
11: ; preds = %7
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [100000 x i8], [100000 x i8]* %6, i64 0, i64 %13
store i8 53, i8* %14
br label %15
15: ; preds = %11
%16 = load i32, i32* %5
%17 = add nsw i32 %16, 1
store i32 %17, i32* %5
br label %7
18: ; preds = %7
br label %19
19: ; preds = %27, %18
%20 = load i32, i32* %5
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %30
23: ; preds = %19
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [100000 x i8], [100000 x i8]* %6, i64 0, i64 %25
store i8 51, i8* %26
br label %27
27: ; preds = %23
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
store i32 %29, i32* %5
br label %19
30: ; preds = %19
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [100000 x i8], [100000 x i8]* %6, i64 0, i64 %32
store i8 0, i8* %33
%34 = getelementptr inbounds [100000 x i8], [100000 x i8]* %6, i64 0, i64 0
%35 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %34)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @dig(i32 %0, i32 %1) {
%3 = alloca [100000 x i8]
%4 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 0
%8 = zext i32 %0 to i64
br label %9
9: ; preds = %6, %2
%10 = phi i32 [ 0, %2 ], [ %0, %6 ]
%11 = icmp slt i32 %10, %1
%12 = zext i32 %10 to i64
br i1 %11, label %13, label %20
13: ; preds = %9
%14 = getelementptr [100000 x i8], [100000 x i8]* %3, i64 0, i64 %12
%15 = xor i32 %10, -1
%16 = add i32 %15, %1
%17 = zext i32 %16 to i64
%18 = add nuw nsw i64 %17, 1
%19 = zext i32 %1 to i64
br label %20
20: ; preds = %13, %9
%21 = phi i64 [ %12, %9 ], [ %19, %13 ]
%22 = getelementptr inbounds [100000 x i8], [100000 x i8]* %3, i64 0, i64 %21
store i8 0, i8* %22
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}