#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*/ memset(char **, int, int);
int /*<<< orphan*/ printf(char *, int, int, char);
int two_dimension_array_test() {
  int i, j;
  char b[3][10];
  memset(b, 0x8, 3 * 10);
  for (i = 0; i < 3; i++) {
    for (j = 0; j < 10; j++) {
      printf("b[%d][%d] = %d\n", i, j, b[i][j]);
    }
  }
}


x86 assembly (clang, -O0):
<two_dimension_array_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
mov    $0x8,%esi
mov    $0x1e,%edx
call   1040 <memset@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11a7 <two_dimension_array_test+0x87>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    1194 <two_dimension_array_test+0x74>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
movslq -0x8(%rbp),%rcx
lea    -0x30(%rbp),%rax
imul   $0xa,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
lea    0xe83(%rip),%rdi
movsbl (%rax,%rcx,1),%ecx
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1153 <two_dimension_array_test+0x33>
jmp    1199 <two_dimension_array_test+0x79>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1142 <two_dimension_array_test+0x22>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<two_dimension_array_test>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsp,%rdi
mov    $0x8,%esi
mov    $0x1e,%edx
call   1040 <memset@plt>
lea    0x9(%rsp),%r15
xor    %ebx,%ebx
lea    0xeb7(%rip),%r14
nopl   0x0(%rax)
movsbl -0x9(%r15),%ecx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %edx,%edx
call   1030 <printf@plt>
movsbl -0x8(%r15),%ecx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
call   1030 <printf@plt>
movsbl -0x7(%r15),%ecx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x2,%edx
call   1030 <printf@plt>
movsbl -0x6(%r15),%ecx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x3,%edx
call   1030 <printf@plt>
movsbl -0x5(%r15),%ecx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x4,%edx
call   1030 <printf@plt>
movsbl -0x4(%r15),%ecx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x5,%edx
call   1030 <printf@plt>
movsbl -0x3(%r15),%ecx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x6,%edx
call   1030 <printf@plt>
movsbl -0x2(%r15),%ecx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x7,%edx
call   1030 <printf@plt>
movsbl -0x1(%r15),%ecx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x8,%edx
call   1030 <printf@plt>
movsbl (%r15),%ecx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x9,%edx
call   1030 <printf@plt>
add    $0x1,%rbx
add    $0xa,%r15
cmp    $0x3,%rbx
jne    1150 <two_dimension_array_test+0x30>
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"b[%d][%d] = %d\0A\00"
define i32 @two_dimension_array_test() {
%1 = alloca [3 x [10 x i8]]
%2 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %1, i64 0, i64 0, i64 0
%3 = bitcast [3 x [10 x i8]]* %1 to i8**
%4 = call i32 @memset(i8** %3, i32 8, i32 30)
br label %5
5: ; preds = %0, %5
%6 = phi i64 [ 0, %0 ], [ %38, %5 ]
%7 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %1, i64 0, i64 %6, i64 0
%8 = load i8, i8* %7
%9 = trunc i64 %6 to i32
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9, i32 0, i8 signext %8)
%11 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %1, i64 0, i64 %6, i64 1
%12 = load i8, i8* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9, i32 1, i8 signext %12)
%14 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %1, i64 0, i64 %6, i64 2
%15 = load i8, i8* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9, i32 2, i8 signext %15)
%17 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %1, i64 0, i64 %6, i64 3
%18 = load i8, i8* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9, i32 3, i8 signext %18)
%20 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %1, i64 0, i64 %6, i64 4
%21 = load i8, i8* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9, i32 4, i8 signext %21)
%23 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %1, i64 0, i64 %6, i64 5
%24 = load i8, i8* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9, i32 5, i8 signext %24)
%26 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %1, i64 0, i64 %6, i64 6
%27 = load i8, i8* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9, i32 6, i8 signext %27)
%29 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %1, i64 0, i64 %6, i64 7
%30 = load i8, i8* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9, i32 7, i8 signext %30)
%32 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %1, i64 0, i64 %6, i64 8
%33 = load i8, i8* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9, i32 8, i8 signext %33)
%35 = getelementptr inbounds [3 x [10 x i8]], [3 x [10 x i8]]* %1, i64 0, i64 %6, i64 9
%36 = load i8, i8* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32 %9, i32 9, i8 signext %36)
%38 = add nuw nsw i64 %6, 1
%39 = icmp eq i64 %38, 3
br i1 %39, label %40, label %5
40: ; preds = %5
ret i32 undef
}