#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);
int /*<<< orphan*/ money_to_integer(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int strlen(char *);
int test_money_to_integer() {
  char money[20];
  char value[20];
  int i;
  printf("test_money_to_integer...");
  sprintf(money, "%s", "12.95");
  money_to_integer((char *)money, value);
  assert(value[0] == '1');
  assert(value[1] == '2');
  assert(value[2] == '9');
  assert(value[3] == '5');
  assert(strlen(value) - 2 == 8);
  for (i = 4; i < strlen(value); i++) {
    assert(value[i] == '0');
  }
  printf("ok\n");
  return 1;
}


x86 assembly (clang, -O0):
<test_money_to_integer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
lea    -0x20(%rbp),%rdi
lea    0xeaa(%rip),%rsi
lea    0xea6(%rip),%rdx
call   1070 <sprintf@plt>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
call   1050 <money_to_integer@plt>
movsbl -0x40(%rbp),%eax
cmp    $0x31,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
movsbl -0x3f(%rbp),%eax
cmp    $0x32,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
movsbl -0x3e(%rbp),%eax
cmp    $0x39,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
movsbl -0x3d(%rbp),%eax
cmp    $0x35,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x2,%eax
cmp    $0x8,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
movl   $0x4,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    %eax,-0x48(%rbp)
lea    -0x40(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
cmp    %ecx,%eax
jge    123e <test_money_to_integer+0xee>
movslq -0x44(%rbp),%rax
movsbl -0x40(%rbp,%rax,1),%eax
cmp    $0x30,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11fb <test_money_to_integer+0xab>
lea    0xddd(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_money_to_integer>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xea2(%rip),%rdi
call   1050 <printf@plt>
movl   $0x392e3231,0x20(%rsp)
39
movw   $0x35,0x24(%rsp)
lea    0x20(%rsp),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1060 <money_to_integer@plt>
xor    %edi,%edi
cmpb   $0x31,(%rsp)
sete   %dil
call   1070 <assert@plt>
xor    %edi,%edi
cmpb   $0x32,0x1(%rsp)
sete   %dil
call   1070 <assert@plt>
xor    %edi,%edi
cmpb   $0x39,0x2(%rsp)
sete   %dil
call   1070 <assert@plt>
xor    %edi,%edi
cmpb   $0x35,0x3(%rsp)
sete   %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
xor    %edi,%edi
cmp    $0xa,%eax
sete   %dil
call   1070 <assert@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
cmp    $0x5,%eax
jl     1212 <test_money_to_integer+0xc2>
mov    $0x4,%ebx
mov    %rsp,%r14
nopl   0x0(%rax)
xor    %edi,%edi
cmpb   $0x30,(%rsp,%rbx,1)
sete   %dil
call   1070 <assert@plt>
add    $0x1,%rbx
mov    %r14,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     11f0 <test_money_to_integer+0xa0>
lea    0xe06(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"test_money_to_integer...\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [6 x i8] c"12.95\00"
@.str.3 = [4 x i8] c"ok\0A\00"
define i32 @test_money_to_integer() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = alloca i32
%4 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%9 = call i32 @money_to_integer(i8* %7, i8* %8)
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 49
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 1
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 50
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 2
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 57
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 3
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 53
%32 = zext i1 %31 to i32
%33 = call i32 @assert(i32 %32)
%34 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%35 = call i32 @strlen(i8* %34)
%36 = sub nsw i32 %35, 2
%37 = icmp eq i32 %36, 8
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
store i32 4, i32* %3
br label %40
40: ; preds = %54, %0
%41 = load i32, i32* %3
%42 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%43 = call i32 @strlen(i8* %42)
%44 = icmp slt i32 %41, %43
br i1 %44, label %45, label %57
45: ; preds = %40
%46 = load i32, i32* %3
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 48
%52 = zext i1 %51 to i32
%53 = call i32 @assert(i32 %52)
br label %54
54: ; preds = %45
%55 = load i32, i32* %3
%56 = add nsw i32 %55, 1
store i32 %56, i32* %3
br label %40
57: ; preds = %40
%58 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@.str = [25 x i8] c"test_money_to_integer...\00"
@.str.2 = [6 x i8] c"12.95\00"
@str = [3 x i8] c"ok\00"
define i32 @test_money_to_integer() {
%1 = alloca [20 x i8]
%2 = alloca [20 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @money_to_integer(i8* %3, i8* %4)
%7 = load i8, i8* %4
%8 = icmp eq i8 %7, 49
%9 = zext i1 %8 to i32
%10 = call i32 @assert(i32 %9)
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 50
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 2
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 57
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 3
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 53
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = call i32 @strlen(i8* %4)
%27 = icmp eq i32 %26, 10
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = call i32 @strlen(i8* %4)
%31 = icmp sgt i32 %30, 4
br i1 %31, label %32, label %43
32: ; preds = %0, %32
%33 = phi i64 [ %39, %32 ], [ 4, %0 ]
%34 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 %33
%35 = load i8, i8* %34
%36 = icmp eq i8 %35, 48
%37 = zext i1 %36 to i32
%38 = call i32 @assert(i32 %37)
%39 = add nuw nsw i64 %33, 1
%40 = call i32 @strlen(i8* %4)
%41 = sext i32 %40 to i64
%42 = icmp slt i64 %39, %41
br i1 %42, label %32, label %43
43: ; preds = %32, %0
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret i32 1
}