#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 getStr1Str2(char *, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ system(char *);
int main(void) {
  char str[] = "1a2b3d4z";
  char buf1[50] = {0};
  char buf2[50] = {0};
  int ret = getStr1Str2(str, buf1, buf2);
  if (ret != 0) {
    printf("getStr1Str2 error: %d\n", ret);
    return ret;
  }
  printf("buf1 = %s\nbuf2 = %s\n", buf1, buf2);
  printf("\n");
  system("pause");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xea7(%rip),%rax
mov    %rax,-0xd(%rbp)
mov    0xea5(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1060 <memset@plt>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x32,%edx
call   1060 <memset@plt>
lea    -0xd(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0x80(%rbp),%rdx
call   1030 <getStr1Str2@plt>
mov    %eax,-0x84(%rbp)
cmpl   $0x0,-0x84(%rbp)
je     11cc <main+0x8c>
mov    -0x84(%rbp),%esi
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x84(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1203 <main+0xc3>
lea    -0x40(%rbp),%rsi
lea    -0x80(%rbp),%rdx
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe3e(%rip),%rdi
call   1040 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x90,%rsp
movabs $0x7a34643362326131,%rax
64 34 7a
mov    %rax,(%rsp)
movb   $0x0,0x8(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movw   $0x0,0x80(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movw   $0x0,0x40(%rsp)
mov    %rsp,%rdi
lea    0x50(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1040 <getStr1Str2@plt>
mov    %eax,%ebx
test   %eax,%eax
je     11b7 <main+0x77>
lea    0xe5d(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    11e5 <main+0xa5>
lea    0xe62(%rip),%rdi
lea    0x50(%rsp),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe55(%rip),%rdi
call   1050 <system@plt>
mov    %ebx,%eax
add    $0x90,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [9 x i8] c"1a2b3d4z\00"
@.str = [23 x i8] c"getStr1Str2 error: %d\0A\00"
@.str.1 = [21 x i8] c"buf1 = %s\0Abuf2 = %s\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i8]
%3 = alloca [50 x i8]
%4 = alloca [50 x i8]
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [9 x i8]* %2 to i8*
%7 = bitcast [50 x i8]* %3 to i8*
%8 = bitcast [50 x i8]* %4 to i8*
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%12 = call i32 @getStr1Str2(i8* %9, i8* %10, i8* %11)
store i32 %12, i32* %5
%13 = load i32, i32* %5
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %19
15: ; preds = %0
%16 = load i32, i32* %5
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %5
store i32 %18, i32* %1
br label %25
19: ; preds = %0
%20 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%21 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %20, i8* %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%24 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %1
br label %25
25: ; preds = %19, %15
%26 = load i32, i32* %1
ret i32 %26
}

LLVM IR (-O2):
@__const.main.str = [9 x i8] c"1a2b3d4z\00"
@.str = [23 x i8] c"getStr1Str2 error: %d\0A\00"
@.str.1 = [21 x i8] c"buf1 = %s\0Abuf2 = %s\0A\00"
@.str.3 = [6 x i8] c"pause\00"
define i32 @main() {
%1 = alloca [9 x i8]
%2 = alloca [50 x i8]
%3 = alloca [50 x i8]
%4 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%7 = call i32 @getStr1Str2(i8* %4, i8* %5, i8* %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %15
11: ; preds = %0
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %5, i8* %6)
%13 = call i32 @putchar(i32 10)
%14 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %15
15: ; preds = %11, %9
ret i32 %7
}