#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*/ assert(int);
scalar_t__ is_integer(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int test_is_integer() {
  char str[20];
  printf("test_is_integer...");
  sprintf(str, "%s", "123");
  assert(is_integer(str) != 0);
  sprintf(str, "%s", "abc");
  assert(is_integer(str) == 0);
  sprintf(str, "%s", "123abc");
  assert(is_integer(str) == 0);
  sprintf(str, "%s", "123.456");
  assert(is_integer(str) == 0);
  printf("ok\n");
  return 1;
}


x86 assembly (clang, -O0):
<test_is_integer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    0xeb4(%rip),%rsi
lea    0xeb0(%rip),%rdx
call   1060 <sprintf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <is_integer@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
lea    0xe83(%rip),%rsi
lea    0xe86(%rip),%rdx
call   1060 <sprintf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <is_integer@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
lea    0xe52(%rip),%rsi
lea    0xe52(%rip),%rdx
call   1060 <sprintf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <is_integer@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    -0x20(%rbp),%rdi
lea    0xe21(%rip),%rsi
lea    0xe28(%rip),%rdx
call   1060 <sprintf@plt>
lea    -0x20(%rbp),%rdi
call   1030 <is_integer@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
lea    0xe0a(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_is_integer>:
push   %rbx
sub    $0x20,%rsp
lea    0xeb4(%rip),%rdi
call   1050 <printf@plt>
movl   $0x333231,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <is_integer@plt>
xor    %edi,%edi
test   %rax,%rax
setne  %dil
call   1060 <assert@plt>
movl   $0x636261,(%rsp)
mov    %rbx,%rdi
call   1040 <is_integer@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
movl   $0x61333231,(%rsp)
movl   $0x636261,0x3(%rsp)
mov    %rbx,%rdi
call   1040 <is_integer@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
movabs $0x3635342e333231,%rax
mov    %rax,(%rsp)
mov    %rbx,%rdi
call   1040 <is_integer@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1060 <assert@plt>
lea    0xe3c(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"test_is_integer...\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"123\00"
@.str.3 = [4 x i8] c"abc\00"
@.str.4 = [7 x i8] c"123abc\00"
@.str.5 = [8 x i8] c"123.456\00"
@.str.6 = [4 x i8] c"ok\0A\00"
define i32 @test_is_integer() {
%1 = alloca [20 x i8]
%2 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%6 = call i64 @is_integer(i8* %5)
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%11 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%13 = call i64 @is_integer(i8* %12)
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%18 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%19 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%20 = call i64 @is_integer(i8* %19)
%21 = icmp eq i64 %20, 0
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%25 = call i32 @sprintf(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
%26 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%27 = call i64 @is_integer(i8* %26)
%28 = icmp eq i64 %27, 0
%29 = zext i1 %28 to i32
%30 = call i32 @assert(i32 %29)
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@.str = [19 x i8] c"test_is_integer...\00"
@.str.4 = [7 x i8] c"123abc\00"
@str = [3 x i8] c"ok\00"
define i32 @test_is_integer() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%4 = bitcast [20 x i8]* %1 to i32*
store i32 3355185, i32* %4
%5 = call i64 @is_integer(i8* %2)
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
store i32 6513249, i32* %4
%9 = call i64 @is_integer(i8* %2)
%10 = icmp eq i64 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = call i64 @is_integer(i8* %2)
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = bitcast [20 x i8]* %1 to i64*
store i64 15258146972054065, i64* %17
%18 = call i64 @is_integer(i8* %2)
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret i32 1
}