#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 *, ...);
int sscanf(char *, char *, char *, ...);
void sscanf_test(void) {
  int ret;
  char *string;
  int digit;
  char buf1[255];
  char buf2[255];
  char buf3[255];
  char buf4[255];
  string = "china beijing 123";
  ret = sscanf(string, "%s %s %d", buf1, buf2, &digit);
  printf("1.string=%s\n", string);
  printf("1.ret=%d, buf1=%s, buf2=%s, digit=%d\n\n", ret, buf1, buf2, digit);
  string = "123456789";
  sscanf(string, "%5s", buf1);
  printf("2.string=%s\n", string);
  printf("2.buf1=%s\n\n", buf1);
  string = "123/456";
  sscanf(string, "%[^/]", buf1);
  printf("3.string=%s\n", string);
  printf("3.buf1=%s\n\n", buf1);
  string = "123abcABC";
  sscanf(string, "%[^A-Z]", buf1);
  printf("4.string=%s\n", string);
  printf("4.buf1=%s\n\n", buf1);
  string = "0123abcABC";
  sscanf(string, "%[0-9]%[a-z]%[A-Z]", buf1, buf2, buf3);
  printf("5.string=%s\n", string);
  printf("5.buf1=%s, buf2=%s, buf3=%s\n\n", buf1, buf2, buf3);
  char patten[] = "%*[^<]<%[^>]";
  string = "ios<android>wp7";
  sscanf(string, patten, buf1);
  printf("6.string=%s\n", string);
  printf("6.buf1=%s\n\n", buf1);
  string = "iosVSandroid";
  sscanf(string, "%[a-z]VS%[a-z]", buf1, buf2);
  printf("7.string=%s\n", string);
  printf("7.buf1=%s, buf2=%s\n\n", buf1, buf2);
  string = "android-iphone-wp7";
  sscanf(string, "%[^-]-%[^-]-%[^-]", buf1, buf2, buf3);
  printf("8.string=%s\n", string);
  printf("8.buf1=%s, buf2=%s, buf3=%s\n\n", buf1, buf2, buf3);
  string = "Email:beijing@sina.com.cn";
  sscanf(string, "%[^:]:%[^@]@%[^.].%s", buf1, buf2, buf3, buf4);
  printf("9.string=%s\n", string);
  printf("9.buf1=%s, buf2=%s, buf3=%s, buf4=%s\n\n", buf1, buf2, buf3, buf4);
  string = "android iphone wp7";
  sscanf(string, "%s %*s %s", buf1, buf2);
  printf("10.string=%s\n", string);
  printf("10.buf1=%s, buf2=%s\n\n", buf1, buf2);
}


x86 assembly (clang, -O0):
<sscanf_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
lea    0xece(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    -0x220(%rbp),%rcx
lea    0xec3(%rip),%rsi
lea    -0x14(%rbp),%r8
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    %eax,-0x4(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    -0x120(%rbp),%rdx
lea    -0x220(%rbp),%rcx
mov    -0x14(%rbp),%r8d
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    0xeaa(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x120(%rbp),%rsi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe92(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    0xe84(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x120(%rbp),%rsi
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe90(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    0xe58(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x120(%rbp),%rsi
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe44(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    -0x220(%rbp),%rcx
lea    -0x320(%rbp),%r8
lea    0xe2b(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x120(%rbp),%rsi
lea    -0x220(%rbp),%rdx
lea    -0x320(%rbp),%rcx
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xe26(%rip),%rax
mov    %rax,-0x42d(%rbp)
mov    0xe21(%rip),%eax
mov    %eax,-0x425(%rbp)
mov    0xe19(%rip),%al
mov    %al,-0x421(%rbp)
lea    0xe0d(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x42d(%rbp),%rsi
lea    -0x120(%rbp),%rdx
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x120(%rbp),%rsi
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdeb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    -0x220(%rbp),%rcx
lea    0xddb(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xdd8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x120(%rbp),%rsi
lea    -0x220(%rbp),%rdx
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdd0(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    -0x220(%rbp),%rcx
lea    -0x320(%rbp),%r8
lea    0xdbf(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xdbf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x120(%rbp),%rsi
lea    -0x220(%rbp),%rdx
lea    -0x320(%rbp),%rcx
lea    0xda9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdb9(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    -0x220(%rbp),%rcx
lea    -0x320(%rbp),%r8
lea    -0x420(%rbp),%r9
lea    0xda8(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xdab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x120(%rbp),%rsi
lea    -0x220(%rbp),%rdx
lea    -0x320(%rbp),%rcx
lea    -0x420(%rbp),%r8
lea    0xd8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xda7(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    -0x220(%rbp),%rcx
lea    0xd9d(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    -0x10(%rbp),%rsi
lea    0xd95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x120(%rbp),%rsi
lea    -0x220(%rbp),%rdx
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sscanf_test>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x420,%rsp
lea    0xeca(%rip),%r15
lea    0xed5(%rip),%rsi
lea    0x320(%rsp),%rbx
lea    0x220(%rsp),%r14
lea    0xc(%rsp),%r8
mov    %r15,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    %eax,%ebp
lea    0xeb0(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%r8d
lea    0xea7(%rip),%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb8(%rip),%rbp
lea    0xebb(%rip),%rsi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
lea    0xeab(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea7(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xea2(%rip),%rbp
lea    0xea3(%rip),%rsi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
lea    0xe95(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe91(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeae(%rip),%rbp
lea    0xe85(%rip),%rsi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
lea    0xe79(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe75(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe70(%rip),%rbp
lea    0xe74(%rip),%rsi
lea    0x120(%rsp),%r15
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %r15,%r8
xor    %eax,%eax
call   1040 <sscanf@plt>
lea    0xe65(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe61(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
movabs $0x5d3e5e5b253c5d,%rax
mov    %rax,0x15(%rsp)
movabs $0x253c5d3c5e5b2a25,%rax
5d 3c 25
mov    %rax,0x10(%rsp)
lea    0xe57(%rip),%rbp
lea    0x10(%rsp),%rsi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
lea    0xe4e(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe4a(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe45(%rip),%rbp
lea    0xe4b(%rip),%rsi
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <sscanf@plt>
lea    0xe43(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe3f(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe40(%rip),%rbp
lea    0xe4c(%rip),%rsi
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %r15,%r8
xor    %eax,%eax
call   1040 <sscanf@plt>
lea    0xe44(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe40(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe47(%rip),%rbp
lea    0xe5a(%rip),%rsi
lea    0x20(%rsp),%r12
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %r15,%r8
mov    %r12,%r9
xor    %eax,%eax
call   1040 <sscanf@plt>
lea    0xe4d(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe49(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
mov    %r12,%r8
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe56(%rip),%rbp
lea    0xe62(%rip),%rsi
mov    %rbp,%rdi
mov    %rbx,%rdx
mov    %r14,%rcx
xor    %eax,%eax
call   1040 <sscanf@plt>
lea    0xe55(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe52(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x420,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"china beijing 123\00"
@.str.1 = [9 x i8] c"%s %s %d\00"
@.str.2 = [13 x i8] c"1.string=%s\0A\00"
@.str.3 = [39 x i8] c"1.ret=%d, buf1=%s, buf2=%s, digit=%d\0A\0A\00"
@.str.4 = [10 x i8] c"123456789\00"
@.str.5 = [4 x i8] c"%5s\00"
@.str.6 = [13 x i8] c"2.string=%s\0A\00"
@.str.7 = [12 x i8] c"2.buf1=%s\0A\0A\00"
@.str.8 = [8 x i8] c"123/456\00"
@.str.9 = [6 x i8] c"%[^/]\00"
@.str.10 = [13 x i8] c"3.string=%s\0A\00"
@.str.11 = [12 x i8] c"3.buf1=%s\0A\0A\00"
@.str.12 = [10 x i8] c"123abcABC\00"
@.str.13 = [8 x i8] c"%[^A-Z]\00"
@.str.14 = [13 x i8] c"4.string=%s\0A\00"
@.str.15 = [12 x i8] c"4.buf1=%s\0A\0A\00"
@.str.16 = [11 x i8] c"0123abcABC\00"
@.str.17 = [19 x i8] c"%[0-9]%[a-z]%[A-Z]\00"
@.str.18 = [13 x i8] c"5.string=%s\0A\00"
@.str.19 = [30 x i8] c"5.buf1=%s, buf2=%s, buf3=%s\0A\0A\00"
@__const.sscanf_test.patten = [13 x i8] c"%*[^<]<%[^>]\00"
@.str.20 = [16 x i8] c"ios<android>wp7\00"
@.str.21 = [13 x i8] c"6.string=%s\0A\00"
@.str.22 = [12 x i8] c"6.buf1=%s\0A\0A\00"
@.str.23 = [13 x i8] c"iosVSandroid\00"
@.str.24 = [15 x i8] c"%[a-z]VS%[a-z]\00"
@.str.25 = [13 x i8] c"7.string=%s\0A\00"
@.str.26 = [21 x i8] c"7.buf1=%s, buf2=%s\0A\0A\00"
@.str.27 = [19 x i8] c"android-iphone-wp7\00"
@.str.28 = [18 x i8] c"%[^-]-%[^-]-%[^-]\00"
@.str.29 = [13 x i8] c"8.string=%s\0A\00"
@.str.30 = [30 x i8] c"8.buf1=%s, buf2=%s, buf3=%s\0A\0A\00"
@.str.31 = [26 x i8] c"Email:beijing@sina.com.cn\00"
@.str.32 = [21 x i8] c"%[^:]:%[^@]@%[^.].%s\00"
@.str.33 = [13 x i8] c"9.string=%s\0A\00"
@.str.34 = [39 x i8] c"9.buf1=%s, buf2=%s, buf3=%s, buf4=%s\0A\0A\00"
@.str.35 = [19 x i8] c"android iphone wp7\00"
@.str.36 = [10 x i8] c"%s %*s %s\00"
@.str.37 = [14 x i8] c"10.string=%s\0A\00"
@.str.38 = [22 x i8] c"10.buf1=%s, buf2=%s\0A\0A\00"
define void @sscanf_test() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32
%4 = alloca [255 x i8]
%5 = alloca [255 x i8]
%6 = alloca [255 x i8]
%7 = alloca [255 x i8]
%8 = alloca [13 x i8]
store i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8** %2
%9 = load i8*, i8** %2
%10 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%12 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* %11, i32* %3)
store i32 %12, i32* %1
%13 = load i8*, i8** %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = load i32, i32* %1
%16 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%17 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %15, i8* %16, i8* %17, i32 %18)
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8** %2
%20 = load i8*, i8** %2
%21 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%22 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %20, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %21)
%23 = load i8*, i8** %2
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* %23)
%25 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8* %25)
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8** %2
%27 = load i8*, i8** %2
%28 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%29 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %27, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %28)
%30 = load i8*, i8** %2
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i8* %30)
%32 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8* %32)
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8** %2
%34 = load i8*, i8** %2
%35 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%36 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %34, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i8* %35)
%37 = load i8*, i8** %2
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i8* %37)
%39 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0), i8* %39)
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i8** %2
%41 = load i8*, i8** %2
%42 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%43 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%44 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%45 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %41, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0), i8* %42, i8* %43, i8* %44)
%46 = load i8*, i8** %2
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.18, i64 0, i64 0), i8* %46)
%48 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%49 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%50 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.19, i64 0, i64 0), i8* %48, i8* %49, i8* %50)
%52 = bitcast [13 x i8]* %8 to i8*
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0), i8** %2
%53 = load i8*, i8** %2
%54 = getelementptr inbounds [13 x i8], [13 x i8]* %8, i64 0, i64 0
%55 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%56 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %53, i8* %54, i8* %55)
%57 = load i8*, i8** %2
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.21, i64 0, i64 0), i8* %57)
%59 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.22, i64 0, i64 0), i8* %59)
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.23, i64 0, i64 0), i8** %2
%61 = load i8*, i8** %2
%62 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%63 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%64 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %61, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.24, i64 0, i64 0), i8* %62, i8* %63)
%65 = load i8*, i8** %2
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.25, i64 0, i64 0), i8* %65)
%67 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%68 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.26, i64 0, i64 0), i8* %67, i8* %68)
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.27, i64 0, i64 0), i8** %2
%70 = load i8*, i8** %2
%71 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%72 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%73 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%74 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %70, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.28, i64 0, i64 0), i8* %71, i8* %72, i8* %73)
%75 = load i8*, i8** %2
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.29, i64 0, i64 0), i8* %75)
%77 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%78 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%79 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.30, i64 0, i64 0), i8* %77, i8* %78, i8* %79)
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.31, i64 0, i64 0), i8** %2
%81 = load i8*, i8** %2
%82 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%83 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%84 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%85 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 0
%86 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %81, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.32, i64 0, i64 0), i8* %82, i8* %83, i8* %84, i8* %85)
%87 = load i8*, i8** %2
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.33, i64 0, i64 0), i8* %87)
%89 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%90 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%91 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%92 = getelementptr inbounds [255 x i8], [255 x i8]* %7, i64 0, i64 0
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.34, i64 0, i64 0), i8* %89, i8* %90, i8* %91, i8* %92)
store i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.35, i64 0, i64 0), i8** %2
%94 = load i8*, i8** %2
%95 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%96 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%97 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* %94, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.36, i64 0, i64 0), i8* %95, i8* %96)
%98 = load i8*, i8** %2
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.37, i64 0, i64 0), i8* %98)
%100 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%101 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%102 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.38, i64 0, i64 0), i8* %100, i8* %101)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"china beijing 123\00"
@.str.1 = [9 x i8] c"%s %s %d\00"
@.str.2 = [13 x i8] c"1.string=%s\0A\00"
@.str.3 = [39 x i8] c"1.ret=%d, buf1=%s, buf2=%s, digit=%d\0A\0A\00"
@.str.4 = [10 x i8] c"123456789\00"
@.str.5 = [4 x i8] c"%5s\00"
@.str.6 = [13 x i8] c"2.string=%s\0A\00"
@.str.7 = [12 x i8] c"2.buf1=%s\0A\0A\00"
@.str.8 = [8 x i8] c"123/456\00"
@.str.9 = [6 x i8] c"%[^/]\00"
@.str.10 = [13 x i8] c"3.string=%s\0A\00"
@.str.11 = [12 x i8] c"3.buf1=%s\0A\0A\00"
@.str.12 = [10 x i8] c"123abcABC\00"
@.str.13 = [8 x i8] c"%[^A-Z]\00"
@.str.14 = [13 x i8] c"4.string=%s\0A\00"
@.str.15 = [12 x i8] c"4.buf1=%s\0A\0A\00"
@.str.16 = [11 x i8] c"0123abcABC\00"
@.str.17 = [19 x i8] c"%[0-9]%[a-z]%[A-Z]\00"
@.str.18 = [13 x i8] c"5.string=%s\0A\00"
@.str.19 = [30 x i8] c"5.buf1=%s, buf2=%s, buf3=%s\0A\0A\00"
@__const.sscanf_test.patten = [13 x i8] c"%*[^<]<%[^>]\00"
@.str.20 = [16 x i8] c"ios<android>wp7\00"
@.str.21 = [13 x i8] c"6.string=%s\0A\00"
@.str.22 = [12 x i8] c"6.buf1=%s\0A\0A\00"
@.str.23 = [13 x i8] c"iosVSandroid\00"
@.str.24 = [15 x i8] c"%[a-z]VS%[a-z]\00"
@.str.25 = [13 x i8] c"7.string=%s\0A\00"
@.str.26 = [21 x i8] c"7.buf1=%s, buf2=%s\0A\0A\00"
@.str.27 = [19 x i8] c"android-iphone-wp7\00"
@.str.28 = [18 x i8] c"%[^-]-%[^-]-%[^-]\00"
@.str.29 = [13 x i8] c"8.string=%s\0A\00"
@.str.30 = [30 x i8] c"8.buf1=%s, buf2=%s, buf3=%s\0A\0A\00"
@.str.31 = [26 x i8] c"Email:beijing@sina.com.cn\00"
@.str.32 = [21 x i8] c"%[^:]:%[^@]@%[^.].%s\00"
@.str.33 = [13 x i8] c"9.string=%s\0A\00"
@.str.34 = [39 x i8] c"9.buf1=%s, buf2=%s, buf3=%s, buf4=%s\0A\0A\00"
@.str.35 = [19 x i8] c"android iphone wp7\00"
@.str.36 = [10 x i8] c"%s %*s %s\00"
@.str.37 = [14 x i8] c"10.string=%s\0A\00"
@.str.38 = [22 x i8] c"10.buf1=%s, buf2=%s\0A\0A\00"
define void @sscanf_test() {
%1 = alloca i32
%2 = alloca [255 x i8]
%3 = alloca [255 x i8]
%4 = alloca [255 x i8]
%5 = alloca [255 x i8]
%6 = alloca [13 x i8]
%7 = bitcast i32* %1 to i8*
%8 = getelementptr inbounds [255 x i8], [255 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%12 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %8, i8* %9, i32* %1)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* %1
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0), i32 %12, i8* %8, i8* %9, i32 %14)
%16 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %8)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.7, i64 0, i64 0), i8* %8)
%19 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %8)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0), i8* %8)
%22 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i8* %8)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.15, i64 0, i64 0), i8* %8)
%25 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.17, i64 0, i64 0), i8* %8, i8* %9, i8* %10)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.19, i64 0, i64 0), i8* %8, i8* %9, i8* %10)
%28 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%29 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0), i8* %28, i8* %8)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.20, i64 0, i64 0))
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.22, i64 0, i64 0), i8* %8)
%32 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.23, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.24, i64 0, i64 0), i8* %8, i8* %9)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.25, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.23, i64 0, i64 0))
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.26, i64 0, i64 0), i8* %8, i8* %9)
%35 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.27, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.28, i64 0, i64 0), i8* %8, i8* %9, i8* %10)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.29, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.27, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.30, i64 0, i64 0), i8* %8, i8* %9, i8* %10)
%38 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.31, i64 0, i64 0), i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.32, i64 0, i64 0), i8* %8, i8* %9, i8* %10, i8* %11)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.33, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.31, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.34, i64 0, i64 0), i8* %8, i8* %9, i8* %10, i8* %11)
%41 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.35, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.36, i64 0, i64 0), i8* %8, i8* %9)
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.37, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.35, i64 0, i64 0))
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.38, i64 0, i64 0), i8* %8, i8* %9)
ret void
}