#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 /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ sscanf(char const *, char *, int *, char *);
int main() {
  char buf[100];
  printf("---helle,i'm %s\n", "zzw");
  sprintf(buf, "helle,i'm %s", "zzw");
  puts(buf);
  int d = 0;
  char s[20];
  const char *str = "30 lll";
  sscanf(str, "%d%s", &d, s);
  printf("%d---%s\n", d, s);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
lea    0xeb1(%rip),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x70(%rbp),%rdi
lea    0xea3(%rip),%rsi
lea    0xe98(%rip),%rdx
call   1060 <sprintf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <puts@plt>
movl   $0x0,-0x74(%rbp)
lea    0xe8d(%rip),%rax
mov    %rax,-0x98(%rbp)
mov    -0x98(%rbp),%rdi
lea    -0x90(%rbp),%rcx
lea    0xe78(%rip),%rsi
lea    -0x74(%rbp),%rdx
call   1050 <sscanf@plt>
mov    -0x74(%rbp),%esi
lea    -0x90(%rbp),%rdx
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x98,%rsp
lea    0xeaf(%rip),%rdi
lea    0xeb9(%rip),%r14
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeac(%rip),%rsi
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14,%rdx
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
movl   $0x0,0xc(%rsp)
lea    0xe92(%rip),%rdi
lea    0xe92(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rcx
call   1050 <sscanf@plt>
mov    0xc(%rsp),%esi
lea    0xe7a(%rip),%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"---helle,i'm %s\0A\00"
@.str.1 = [4 x i8] c"zzw\00"
@.str.2 = [13 x i8] c"helle,i'm %s\00"
@.str.3 = [7 x i8] c"30 lll\00"
@.str.4 = [5 x i8] c"%d%s\00"
@.str.5 = [9 x i8] c"%d---%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
%4 = alloca [20 x i8]
%5 = alloca i8*
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%10 = call i32 @puts(i8* %9)
store i32 0, i32* %3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8** %5
%11 = load i8*, i8** %5
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%13 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32* %3, i8* %12)
%14 = load i32, i32* %3
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %14, i8* %15)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"---helle,i'm %s\0A\00"
@.str.1 = [4 x i8] c"zzw\00"
@.str.2 = [13 x i8] c"helle,i'm %s\00"
@.str.3 = [7 x i8] c"30 lll\00"
@.str.4 = [5 x i8] c"%d%s\00"
@.str.5 = [9 x i8] c"%d---%s\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca i32
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @puts(i8* %4)
%8 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%10 = call i32 @sscanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32* %2, i8* %9)
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i32 %11, i8* %9)
ret i32 0
}