#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 isAdditiveNumber(char *);
int /*<<< orphan*/ printf(char *, char *, int);
int main() {
  char s0[] = "123";
  printf("%s : %d\n", s0, isAdditiveNumber(s0));
  char s[] = "112358";
  printf("%s : %d\n", s, isAdditiveNumber(s));
  char s2[] = "10";
  printf("%s : %d\n", s2, isAdditiveNumber(s2));
  char s1[] = "198019823962";
  printf("%s : %d\n", s1, isAdditiveNumber(s1));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x40(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <isAdditiveNumber@plt>
mov    -0x40(%rbp),%rsi
mov    %eax,%edx
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    0xeac(%rip),%eax
mov    %eax,-0xf(%rbp)
mov    0xea6(%rip),%ax
mov    %ax,-0xb(%rbp)
mov    0xe9e(%rip),%al
mov    %al,-0x9(%rbp)
lea    -0xf(%rbp),%rax
mov    %rax,-0x38(%rbp)
lea    -0xf(%rbp),%rdi
call   1040 <isAdditiveNumber@plt>
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
mov    0xe72(%rip),%ax
mov    %ax,-0x12(%rbp)
mov    0xe6a(%rip),%al
mov    %al,-0x10(%rbp)
lea    -0x12(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    -0x12(%rbp),%rdi
call   1040 <isAdditiveNumber@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
lea    0xe37(%rip),%rdi
call   1030 <printf@plt>
mov    0xe3e(%rip),%rax
mov    %rax,-0x1f(%rbp)
mov    0xe3c(%rip),%eax
mov    %eax,-0x17(%rbp)
mov    0xe37(%rip),%al
mov    %al,-0x13(%rbp)
lea    -0x1f(%rbp),%rax
mov    %rax,-0x28(%rbp)
lea    -0x1f(%rbp),%rdi
call   1040 <isAdditiveNumber@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
lea    0xdf7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movl   $0x333231,0xc(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <isAdditiveNumber@plt>
lea    0xebd(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
movl   $0x383533,0x13(%rsp)
movl   $0x33323131,0x10(%rsp)
33
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <isAdditiveNumber@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
movb   $0x0,0xa(%rsp)
movw   $0x3031,0x8(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <isAdditiveNumber@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
movabs $0x32363933323839,%rax
mov    %rax,0x1d(%rsp)
movabs $0x3238393130383931,%rax
39 38 32
mov    %rax,0x18(%rsp)
lea    0x18(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <isAdditiveNumber@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.s0 = [4 x i8] c"123\00"
@.str = [9 x i8] c"%s : %d\0A\00"
@__const.main.s = [7 x i8] c"112358\00"
@__const.main.s2 = [3 x i8] c"10\00"
@__const.main.s1 = [13 x i8] c"198019823962\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i8]
%3 = alloca [7 x i8]
%4 = alloca [3 x i8]
%5 = alloca [13 x i8]
store i32 0, i32* %1
%6 = bitcast [4 x i8]* %2 to i8*
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%9 = call i32 @isAdditiveNumber(i8* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %9)
%11 = bitcast [7 x i8]* %3 to i8*
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%13 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%14 = call i32 @isAdditiveNumber(i8* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %12, i32 %14)
%16 = bitcast [3 x i8]* %4 to i8*
%17 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%18 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%19 = call i32 @isAdditiveNumber(i8* %18)
%20 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %17, i32 %19)
%21 = bitcast [13 x i8]* %5 to i8*
%22 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 0
%23 = getelementptr inbounds [13 x i8], [13 x i8]* %5, i64 0, i64 0
%24 = call i32 @isAdditiveNumber(i8* %23)
%25 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %22, i32 %24)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%s : %d\0A\00"
@__const.main.s = [7 x i8] c"112358\00"
@__const.main.s2 = [3 x i8] c"10\00"
@__const.main.s1 = [13 x i8] c"198019823962\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i8]
%3 = alloca [3 x i8]
%4 = alloca [13 x i8]
%5 = bitcast i32* %1 to i8*
store i32 3355185, i32* %1
%6 = call i32 @isAdditiveNumber(i8* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %2, i64 0, i64 0
%9 = call i32 @isAdditiveNumber(i8* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9)
%11 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%12 = call i32 @isAdditiveNumber(i8* %11)
%13 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %12)
%14 = getelementptr inbounds [13 x i8], [13 x i8]* %4, i64 0, i64 0
%15 = call i32 @isAdditiveNumber(i8* %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %14, i32 %15)
ret i32 0
}