#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*/ add_setting(char *, char *);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ get_setting(char *, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sprintf(char *, char *, double);
scalar_t__ strcmp(char *, char *);
void test_settings() {
  char value[512];
  char test1[512];
  char test2[512];
  sprintf(test1, "%.3f", 1.234);
  sprintf(test2, "%.3f", 2.567);
  value[0] = 0;
  printf("test_settings...");
  add_setting("test1", test1);
  add_setting("test2", test2);
  get_setting("test2", value);
  assert(strcmp(value, test2) == 0);
  get_setting("test1", value);
  assert(strcmp(value, test1) == 0);
  sprintf(test1, "%.3f", 7.235);
  add_setting("test1", test1);
  get_setting("test1", value);
  assert(strcmp(value, test1) == 0);
  printf("Ok\n");
}


x86 assembly (clang, -O0):
<test_settings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x600,%rsp
lea    -0x400(%rbp),%rdi
lea    0xe9f(%rip),%rsi
movsd  0xe8f(%rip),%xmm0
call   1080 <sprintf@plt>
lea    -0x600(%rbp),%rdi
lea    0xe84(%rip),%rsi
movsd  0xe6c(%rip),%xmm0
call   1080 <sprintf@plt>
movb   $0x0,-0x200(%rbp)
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
lea    -0x400(%rbp),%rsi
lea    0xe6c(%rip),%rdi
call   1070 <add_setting@plt>
lea    -0x600(%rbp),%rsi
lea    0xe5f(%rip),%rdi
call   1070 <add_setting@plt>
lea    -0x200(%rbp),%rsi
lea    0xe4c(%rip),%rdi
call   1050 <get_setting@plt>
lea    -0x200(%rbp),%rdi
lea    -0x600(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x200(%rbp),%rsi
lea    0xe0f(%rip),%rdi
call   1050 <get_setting@plt>
lea    -0x200(%rbp),%rdi
lea    -0x400(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    -0x400(%rbp),%rdi
lea    0xdc2(%rip),%rsi
movsd  0xda2(%rip),%xmm0
call   1080 <sprintf@plt>
lea    -0x400(%rbp),%rsi
lea    0xdbd(%rip),%rdi
call   1070 <add_setting@plt>
lea    -0x200(%rbp),%rsi
lea    0xdaa(%rip),%rdi
call   1050 <get_setting@plt>
lea    -0x200(%rbp),%rdi
lea    -0x400(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1060 <assert@plt>
lea    0xd86(%rip),%rdi
call   1030 <printf@plt>
add    $0x600,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_settings>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x608,%rsp
lea    0xe90(%rip),%r14
lea    0x400(%rsp),%r12
movsd  0xe68(%rip),%xmm0
mov    %r12,%rdi
mov    %r14,%rsi
call   1090 <sprintf@plt>
lea    0x200(%rsp),%r13
movsd  0xe55(%rip),%xmm0
mov    %r13,%rdi
mov    %r14,%rsi
call   1090 <sprintf@plt>
movb   $0x0,(%rsp)
lea    0xe54(%rip),%rdi
call   1040 <printf@plt>
lea    0xe59(%rip),%r15
mov    %r15,%rdi
mov    %r12,%rsi
call   1080 <add_setting@plt>
lea    0xe4d(%rip),%rbp
mov    %rbp,%rdi
mov    %r13,%rsi
call   1080 <add_setting@plt>
mov    %rsp,%rbx
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1060 <get_setting@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1050 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <get_setting@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
movsd  0xdcb(%rip),%xmm0
mov    %r12,%rdi
mov    %r14,%rsi
call   1090 <sprintf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1080 <add_setting@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <get_setting@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <strcmp@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
call   1070 <assert@plt>
lea    0xdb4(%rip),%rdi
call   1030 <puts@plt>
add    $0x608,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%.3f\00"
@.str.1 = [17 x i8] c"test_settings...\00"
@.str.2 = [6 x i8] c"test1\00"
@.str.3 = [6 x i8] c"test2\00"
@.str.4 = [4 x i8] c"Ok\0A\00"
define void @test_settings() {
%1 = alloca [512 x i8]
%2 = alloca [512 x i8]
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double 1.234000e+00)
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double 2.567000e+00)
%8 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
store i8 0, i8* %8
%9 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%11 = call i32 @add_setting(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%13 = call i32 @add_setting(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%15 = call i32 @get_setting(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %14)
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%17 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%18 = call i64 @strcmp(i8* %16, i8* %17)
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%23 = call i32 @get_setting(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %22)
%24 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%25 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%26 = call i64 @strcmp(i8* %24, i8* %25)
%27 = icmp eq i64 %26, 0
%28 = zext i1 %27 to i32
%29 = call i32 @assert(i32 %28)
%30 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%31 = call i32 @sprintf(i8* %30, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double 7.235000e+00)
%32 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%33 = call i32 @add_setting(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %32)
%34 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%35 = call i32 @get_setting(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %34)
%36 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%37 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%38 = call i64 @strcmp(i8* %36, i8* %37)
%39 = icmp eq i64 %38, 0
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.3f\00"
@.str.1 = [17 x i8] c"test_settings...\00"
@.str.2 = [6 x i8] c"test1\00"
@.str.3 = [6 x i8] c"test2\00"
@str = [3 x i8] c"Ok\00"
define void @test_settings() {
%1 = alloca [512 x i8]
%2 = alloca [512 x i8]
%3 = alloca [512 x i8]
%4 = getelementptr inbounds [512 x i8], [512 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%7 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double 1.234000e+00)
%8 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double 2.567000e+00)
store i8 0, i8* %4
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 @add_setting(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%11 = call i32 @add_setting(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%12 = call i32 @get_setting(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%13 = call i64 @strcmp(i8* %4, i8* %6)
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = call i32 @get_setting(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%18 = call i64 @strcmp(i8* %4, i8* %5)
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
%21 = call i32 @assert(i32 %20)
%22 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double 7.235000e+00)
%23 = call i32 @add_setting(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%24 = call i32 @get_setting(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %4)
%25 = call i64 @strcmp(i8* %4, i8* %5)
%26 = icmp eq i64 %25, 0
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}