#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*/ free(char *);
char *getText(int);
int /*<<< orphan*/ send_http_header(int, int);
int /*<<< orphan*/ snprintf(char *, int, char *, ...);
int /*<<< orphan*/ write_st(int, char *, char *);
void write_offlinepage(int fd, int idx) {
  send_http_header(fd, 200);
  char text[20];
  if (idx == -1)
    snprintf(text, 19, "Alle");
  else
    snprintf(text, 19, "WR-%d", idx);
  char *txt = getText(100);
  write_st(fd, txt, text);
  free(txt);
}


x86 assembly (clang, -O0):
<write_offlinepage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0xc8,%esi
call   1050 <send_http_header@plt>
cmpl   $0xffffffff,-0x8(%rbp)
jne    1191 <write_offlinepage+0x41>
lea    -0x20(%rbp),%rdi
mov    $0x13,%esi
lea    0xe7b(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
jmp    11ab <write_offlinepage+0x5b>
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%ecx
mov    $0x13,%esi
lea    0xe61(%rip),%rdx
mov    $0x0,%al
call   1040 <snprintf@plt>
mov    $0x64,%edi
call   1060 <getText@plt>
mov    %rax,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%rsi
lea    -0x20(%rbp),%rdx
call   1070 <write_st@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_offlinepage>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebp
mov    %edi,%ebx
mov    $0xc8,%esi
call   1050 <send_http_header@plt>
cmp    $0xffffffff,%ebp
je     1183 <write_offlinepage+0x33>
lea    0xe95(%rip),%rdx
mov    %rsp,%rdi
mov    $0x13,%esi
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <snprintf@plt>
jmp    1199 <write_offlinepage+0x49>
lea    0xe76(%rip),%rdx
mov    %rsp,%rdi
mov    $0x13,%esi
xor    %eax,%eax
call   1040 <snprintf@plt>
mov    $0x64,%edi
call   1060 <getText@plt>
mov    %rax,%rbp
mov    %rsp,%rdx
mov    %ebx,%edi
mov    %rax,%rsi
call   1070 <write_st@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"Alle\00"
@.str.1 = [6 x i8] c"WR-%d\00"
define void @write_offlinepage(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [20 x i8]
%6 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = call i32 @send_http_header(i32 %7, i32 200)
%9 = load i32, i32* %4
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%13 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %12, i32 19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %18
14: ; preds = %2
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%16 = load i32, i32* %4
%17 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %15, i32 19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %18
18: ; preds = %14, %11
%19 = call i8* @getText(i32 100)
store i8* %19, i8** %6
%20 = load i32, i32* %3
%21 = load i8*, i8** %6
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%23 = call i32 @write_st(i32 %20, i8* %21, i8* %22)
%24 = load i8*, i8** %6
%25 = call i32 @free(i8* %24)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"Alle\00"
@.str.1 = [6 x i8] c"WR-%d\00"
define void @write_offlinepage(i32 %0, i32 %1) {
%3 = alloca [20 x i8]
%4 = tail call i32 @send_http_header(i32 %0, i32 200)
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%6 = icmp eq i32 %1, -1
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %5, i32 19, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %11
9: ; preds = %2
%10 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %5, i32 19, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 %1)
br label %11
11: ; preds = %9, %7
%12 = call i8* @getText(i32 100)
%13 = call i32 @write_st(i32 %0, i8* %12, i8* %5)
%14 = call i32 @free(i8* %12)
ret void
}