int main(void) {
  char s[] = "31298 87.375";
  int x;
  double y;
  sscanf(s, "%d%lf", &x, &y);
  printf("%s\n%s%6d\n%s%8.3f\n",
         "The values stored in character array s are:", "integer:", x,
         "double:", y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x11(%rbp)
mov    0xec8(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xec3(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x11(%rbp),%rdi
lea    0xeb6(%rip),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x20(%rbp),%rcx
mov    $0x0,%al
call   1040 <sscanf@plt>
mov    -0x18(%rbp),%ecx
movsd  -0x20(%rbp),%xmm0
lea    0xe9e(%rip),%rdi
lea    0xea9(%rip),%rsi
lea    0xece(%rip),%rdx
lea    0xed0(%rip),%r8
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movabs $0x3537332e373820,%rax
mov    %rax,0x1d(%rsp)
movabs $0x3738203839323133,%rax
20 38 37
mov    %rax,0x18(%rsp)
lea    0xec4(%rip),%rsi
lea    0x18(%rsp),%rdi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    0xc(%rsp),%ecx
movsd  0x10(%rsp),%xmm0
lea    0xea3(%rip),%rdi
lea    0xeae(%rip),%rsi
lea    0xed3(%rip),%rdx
lea    0xed5(%rip),%r8
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.s = [13 x i8] c"31298 87.375\00"
@.str = [6 x i8] c"%d%lf\00"
@.str.1 = [18 x i8] c"%s\0A%s%6d\0A%s%8.3f\0A\00"
@.str.2 = [44 x i8] c"The values stored in character array s are:\00"
@.str.3 = [9 x i8] c"integer:\00"
@.str.4 = [8 x i8] c"double:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i8]
%3 = alloca i32
%4 = alloca double
store i32 0, i32* %1
%5 = bitcast [13 x i8]* %2 to i8*
%6 = getelementptr inbounds [13 x i8], [13 x i8]* %2, i64 0, i64 0
%7 = call i32 (i8*, i8*, ...) @sscanf(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, double* %4)
%8 = load i32, i32* %3
%9 = load double, double* %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), double %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [13 x i8] c"31298 87.375\00"
@.str = [6 x i8] c"%d%lf\00"
@.str.1 = [18 x i8] c"%s\0A%s%6d\0A%s%8.3f\0A\00"
@.str.2 = [44 x i8] c"The values stored in character array s are:\00"
@.str.3 = [9 x i8] c"integer:\00"
@.str.4 = [8 x i8] c"double:\00"
define i32 @main() {
%1 = alloca [13 x i8]
%2 = alloca i32
%3 = alloca double
%4 = getelementptr inbounds [13 x i8], [13 x i8]* %1, i64 0, i64 0
%5 = bitcast i32* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = call i32 (i8*, i8*, ...) @sscanf(i8* %4, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %2, double* %3)
%8 = load i32, i32* %2
%9 = load double, double* %3
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), double %9)
ret i32 0
}