#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 isdigit(char);
int /*<<< orphan*/ printf(char *, int, ...);
int sscanf(char *, char *, int *, int *, int *);
int main() {
  int unit, bss = 0, vid = 0;
  int ret = sscanf("br12", "br%1d%1d.%1d", &unit, &bss, &vid);
  printf("isdigit('0') = %d\n", isdigit('a'));
  printf("ret = %d,unit = %d, bss = %d, vid = %d\n", ret, unit, bss, vid);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeb3(%rip),%rdi
lea    0xeb1(%rip),%rsi
lea    -0x4(%rbp),%rdx
lea    -0x8(%rbp),%rcx
lea    -0xc(%rbp),%r8
call   1050 <sscanf@plt>
mov    %eax,-0x10(%rbp)
mov    $0x61,%edi
call   1030 <isdigit@plt>
mov    %eax,%esi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
lea    0xeb4(%rip),%rdi
lea    0xeb2(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
call   1050 <sscanf@plt>
mov    %eax,%ebx
mov    $0x61,%edi
call   1030 <isdigit@plt>
lea    0xe98(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    0x4(%rsp),%r8d
lea    0xe8e(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"br12\00"
@.str.1 = [13 x i8] c"br%1d%1d.%1d\00"
@.str.2 = [19 x i8] c"isdigit('0') = %d\0A\00"
@.str.3 = [40 x i8] c"ret = %d,unit = %d, bss = %d, vid = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %2
store i32 0, i32* %3
%5 = call i32 @sscanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
store i32 %5, i32* %4
%6 = call i32 @isdigit(i8 signext 97)
%7 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %4
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 %8, i32 %9, i32 %10, i32 %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"br12\00"
@.str.1 = [13 x i8] c"br%1d%1d.%1d\00"
@.str.2 = [19 x i8] c"isdigit('0') = %d\0A\00"
@.str.3 = [40 x i8] c"ret = %d,unit = %d, bss = %d, vid = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = call i32 @sscanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%8 = call i32 @isdigit(i8 signext 97)
%9 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i32 %7, i32 %10, i32 %11, i32 %12)
ret i32 0
}