#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*/ free(char *);
int *malloc(int);
int /*<<< orphan*/ parse_json(int /*<<< orphan*/, char **, char **);
int /*<<< orphan*/ read_native_message();
int *get_sudoku() {
  char *key;
  char *val;
  parse_json(read_native_message(), &key, &val);
  unsigned int i;
  unsigned int fields = 9 * 9;
  int *sudoku = malloc(sizeof(int) * fields);
  for (i = 0; i < fields; i++) {
    sudoku[i] = val[i] - '0';
  }
  free(key);
  free(val);
  return sudoku;
}


x86 assembly (clang, -O0):
<get_sudoku>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1040 <read_native_message@plt>
mov    %eax,%edi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1060 <parse_json@plt>
movl   $0x51,-0x18(%rbp)
mov    -0x18(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jae    11b0 <get_sudoku+0x70>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%edx
sub    $0x30,%edx
mov    -0x20(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    %edx,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117e <get_sudoku+0x3e>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_sudoku>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <read_native_message@plt>
lea    0x8(%rsp),%rsi
mov    %rsp,%rdx
mov    %eax,%edi
call   1060 <parse_json@plt>
mov    $0x144,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    (%rsp),%rax
movd   (%rax),%xmm0
punpcklbw %xmm0,%xmm0
punpcklwd %xmm0,%xmm1
psrad  $0x18,%xmm1
movdqa 0xe7b(%rip),%xmm0
paddd  %xmm0,%xmm1
movdqu %xmm1,(%rbx)
movd   0x4(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0x10(%rbx)
movd   0x8(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0x20(%rbx)
movd   0xc(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0x30(%rbx)
movd   0x10(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0x40(%rbx)
movd   0x14(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0x50(%rbx)
movd   0x18(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0x60(%rbx)
movd   0x1c(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0x70(%rbx)
movd   0x20(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0x80(%rbx)
movd   0x24(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0x90(%rbx)
movd   0x28(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0xa0(%rbx)
movd   0x2c(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0xb0(%rbx)
movd   0x30(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0xc0(%rbx)
movd   0x34(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0xd0(%rbx)
movd   0x38(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0xe0(%rbx)
movd   0x3c(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0xf0(%rbx)
movd   0x40(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0x100(%rbx)
movd   0x44(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0x110(%rbx)
movd   0x48(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0x120(%rbx)
movd   0x4c(%rax),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
psrad  $0x18,%xmm1
paddd  %xmm0,%xmm1
movdqu %xmm1,0x130(%rbx)
movsbl 0x50(%rax),%eax
add    $0xffffffd0,%eax
mov    %eax,0x140(%rbx)
mov    0x8(%rsp),%rdi
call   1030 <free@plt>
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32* @get_sudoku() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = call i32 (...) @read_native_message()
%7 = call i32 @parse_json(i32 %6, i8** %1, i8** %2)
store i32 81, i32* %4
%8 = load i32, i32* %4
%9 = zext i32 %8 to i64
%10 = mul i64 4, %9
%11 = trunc i64 %10 to i32
%12 = call i32* @malloc(i32 %11)
store i32* %12, i32** %5
store i32 0, i32* %3
br label %13
13: ; preds = %29, %0
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = icmp ult i32 %14, %15
br i1 %16, label %17, label %32
17: ; preds = %13
%18 = load i8*, i8** %2
%19 = load i32, i32* %3
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %18, i64 %20
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = sub nsw i32 %23, 48
%25 = load i32*, i32** %5
%26 = load i32, i32* %3
%27 = zext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %25, i64 %27
store i32 %24, i32* %28
br label %29
29: ; preds = %17
%30 = load i32, i32* %3
%31 = add i32 %30, 1
store i32 %31, i32* %3
br label %13
32: ; preds = %13
%33 = load i8*, i8** %1
%34 = call i32 @free(i8* %33)
%35 = load i8*, i8** %2
%36 = call i32 @free(i8* %35)
%37 = load i32*, i32** %5
ret i32* %37
}

LLVM IR (-O2):
define noalias i32* @get_sudoku() {
%1 = alloca i8*
%2 = alloca i8*
%3 = bitcast i8** %1 to i8*
%4 = bitcast i8** %2 to i8*
%5 = tail call i32 (...) @read_native_message()
%6 = call i32 @parse_json(i32 %5, i8** %1, i8** %2)
%7 = call i32* @malloc(i32 324)
%8 = load i8*, i8** %2
%9 = bitcast i8* %8 to <4 x i8>*
%10 = load <4 x i8>, <4 x i8>* %9
%11 = sext <4 x i8> %10 to <4 x i32>
%12 = add nsw <4 x i32> %11, <i32 -48, i32 -48, i32 -48, i32 -48>
%13 = bitcast i32* %7 to <4 x i32>*
store <4 x i32> %12, <4 x i32>* %13
%14 = getelementptr inbounds i8, i8* %8, i64 4
%15 = bitcast i8* %14 to <4 x i8>*
%16 = load <4 x i8>, <4 x i8>* %15
%17 = sext <4 x i8> %16 to <4 x i32>
%18 = add nsw <4 x i32> %17, <i32 -48, i32 -48, i32 -48, i32 -48>
%19 = getelementptr inbounds i32, i32* %7, i64 4
%20 = bitcast i32* %19 to <4 x i32>*
store <4 x i32> %18, <4 x i32>* %20
%21 = getelementptr inbounds i8, i8* %8, i64 8
%22 = bitcast i8* %21 to <4 x i8>*
%23 = load <4 x i8>, <4 x i8>* %22
%24 = sext <4 x i8> %23 to <4 x i32>
%25 = add nsw <4 x i32> %24, <i32 -48, i32 -48, i32 -48, i32 -48>
%26 = getelementptr inbounds i32, i32* %7, i64 8
%27 = bitcast i32* %26 to <4 x i32>*
store <4 x i32> %25, <4 x i32>* %27
%28 = getelementptr inbounds i8, i8* %8, i64 12
%29 = bitcast i8* %28 to <4 x i8>*
%30 = load <4 x i8>, <4 x i8>* %29
%31 = sext <4 x i8> %30 to <4 x i32>
%32 = add nsw <4 x i32> %31, <i32 -48, i32 -48, i32 -48, i32 -48>
%33 = getelementptr inbounds i32, i32* %7, i64 12
%34 = bitcast i32* %33 to <4 x i32>*
store <4 x i32> %32, <4 x i32>* %34
%35 = getelementptr inbounds i8, i8* %8, i64 16
%36 = bitcast i8* %35 to <4 x i8>*
%37 = load <4 x i8>, <4 x i8>* %36
%38 = sext <4 x i8> %37 to <4 x i32>
%39 = add nsw <4 x i32> %38, <i32 -48, i32 -48, i32 -48, i32 -48>
%40 = getelementptr inbounds i32, i32* %7, i64 16
%41 = bitcast i32* %40 to <4 x i32>*
store <4 x i32> %39, <4 x i32>* %41
%42 = getelementptr inbounds i8, i8* %8, i64 20
%43 = bitcast i8* %42 to <4 x i8>*
%44 = load <4 x i8>, <4 x i8>* %43
%45 = sext <4 x i8> %44 to <4 x i32>
%46 = add nsw <4 x i32> %45, <i32 -48, i32 -48, i32 -48, i32 -48>
%47 = getelementptr inbounds i32, i32* %7, i64 20
%48 = bitcast i32* %47 to <4 x i32>*
store <4 x i32> %46, <4 x i32>* %48
%49 = getelementptr inbounds i8, i8* %8, i64 24
%50 = bitcast i8* %49 to <4 x i8>*
%51 = load <4 x i8>, <4 x i8>* %50
%52 = sext <4 x i8> %51 to <4 x i32>
%53 = add nsw <4 x i32> %52, <i32 -48, i32 -48, i32 -48, i32 -48>
%54 = getelementptr inbounds i32, i32* %7, i64 24
%55 = bitcast i32* %54 to <4 x i32>*
store <4 x i32> %53, <4 x i32>* %55
%56 = getelementptr inbounds i8, i8* %8, i64 28
%57 = bitcast i8* %56 to <4 x i8>*
%58 = load <4 x i8>, <4 x i8>* %57
%59 = sext <4 x i8> %58 to <4 x i32>
%60 = add nsw <4 x i32> %59, <i32 -48, i32 -48, i32 -48, i32 -48>
%61 = getelementptr inbounds i32, i32* %7, i64 28
%62 = bitcast i32* %61 to <4 x i32>*
store <4 x i32> %60, <4 x i32>* %62
%63 = getelementptr inbounds i8, i8* %8, i64 32
%64 = bitcast i8* %63 to <4 x i8>*
%65 = load <4 x i8>, <4 x i8>* %64
%66 = sext <4 x i8> %65 to <4 x i32>
%67 = add nsw <4 x i32> %66, <i32 -48, i32 -48, i32 -48, i32 -48>
%68 = getelementptr inbounds i32, i32* %7, i64 32
%69 = bitcast i32* %68 to <4 x i32>*
store <4 x i32> %67, <4 x i32>* %69
%70 = getelementptr inbounds i8, i8* %8, i64 36
%71 = bitcast i8* %70 to <4 x i8>*
%72 = load <4 x i8>, <4 x i8>* %71
%73 = sext <4 x i8> %72 to <4 x i32>
%74 = add nsw <4 x i32> %73, <i32 -48, i32 -48, i32 -48, i32 -48>
%75 = getelementptr inbounds i32, i32* %7, i64 36
%76 = bitcast i32* %75 to <4 x i32>*
store <4 x i32> %74, <4 x i32>* %76
%77 = getelementptr inbounds i8, i8* %8, i64 40
%78 = bitcast i8* %77 to <4 x i8>*
%79 = load <4 x i8>, <4 x i8>* %78
%80 = sext <4 x i8> %79 to <4 x i32>
%81 = add nsw <4 x i32> %80, <i32 -48, i32 -48, i32 -48, i32 -48>
%82 = getelementptr inbounds i32, i32* %7, i64 40
%83 = bitcast i32* %82 to <4 x i32>*
store <4 x i32> %81, <4 x i32>* %83
%84 = getelementptr inbounds i8, i8* %8, i64 44
%85 = bitcast i8* %84 to <4 x i8>*
%86 = load <4 x i8>, <4 x i8>* %85
%87 = sext <4 x i8> %86 to <4 x i32>
%88 = add nsw <4 x i32> %87, <i32 -48, i32 -48, i32 -48, i32 -48>
%89 = getelementptr inbounds i32, i32* %7, i64 44
%90 = bitcast i32* %89 to <4 x i32>*
store <4 x i32> %88, <4 x i32>* %90
%91 = getelementptr inbounds i8, i8* %8, i64 48
%92 = bitcast i8* %91 to <4 x i8>*
%93 = load <4 x i8>, <4 x i8>* %92
%94 = sext <4 x i8> %93 to <4 x i32>
%95 = add nsw <4 x i32> %94, <i32 -48, i32 -48, i32 -48, i32 -48>
%96 = getelementptr inbounds i32, i32* %7, i64 48
%97 = bitcast i32* %96 to <4 x i32>*
store <4 x i32> %95, <4 x i32>* %97
%98 = getelementptr inbounds i8, i8* %8, i64 52
%99 = bitcast i8* %98 to <4 x i8>*
%100 = load <4 x i8>, <4 x i8>* %99
%101 = sext <4 x i8> %100 to <4 x i32>
%102 = add nsw <4 x i32> %101, <i32 -48, i32 -48, i32 -48, i32 -48>
%103 = getelementptr inbounds i32, i32* %7, i64 52
%104 = bitcast i32* %103 to <4 x i32>*
store <4 x i32> %102, <4 x i32>* %104
%105 = getelementptr inbounds i8, i8* %8, i64 56
%106 = bitcast i8* %105 to <4 x i8>*
%107 = load <4 x i8>, <4 x i8>* %106
%108 = sext <4 x i8> %107 to <4 x i32>
%109 = add nsw <4 x i32> %108, <i32 -48, i32 -48, i32 -48, i32 -48>
%110 = getelementptr inbounds i32, i32* %7, i64 56
%111 = bitcast i32* %110 to <4 x i32>*
store <4 x i32> %109, <4 x i32>* %111
%112 = getelementptr inbounds i8, i8* %8, i64 60
%113 = bitcast i8* %112 to <4 x i8>*
%114 = load <4 x i8>, <4 x i8>* %113
%115 = sext <4 x i8> %114 to <4 x i32>
%116 = add nsw <4 x i32> %115, <i32 -48, i32 -48, i32 -48, i32 -48>
%117 = getelementptr inbounds i32, i32* %7, i64 60
%118 = bitcast i32* %117 to <4 x i32>*
store <4 x i32> %116, <4 x i32>* %118
%119 = getelementptr inbounds i8, i8* %8, i64 64
%120 = bitcast i8* %119 to <4 x i8>*
%121 = load <4 x i8>, <4 x i8>* %120
%122 = sext <4 x i8> %121 to <4 x i32>
%123 = add nsw <4 x i32> %122, <i32 -48, i32 -48, i32 -48, i32 -48>
%124 = getelementptr inbounds i32, i32* %7, i64 64
%125 = bitcast i32* %124 to <4 x i32>*
store <4 x i32> %123, <4 x i32>* %125
%126 = getelementptr inbounds i8, i8* %8, i64 68
%127 = bitcast i8* %126 to <4 x i8>*
%128 = load <4 x i8>, <4 x i8>* %127
%129 = sext <4 x i8> %128 to <4 x i32>
%130 = add nsw <4 x i32> %129, <i32 -48, i32 -48, i32 -48, i32 -48>
%131 = getelementptr inbounds i32, i32* %7, i64 68
%132 = bitcast i32* %131 to <4 x i32>*
store <4 x i32> %130, <4 x i32>* %132
%133 = getelementptr inbounds i8, i8* %8, i64 72
%134 = bitcast i8* %133 to <4 x i8>*
%135 = load <4 x i8>, <4 x i8>* %134
%136 = sext <4 x i8> %135 to <4 x i32>
%137 = add nsw <4 x i32> %136, <i32 -48, i32 -48, i32 -48, i32 -48>
%138 = getelementptr inbounds i32, i32* %7, i64 72
%139 = bitcast i32* %138 to <4 x i32>*
store <4 x i32> %137, <4 x i32>* %139
%140 = getelementptr inbounds i8, i8* %8, i64 76
%141 = bitcast i8* %140 to <4 x i8>*
%142 = load <4 x i8>, <4 x i8>* %141
%143 = sext <4 x i8> %142 to <4 x i32>
%144 = add nsw <4 x i32> %143, <i32 -48, i32 -48, i32 -48, i32 -48>
%145 = getelementptr inbounds i32, i32* %7, i64 76
%146 = bitcast i32* %145 to <4 x i32>*
store <4 x i32> %144, <4 x i32>* %146
%147 = getelementptr inbounds i8, i8* %8, i64 80
%148 = load i8, i8* %147
%149 = sext i8 %148 to i32
%150 = add nsw i32 %149, -48
%151 = getelementptr inbounds i32, i32* %7, i64 80
store i32 %150, i32* %151
%152 = load i8*, i8** %1
%153 = call i32 @free(i8* %152)
%154 = load i8*, i8** %2
%155 = call i32 @free(i8* %154)
ret i32* %7
}