#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*/ test_url_normalize(char *, char *);
int tests_url_normalize(void) {
  int failures;
  failures = 0;
  if (!test_url_normalize("http://test/test", "http://test/test"))
    failures++;
  if (!test_url_normalize("http://test/test/", "http://test/test"))
    failures++;
  return failures;
}


x86 assembly (clang, -O0):
<tests_url_normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rsi
mov    %rsi,%rdi
call   1030 <test_url_normalize@plt>
cmp    $0x0,%eax
jne    1140 <tests_url_normalize+0x30>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    0xeb2(%rip),%rsi
call   1030 <test_url_normalize@plt>
cmp    $0x0,%eax
jne    1165 <tests_url_normalize+0x55>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tests_url_normalize>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%r14
mov    %r14,%rdi
mov    %r14,%rsi
call   1030 <test_url_normalize@plt>
xor    %ebx,%ebx
test   %eax,%eax
sete   %bl
lea    0xedd(%rip),%rdi
mov    %r14,%rsi
call   1030 <test_url_normalize@plt>
lea    0x1(%rbx),%ecx
test   %eax,%eax
cmovne %ebx,%ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"http://test/test\00"
@.str.1 = [18 x i8] c"http://test/test/\00"
define i32 @tests_url_normalize() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @test_url_normalize(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%3 = icmp ne i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 1
store i32 %6, i32* %1
br label %7
7: ; preds = %4, %0
%8 = call i32 @test_url_normalize(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
store i32 %12, i32* %1
br label %13
13: ; preds = %10, %7
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
@.str = [17 x i8] c"http://test/test\00"
@.str.1 = [18 x i8] c"http://test/test/\00"
define i32 @tests_url_normalize() {
%1 = tail call i32 @test_url_normalize(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @test_url_normalize(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
%6 = select i1 %2, i32 2, i32 1
%7 = select i1 %5, i32 %6, i32 %3
ret i32 %7
}