#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 */
long atol(char *);
int /*<<< orphan*/ printf(char *, char *, long);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  long val;
  char str[20];
  strcpy(str, "98993489");
  val = atol(str);
  printf("String value = %s, Long value = %ld\n", str, val);
  strcpy(str, "yiibai.com");
  val = atol(str);
  printf("String value = %s, Long value = %ld\n", str, val);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x30(%rbp),%rdi
call   1050 <atol@plt>
mov    %rax,-0x10(%rbp)
lea    -0x30(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rdi
lea    0xeb3(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x30(%rbp),%rdi
call   1050 <atol@plt>
mov    %rax,-0x10(%rbp)
lea    -0x30(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe6d(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xec2(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <atol@plt>
lea    0xeb1(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <printf@plt>
lea    0xec1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1050 <atol@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [9 x i8] c"98993489\00"
@.str.1 = [37 x i8] c"String value = %s, Long value = %ld\0A\00"
@.str.2 = [11 x i8] c"yiibai.com\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca [20 x i8]
store i32 0, i32* %1
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%7 = call i64 @atol(i8* %6)
store i64 %7, i64* %2
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%9 = load i64, i64* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %8, i64 %9)
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%14 = call i64 @atol(i8* %13)
store i64 %14, i64* %2
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%16 = load i64, i64* %2
%17 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %15, i64 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"98993489\00"
@.str.1 = [37 x i8] c"String value = %s, Long value = %ld\0A\00"
@.str.2 = [11 x i8] c"yiibai.com\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = call i64 @atol(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %2, i64 %4)
%6 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%7 = call i64 @atol(i8* %2)
%8 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0), i8* %2, i64 %7)
ret i32 0
}