#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*/ fprintf(int /*<<< orphan*/, char *, char const *, char *,
                           char const *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char const *);
char *url_normalize(char const *);
int test_url_normalize(const char *url, const char *ref_url) {
  int ret;
  char *tmp = url_normalize(url);
  if (!strcmp(tmp, ref_url)) {
    ret = 1;
  } else {
    fprintf(stderr,
            "FAILURE: "
            "url_normalize(%s) returns %s instead of %s\n",
            url, tmp, ref_url);
    ret = 0;
  }
  free(tmp);
  return ret;
}


x86 assembly (clang, -O0):
<test_url_normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <url_normalize@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    117f <test_url_normalize+0x3f>
movl   $0x1,-0x14(%rbp)
jmp    11a7 <test_url_normalize+0x67>
mov    0x2e5a(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%r8
lea    0xe65(%rip),%rsi
call   1060 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_url_normalize>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
call   1040 <url_normalize@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1186 <test_url_normalize+0x46>
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
lea    0xe8c(%rip),%rsi
mov    %r15,%rdx
mov    %rbx,%rcx
mov    %r14,%r8
call   1060 <fprintf@plt>
xor    %ebp,%ebp
jmp    118b <test_url_normalize+0x4b>
mov    $0x1,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [53 x i8] c"FAILURE: url_normalize(%s) returns %s instead of %s\0A\00"
define i32 @test_url_normalize(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = call i8* @url_normalize(i8* %7)
store i8* %8, i8** %6
%9 = load i8*, i8** %6
%10 = load i8*, i8** %4
%11 = call i32 @strcmp(i8* %9, i8* %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %2
store i32 1, i32* %5
br label %20
14: ; preds = %2
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %3
%17 = load i8*, i8** %6
%18 = load i8*, i8** %4
%19 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %17, i8* %18)
store i32 0, i32* %5
br label %20
20: ; preds = %14, %13
%21 = load i8*, i8** %6
%22 = call i32 @free(i8* %21)
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [53 x i8] c"FAILURE: url_normalize(%s) returns %s instead of %s\0A\00"
define i32 @test_url_normalize(i8* %0, i8* %1) {
%3 = tail call i8* @url_normalize(i8* %0)
%4 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(1) %1)
%5 = icmp eq i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %3, i8* %1)
br label %9
9: ; preds = %2, %6
%10 = phi i32 [ 0, %6 ], [ 1, %2 ]
%11 = tail call i32 @free(i8* %3)
ret i32 %10
}