#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*/ printf(char *, char *, int);
int strlen(char *);
int test_strlen(void) {
  do {
    if (!(strlen("") == 0)) {
      printf("expression '%s' untrue at %d\n", "strlen(\"\") == 0", 33);
      return 0;
    }
  } while (0);
  do {
    if (!(strlen("a") == 1)) {
      printf("expression '%s' untrue at %d\n", "strlen(\"a\") == 1", 34);
      return 0;
    }
  } while (0);
  do {
    if (!(strlen("long string") == 11)) {
      printf("expression '%s' untrue at %d\n", "strlen(\"long string\") == 11",
             35);
      return 0;
    }
  } while (0);
  return 1;
}


x86 assembly (clang, -O0):
<test_strlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeee(%rip),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%eax
je     1161 <test_strlen+0x41>
lea    0xebc(%rip),%rdi
lea    0xed3(%rip),%rsi
mov    $0x21,%edx
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f3 <test_strlen+0xd3>
jmp    1166 <test_strlen+0x46>
jmp    116b <test_strlen+0x4b>
lea    0xebc(%rip),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
je     11a4 <test_strlen+0x84>
lea    0xe79(%rip),%rdi
lea    0xea2(%rip),%rsi
mov    $0x22,%edx
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f3 <test_strlen+0xd3>
jmp    11a9 <test_strlen+0x89>
jmp    11ae <test_strlen+0x8e>
lea    0xe8c(%rip),%rdi
call   1030 <strlen@plt>
cmp    $0xb,%eax
je     11e7 <test_strlen+0xc7>
lea    0xe36(%rip),%rdi
lea    0xe7c(%rip),%rsi
mov    $0x23,%edx
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f3 <test_strlen+0xd3>
jmp    11ec <test_strlen+0xcc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_strlen>:
push   %rax
lea    0xef5(%rip),%rdi
call   1030 <strlen@plt>
test   %eax,%eax
je     1146 <test_strlen+0x26>
lea    0xec8(%rip),%rdi
lea    0xedf(%rip),%rsi
mov    $0x21,%edx
jmp    1197 <test_strlen+0x77>
lea    0xee1(%rip),%rdi
call   1030 <strlen@plt>
cmp    $0x1,%eax
jne    1184 <test_strlen+0x64>
lea    0xee3(%rip),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0xb,%ecx
je     119e <test_strlen+0x7e>
lea    0xe8a(%rip),%rdi
lea    0xed0(%rip),%rsi
mov    $0x23,%edx
jmp    1197 <test_strlen+0x77>
lea    0xe75(%rip),%rdi
lea    0xe9e(%rip),%rsi
mov    $0x22,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [30 x i8] c"expression '%s' untrue at %d\0A\00"
@.str.2 = [16 x i8] c"strlen(\22\22) == 0\00"
@.str.3 = [2 x i8] c"a\00"
@.str.4 = [17 x i8] c"strlen(\22a\22) == 1\00"
@.str.5 = [12 x i8] c"long string\00"
@.str.6 = [28 x i8] c"strlen(\22long string\22) == 11\00"
define i32 @test_strlen() {
%1 = alloca i32
br label %2
2: ; preds = %0
%3 = call i32 @strlen(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 33)
store i32 0, i32* %1
br label %23
7: ; preds = %2
br label %8
8: ; preds = %7
br label %9
9: ; preds = %8
%10 = call i32 @strlen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp eq i32 %10, 1
br i1 %11, label %14, label %12
12: ; preds = %9
%13 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 34)
store i32 0, i32* %1
br label %23
14: ; preds = %9
br label %15
15: ; preds = %14
br label %16
16: ; preds = %15
%17 = call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%18 = icmp eq i32 %17, 11
br i1 %18, label %21, label %19
19: ; preds = %16
%20 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 35)
store i32 0, i32* %1
br label %23
21: ; preds = %16
br label %22
22: ; preds = %21
store i32 1, i32* %1
br label %23
23: ; preds = %22, %19, %12, %5
%24 = load i32, i32* %1
ret i32 %24
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [30 x i8] c"expression '%s' untrue at %d\0A\00"
@.str.2 = [16 x i8] c"strlen(\22\22) == 0\00"
@.str.3 = [2 x i8] c"a\00"
@.str.4 = [17 x i8] c"strlen(\22a\22) == 1\00"
@.str.5 = [12 x i8] c"long string\00"
@.str.6 = [28 x i8] c"strlen(\22long string\22) == 11\00"
define i32 @test_strlen() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 33)
br label %15
5: ; preds = %0
%6 = tail call i32 @strlen(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%7 = icmp eq i32 %6, 1
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0), i32 34)
br label %15
10: ; preds = %5
%11 = tail call i32 @strlen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%12 = icmp eq i32 %11, 11
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 35)
br label %15
15: ; preds = %10, %13, %8, %3
%16 = phi i32 [ 0, %13 ], [ 0, %8 ], [ 0, %3 ], [ 1, %10 ]
ret i32 %16
}