#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__ config_get(int);
int /*<<< orphan*/ config_set(int, void *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int arg1_init_val = 74621;
  int arg2_init_val = 25124;
  config_set(1, (void *)&arg1_init_val);
  config_set(2, (void *)&arg2_init_val);
  int *arg1_p = (int *)config_get(1);
  int *arg2_p = (int *)config_get(2);
  printf("---Config from function.---\n");
  printf("config.val1: %d\n", *arg1_p);
  printf("config.val2: %d\n", *arg2_p);
  printf("---Config from define.---\n");
  printf("config.val1: %d\n", *((int *)config_get(1)));
  printf("config.val2: %d\n", *((int *)config_get(2)));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1237d,-0x14(%rbp)
movl   $0x6224,-0x18(%rbp)
lea    -0x14(%rbp),%rsi
mov    $0x1,%edi
call   1050 <config_set@plt>
lea    -0x18(%rbp),%rsi
mov    $0x2,%edi
call   1050 <config_set@plt>
mov    $0x1,%edi
call   1040 <config_get@plt>
mov    %rax,-0x20(%rbp)
mov    $0x2,%edi
call   1040 <config_get@plt>
mov    %rax,-0x28(%rbp)
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rax
mov    (%rax),%esi
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <config_get@plt>
mov    (%rax),%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <config_get@plt>
mov    (%rax),%esi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x1237d,0x4(%rsp)
movl   $0x6224,(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x1,%edi
call   1060 <config_set@plt>
mov    %rsp,%rsi
mov    $0x2,%edi
call   1060 <config_set@plt>
mov    $0x1,%edi
call   1050 <config_get@plt>
mov    %rax,%rbx
mov    $0x2,%edi
call   1050 <config_get@plt>
mov    %rax,%r14
lea    0xe92(%rip),%rdi
call   1030 <puts@plt>
mov    (%rbx),%esi
lea    0xe62(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r14),%esi
lea    0xe5f(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe7b(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <config_get@plt>
mov    (%rax),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2,%edi
call   1050 <config_get@plt>
mov    (%rax),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [29 x i8] c"---Config from function.---\0A\00"
@.str.1 = [17 x i8] c"config.val1: %d\0A\00"
@.str.2 = [17 x i8] c"config.val2: %d\0A\00"
@.str.3 = [27 x i8] c"---Config from define.---\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 74621, i32* %6
store i32 25124, i32* %7
%10 = bitcast i32* %6 to i8*
%11 = call i32 @config_set(i32 1, i8* %10)
%12 = bitcast i32* %7 to i8*
%13 = call i32 @config_set(i32 2, i8* %12)
%14 = call i64 @config_get(i32 1)
%15 = inttoptr i64 %14 to i32*
store i32* %15, i32** %8
%16 = call i64 @config_get(i32 2)
%17 = inttoptr i64 %16 to i32*
store i32* %17, i32** %9
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%19 = load i32*, i32** %8
%20 = load i32, i32* %19
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%22 = load i32*, i32** %9
%23 = load i32, i32* %22
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%26 = call i64 @config_get(i32 1)
%27 = inttoptr i64 %26 to i32*
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = call i64 @config_get(i32 2)
%31 = inttoptr i64 %30 to i32*
%32 = load i32, i32* %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %32)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [17 x i8] c"config.val1: %d\0A\00"
@.str.2 = [17 x i8] c"config.val2: %d\0A\00"
@str = [28 x i8] c"---Config from function.---\00"
@str.4 = [26 x i8] c"---Config from define.---\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 74621, i32* %3
%6 = bitcast i32* %4 to i8*
store i32 25124, i32* %4
%7 = call i32 @config_set(i32 1, i8* %5)
%8 = call i32 @config_set(i32 2, i8* %6)
%9 = call i64 @config_get(i32 1)
%10 = inttoptr i64 %9 to i32*
%11 = call i64 @config_get(i32 2)
%12 = inttoptr i64 %11 to i32*
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%14 = load i32, i32* %10
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = load i32, i32* %12
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %16)
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.4, i64 0, i64 0))
%19 = call i64 @config_get(i32 1)
%20 = inttoptr i64 %19 to i32*
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = call i64 @config_get(i32 2)
%24 = inttoptr i64 %23 to i32*
%25 = load i32, i32* %24
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %25)
ret i32 0
}