#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 */
scalar_t__ expect_absent(int);
scalar_t__ expect_result(int, char *);
int test_4xx(void) {
  int errcount = 0;
  errcount += expect_result(400, "bad request");
  errcount += expect_result(404, "not found");
  errcount += expect_result(414, "uri too long");
  errcount += expect_result(417, "expectation failed");
  errcount += expect_result(431, "request header fields too large");
  errcount += expect_absent(441);
  errcount += expect_result(451, "unavailable for legal reasons");
  errcount += expect_absent(470);
  errcount += expect_absent(493);
  return errcount;
}


x86 assembly (clang, -O0):
<test_4xx>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x190,%edi
lea    0xec5(%rip),%rsi
call   1040 <expect_result@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    $0x194,%edi
lea    0xeb3(%rip),%rsi
call   1040 <expect_result@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    $0x19e,%edi
lea    0xe9f(%rip),%rsi
call   1040 <expect_result@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    $0x1a1,%edi
lea    0xe8e(%rip),%rsi
call   1040 <expect_result@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    $0x1af,%edi
lea    0xe83(%rip),%rsi
call   1040 <expect_result@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    $0x1b9,%edi
call   1030 <expect_absent@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    $0x1c3,%edi
lea    0xe6e(%rip),%rsi
call   1040 <expect_result@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    $0x1d6,%edi
call   1030 <expect_absent@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    $0x1ed,%edi
call   1030 <expect_absent@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_4xx>:
push   %r15
push   %r14
push   %rbx
lea    0xed4(%rip),%rsi
mov    $0x190,%edi
call   1040 <expect_result@plt>
mov    %rax,%r14
lea    0xecc(%rip),%rsi
mov    $0x194,%edi
call   1040 <expect_result@plt>
mov    %rax,%r15
add    %r14d,%r15d
lea    0xebf(%rip),%rsi
mov    $0x19e,%edi
call   1040 <expect_result@plt>
mov    %rax,%rbx
add    %r15d,%ebx
lea    0xeb5(%rip),%rsi
mov    $0x1a1,%edi
call   1040 <expect_result@plt>
mov    %rax,%r14
add    %ebx,%r14d
lea    0xeb1(%rip),%rsi
mov    $0x1af,%edi
call   1040 <expect_result@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    $0x1b9,%edi
call   1030 <expect_absent@plt>
mov    %rax,%r14
add    %ebx,%r14d
lea    0xeaa(%rip),%rsi
mov    $0x1c3,%edi
call   1040 <expect_result@plt>
mov    %rax,%rbx
add    %r14d,%ebx
mov    $0x1d6,%edi
call   1030 <expect_absent@plt>
mov    %rax,%r14
add    %ebx,%r14d
mov    $0x1ed,%edi
call   1030 <expect_absent@plt>
add    %r14d,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [12 x i8] c"bad request\00"
@.str.1 = [10 x i8] c"not found\00"
@.str.2 = [13 x i8] c"uri too long\00"
@.str.3 = [19 x i8] c"expectation failed\00"
@.str.4 = [32 x i8] c"request header fields too large\00"
@.str.5 = [30 x i8] c"unavailable for legal reasons\00"
define i32 @test_4xx() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 @expect_result(i32 400, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
%4 = sext i32 %3 to i64
%5 = add nsw i64 %4, %2
%6 = trunc i64 %5 to i32
store i32 %6, i32* %1
%7 = call i64 @expect_result(i32 404, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* %1
%9 = sext i32 %8 to i64
%10 = add nsw i64 %9, %7
%11 = trunc i64 %10 to i32
store i32 %11, i32* %1
%12 = call i64 @expect_result(i32 414, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = add nsw i64 %14, %12
%16 = trunc i64 %15 to i32
store i32 %16, i32* %1
%17 = call i64 @expect_result(i32 417, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%18 = load i32, i32* %1
%19 = sext i32 %18 to i64
%20 = add nsw i64 %19, %17
%21 = trunc i64 %20 to i32
store i32 %21, i32* %1
%22 = call i64 @expect_result(i32 431, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%23 = load i32, i32* %1
%24 = sext i32 %23 to i64
%25 = add nsw i64 %24, %22
%26 = trunc i64 %25 to i32
store i32 %26, i32* %1
%27 = call i64 @expect_absent(i32 441)
%28 = load i32, i32* %1
%29 = sext i32 %28 to i64
%30 = add nsw i64 %29, %27
%31 = trunc i64 %30 to i32
store i32 %31, i32* %1
%32 = call i64 @expect_result(i32 451, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%33 = load i32, i32* %1
%34 = sext i32 %33 to i64
%35 = add nsw i64 %34, %32
%36 = trunc i64 %35 to i32
store i32 %36, i32* %1
%37 = call i64 @expect_absent(i32 470)
%38 = load i32, i32* %1
%39 = sext i32 %38 to i64
%40 = add nsw i64 %39, %37
%41 = trunc i64 %40 to i32
store i32 %41, i32* %1
%42 = call i64 @expect_absent(i32 493)
%43 = load i32, i32* %1
%44 = sext i32 %43 to i64
%45 = add nsw i64 %44, %42
%46 = trunc i64 %45 to i32
store i32 %46, i32* %1
%47 = load i32, i32* %1
ret i32 %47
}

LLVM IR (-O2):
@.str = [12 x i8] c"bad request\00"
@.str.1 = [10 x i8] c"not found\00"
@.str.2 = [13 x i8] c"uri too long\00"
@.str.3 = [19 x i8] c"expectation failed\00"
@.str.4 = [32 x i8] c"request header fields too large\00"
@.str.5 = [30 x i8] c"unavailable for legal reasons\00"
define i32 @test_4xx() {
%1 = tail call i64 @expect_result(i32 400, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = tail call i64 @expect_result(i32 404, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%3 = add i64 %2, %1
%4 = tail call i64 @expect_result(i32 414, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%5 = add i64 %3, %4
%6 = tail call i64 @expect_result(i32 417, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%7 = add i64 %5, %6
%8 = tail call i64 @expect_result(i32 431, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%9 = add i64 %7, %8
%10 = tail call i64 @expect_absent(i32 441)
%11 = add i64 %9, %10
%12 = tail call i64 @expect_result(i32 451, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0))
%13 = add i64 %11, %12
%14 = tail call i64 @expect_absent(i32 470)
%15 = add i64 %13, %14
%16 = tail call i64 @expect_absent(i32 493)
%17 = add i64 %15, %16
%18 = trunc i64 %17 to i32
ret i32 %18
}