#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *, char *);
int /*<<< orphan*/ strip_line(char *);
void save_strlist(FILE *f, FILE *f2, char *keyword) {
  char buf[512];
  while (fgets(buf, 512, f) != NULL) {
    strip_line(buf);
    if (!*buf)
      break;
    fprintf(f2, "%s=%s\n", keyword, buf);
  }
}


x86 assembly (clang, -O0):
<save_strlist>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x200,%esi
call   1030 <fgets@plt>
cmp    $0x0,%rax
je     11a4 <save_strlist+0x74>
lea    -0x220(%rbp),%rdi
call   1050 <strip_line@plt>
cmpb   $0x0,-0x220(%rbp)
jne    1184 <save_strlist+0x54>
jmp    11a4 <save_strlist+0x74>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    -0x220(%rbp),%rcx
lea    0xe66(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1147 <save_strlist+0x17>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<save_strlist>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x200,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%r12
mov    %rsp,%rdi
mov    $0x200,%esi
mov    %r12,%rdx
call   1030 <fgets@plt>
test   %rax,%rax
je     11a4 <save_strlist+0x74>
mov    %rsp,%rbx
lea    0xe98(%rip),%r13
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <strip_line@plt>
cmpb   $0x0,(%rsp)
je     11a4 <save_strlist+0x74>
mov    %r15,%rdi
mov    %r13,%rsi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
mov    $0x200,%esi
mov    %r12,%rdx
call   1030 <fgets@plt>
test   %rax,%rax
jne    1170 <save_strlist+0x40>
add    $0x200,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%s=%s\0A\00"
define void @save_strlist(i32* %0, i32* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca [512 x i8]
store i32* %0, i32** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
br label %8
8: ; preds = %20, %3
%9 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%10 = load i32*, i32** %4
%11 = call i32* @fgets(i8* %9, i32 512, i32* %10)
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %25
13: ; preds = %8
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%15 = call i32 @strip_line(i8* %14)
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%17 = load i8, i8* %16
%18 = icmp ne i8 %17, 0
br i1 %18, label %20, label %19
19: ; preds = %13
br label %25
20: ; preds = %13
%21 = load i32*, i32** %5
%22 = load i8*, i8** %6
%23 = getelementptr inbounds [512 x i8], [512 x i8]* %7, i64 0, i64 0
%24 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %22, i8* %23)
br label %8
25: ; preds = %19, %8
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%s=%s\0A\00"
define void @save_strlist(i32* nocapture %0, i32* nocapture %1, i8* %2) {
%4 = alloca [512 x i8]
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %4, i64 0, i64 0
%6 = call i32* @fgets(i8* %5, i32 512, i32* %0)
%7 = icmp eq i32* %6, null
br i1 %7, label %16, label %8
8: ; preds = %3, %12
%9 = call i32 @strip_line(i8* %5)
%10 = load i8, i8* %5
%11 = icmp eq i8 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %8
%13 = call i32 @fprintf(i32* %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %5)
%14 = call i32* @fgets(i8* %5, i32 512, i32* %0)
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %8
16: ; preds = %12, %8, %3
ret void
}