#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 *, ...);
int /*<<< orphan*/ sscanf(char *, char *, char *, ...);
int main() {
  char name[20], tel[50], field[20], areaCode[20], code[20];
  int age;
  sscanf("name:john age:40 tel:082-313530", "%s", name);
  printf("%s\n", name);
  sscanf("name:john age:40 tel:082-313530", "%8s", name);
  printf("%s\n", name);
  sscanf("name:john age:40 tel:082-313530", "%[^:]", name);
  printf("%s\n", name);
  sscanf("name:john age:40 tel:082-313530", "%[^:]:%s", field, name);
  printf("%s %s\n", field, name);
  sscanf("name:john age:40 tel:082-313530", "name:%s age:%d tel:%s", name, &age,
         tel);
  printf("%s %d %s\n", name, age, tel);
  sscanf("name:john age:40 tel:082-313530", "%*[^:]:%s %*[^:]:%d %*[^:]:%s",
         name, &age, tel);
  printf("%s %d %s\n", name, age, tel);
  char protocol[10], site[50], path[50];
  sscanf("https://github.com/wchuanghard", "%[^:]:%*2[/]%[^/]/%[a-zA-Z0-9._/-]",
         protocol, site, path);
  printf("protocol=%s site=%s path=%s\n", protocol, site, path);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rdx
lea    0xec3(%rip),%rdi
lea    0xeec(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
lea    -0x20(%rbp),%rsi
lea    0xf00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdx
lea    0xe98(%rip),%rdi
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
lea    -0x20(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdx
lea    0xe6d(%rip),%rdi
lea    0xe8a(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
lea    -0x20(%rbp),%rsi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x80(%rbp),%rdx
lea    -0x20(%rbp),%rcx
lea    0xe3e(%rip),%rdi
lea    0xe61(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
lea    -0x80(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdx
lea    -0x60(%rbp),%r8
lea    0xe0b(%rip),%rdi
lea    0xe3e(%rip),%rsi
lea    -0xc4(%rbp),%rcx
mov    $0x0,%al
call   1040 <sscanf@plt>
lea    -0x20(%rbp),%rsi
mov    -0xc4(%rbp),%edx
lea    -0x60(%rbp),%rcx
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdx
lea    -0x60(%rbp),%r8
lea    0xdcb(%rip),%rdi
lea    0xe1e(%rip),%rsi
lea    -0xc4(%rbp),%rcx
mov    $0x0,%al
call   1040 <sscanf@plt>
lea    -0x20(%rbp),%rsi
mov    -0xc4(%rbp),%edx
lea    -0x60(%rbp),%rcx
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xce(%rbp),%rdx
lea    -0x100(%rbp),%rcx
lea    -0x140(%rbp),%r8
lea    0xdf6(%rip),%rdi
lea    0xe0e(%rip),%rsi
mov    $0x0,%al
call   1040 <sscanf@plt>
lea    -0xce(%rbp),%rsi
lea    -0x100(%rbp),%rdx
lea    -0x140(%rbp),%rcx
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x110,%rsp
lea    0xec9(%rip),%r14
lea    0xef2(%rip),%rsi
lea    0x30(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
lea    0xeff(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeb5(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe98(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe7d(%rip),%rsi
lea    0x10(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <sscanf@plt>
lea    0xe6a(%rip),%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe5d(%rip),%rsi
mov    %rsp,%r12
lea    0xd0(%rsp),%r15
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r15,%r8
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    (%rsp),%edx
lea    0xe4b(%rip),%r13
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r15,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe3e(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %r12,%rcx
mov    %r15,%r8
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    (%rsp),%edx
mov    %r13,%rdi
mov    %rbx,%rsi
mov    %r15,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe2f(%rip),%rdi
lea    0xe47(%rip),%rsi
lea    0x6(%rsp),%rbx
lea    0x90(%rsp),%r14
lea    0x50(%rsp),%r15
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %r15,%r8
xor    %eax,%eax
call   1040 <sscanf@plt>
lea    0xe41(%rip),%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x110,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"name:john age:40 tel:082-313530\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [4 x i8] c"%8s\00"
@.str.4 = [6 x i8] c"%[^:]\00"
@.str.5 = [9 x i8] c"%[^:]:%s\00"
@.str.6 = [7 x i8] c"%s %s\0A\00"
@.str.7 = [22 x i8] c"name:%s age:%d tel:%s\00"
@.str.8 = [10 x i8] c"%s %d %s\0A\00"
@.str.9 = [30 x i8] c"%*[^:]:%s %*[^:]:%d %*[^:]:%s\00"
@.str.10 = [31 x i8] c"https://github.com/wchuanghard\00"
@.str.11 = [35 x i8] c"%[^:]:%*2[/]%[^/]/%[a-zA-Z0-9._/-]\00"
@.str.12 = [29 x i8] c"protocol=%s site=%s path=%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
%3 = alloca [50 x i8]
%4 = alloca [20 x i8]
%5 = alloca [20 x i8]
%6 = alloca [20 x i8]
%7 = alloca i32
%8 = alloca [10 x i8]
%9 = alloca [50 x i8]
%10 = alloca [50 x i8]
store i32 0, i32* %1
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%12 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%14 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%16 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %15)
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%18 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %17)
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%20 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %19)
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%22 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %21)
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%25 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %23, i8* %24)
%26 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%27 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%28 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %26, i8* %27)
%29 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%30 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%31 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* %29, i32* %7, i8* %30)
%32 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%33 = load i32, i32* %7
%34 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%35 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %32, i32 %33, i8* %34)
%36 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%37 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%38 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), i8* %36, i32* %7, i8* %37)
%39 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%40 = load i32, i32* %7
%41 = getelementptr inbounds [50 x i8], [50 x i8]* %3, i64 0, i64 0
%42 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %39, i32 %40, i8* %41)
%43 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%44 = getelementptr inbounds [50 x i8], [50 x i8]* %9, i64 0, i64 0
%45 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%46 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.11, i64 0, i64 0), i8* %43, i8* %44, i8* %45)
%47 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%48 = getelementptr inbounds [50 x i8], [50 x i8]* %9, i64 0, i64 0
%49 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%50 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i8* %47, i8* %48, i8* %49)
ret i32 1
}

LLVM IR (-O2):
@.str = [32 x i8] c"name:john age:40 tel:082-313530\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%s\0A\00"
@.str.3 = [4 x i8] c"%8s\00"
@.str.4 = [6 x i8] c"%[^:]\00"
@.str.5 = [9 x i8] c"%[^:]:%s\00"
@.str.6 = [7 x i8] c"%s %s\0A\00"
@.str.7 = [22 x i8] c"name:%s age:%d tel:%s\00"
@.str.8 = [10 x i8] c"%s %d %s\0A\00"
@.str.9 = [30 x i8] c"%*[^:]:%s %*[^:]:%d %*[^:]:%s\00"
@.str.10 = [31 x i8] c"https://github.com/wchuanghard\00"
@.str.11 = [35 x i8] c"%[^:]:%*2[/]%[^/]/%[a-zA-Z0-9._/-]\00"
@.str.12 = [29 x i8] c"protocol=%s site=%s path=%s\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [50 x i8]
%3 = alloca [20 x i8]
%4 = alloca i32
%5 = alloca [10 x i8]
%6 = alloca [50 x i8]
%7 = alloca [50 x i8]
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %2, i64 0, i64 0
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%11 = bitcast i32* %4 to i8*
%12 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %8)
%13 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%14 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%15 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%16 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* %8)
%17 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%18 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8* %10, i8* %8)
%19 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %10, i8* %8)
%20 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* %8, i32* %4, i8* %9)
%21 = load i32, i32* %4
%22 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %8, i32 %21, i8* %9)
%23 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.9, i64 0, i64 0), i8* %8, i32* %4, i8* %9)
%24 = load i32, i32* %4
%25 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %8, i32 %24, i8* %9)
%26 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%27 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%28 = getelementptr inbounds [50 x i8], [50 x i8]* %7, i64 0, i64 0
%29 = call i32 (i8*, i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.11, i64 0, i64 0), i8* %26, i8* %27, i8* %28)
%30 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.12, i64 0, i64 0), i8* %26, i8* %27, i8* %28)
ret i32 1
}